11#!/usr/bin/env node
2+
3+ var redisURL = process . env . REDIS_URL ? { url : process . env . REDIS_URL } : { } ;
4+
5+
26var docopt = require ( 'docopt' ) . docopt ,
37 spawn = require ( 'child_process' ) . spawn ,
4- fs = require ( 'fs' ) ,
8+ fs = require ( 'fs' ) ,
59 pathtool = require ( 'path' ) ,
610 redis = require ( 'redis' ) ,
7- rcl = redis . createClient ( ) ,
11+ rcl = redis . createClient ( redisURL ) ,
812 wflib = require ( '../wflib' ) . init ( rcl ) ,
913 Engine = require ( '../engine2' ) ,
1014 async = require ( 'async' ) ,
@@ -42,15 +46,15 @@ function hflow_run() {
4246 if ( opts [ '--with-server' ] ) {
4347 hflow_start ( ) ; // start the HTTP server
4448 }
45-
49+
4650 if ( wfstats . isDirectory ( ) ) {
4751 wffile = pathtool . join ( wfpath , "workflow.json" ) ;
4852 } else if ( wfstats . isFile ( ) ) {
4953 wffile = wfpath ;
5054 wfpath = pathtool . dirname ( wfpath ) ;
5155 }
5256
53- var runWf = function ( wfId ) {
57+ var runWf = function ( wfId ) {
5458 var config = { "emulate" :"false" , "workdir" : pathtool . resolve ( wfpath ) } ;
5559 var engine = new Engine ( config , wflib , wfId , function ( err ) {
5660 // This represent custom plugin listening on event from available eventServer
@@ -62,7 +66,7 @@ function hflow_run() {
6266 if ( opts [ '-s' ] ) {
6367 // Flag -s is present: send all input signals to the workflow -> start execution
6468 wflib . getWfIns ( wfId , false , function ( err , wfIns ) {
65- engine . wflib . getSignalInfo ( wfId , wfIns , function ( err , sigs ) {
69+ engine . wflib . getSignalInfo ( wfId , wfIns , function ( err , sigs ) {
6670 engine . emitSignals ( sigs ) ;
6771 } ) ;
6872 } ) ;
@@ -75,7 +79,7 @@ function hflow_run() {
7579 rcl . select ( dbId , function ( err , rep ) {
7680 //rcl.flushdb(function(err, rep) { // flushing db here deletes the global 'hfid' entry (created earlier)
7781 wflib . createInstanceFromFile ( wffile , '' , function ( err , id ) {
78- cb ( err , id ) ;
82+ cb ( err , id ) ;
7983 } ) ;
8084 //});
8185 } ) ;
0 commit comments