@@ -6,10 +6,9 @@ var docopt = require('docopt').docopt;
66
77var doc = "\
88Usage:\n\
9- hflow run <workflow_dir_or_file> [-s] [--persist] [--with-server] [--log-provenance] [--provenance-output=<provenance_file>] [-p <plugin_module_name> ...] [--var=<name=value> ...]\n\
9+ hflow run <workflow_dir_or_file> [-s] [--submit=<hyperflow_server_url] [-- persist] [--with-server] [--log-provenance] [--provenance-output=<provenance_file>] [-p <plugin_module_name> ...] [--var=<name=value> ...]\n\
1010 hflow recover <persistence-log> [-p <plugin_module_name> ...] [--var=<name=value> ...]\n\
1111 hflow start-server [-p <plugin_module_name> ...]\n\
12- hflow submit <workflow_dir_or_file> --url=<hyperflow_server_url> [-s] [--persist] [--log-provenance] [--provenance-output=<provenance_file>] [-p <plugin_module_name> ...] [--var=<name=value> ...]\n\
1312 hflow send <wf_id> ( <signal_file> | -d <signal_data> ) [-p <plugin_module_name> ...]\n\
1413 hflow -h | --help | --version" ;
1514
@@ -21,7 +20,7 @@ if (opts['--version']) {
2120 process . exit ( 0 ) ;
2221}
2322
24- if ( opts . submit ) {
23+ if ( opts [ '-- submit' ] ) {
2524 hflowSubmit ( opts ) ;
2625 return ;
2726}
@@ -46,19 +45,22 @@ var hfroot = pathtool.join(require('path').dirname(require.main.filename), "..")
4645// Workflow variables TODO: add support for config files
4746
4847if ( opts . run ) {
48+ if ( opts [ '--with-server' ] ) {
49+ hflowStartServer ( ) ;
50+ }
4951 hflowRun ( opts , function ( err , engine ) { } ) ;
5052} else if ( opts . send ) {
51- hflow_send ( ) ;
53+ hflowSend ( opts ) ;
5254} else if ( opts [ 'start-server' ] ) {
53- hflow_start ( ) ;
55+ hflowStartServer ( ) ;
5456} else if ( opts . recover ) {
5557 hflowRun ( opts , function ( err , engine ) { } ) ;
5658} /*else if (opts.submit) {
5759 hflowSubmit(opts);
5860}*/
5961
6062function hflowSubmit ( opts ) {
61- let hfserver = opts [ '--url ' ] ,
63+ let hfserver = opts [ '--submit ' ] ,
6264 url = hfserver + '/apps' ;
6365
6466 axios ( {
@@ -71,14 +73,14 @@ function hflowSubmit(opts) {
7173 } ) ;
7274}
7375
74- function hflow_start ( ) {
76+ function hflowStartServer ( ) {
7577 var server = require ( '../server/hyperflow-server.js' ) ( rcl , wflib , plugins ) ;
7678 let hostname = '127.0.0.1' , port = process . env . PORT ;
7779 server . listen ( port , ( ) => {
7880 console . log ( "HyperFlow server started, app factory URI: http://%s:%d/apps" , server . address ( ) . address , server . address ( ) . port ) ;
7981 } ) ;
8082}
8183
82- function hflow_send ( ) {
84+ function hflowSend ( opts ) {
8385 console . log ( "send signal to a workflow: not implemented" ) ;
8486}
0 commit comments