Skip to content

Commit fb9a37e

Browse files
committed
Added command line option '--persist' that enables persistence of the workflow execution state to a file.
1 parent 29d5a3a commit fb9a37e

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

bin/hflow

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var docopt = require('docopt').docopt,
1818

1919
var doc = "\
2020
Usage:\n\
21-
hflow run <workflow_dir_or_file> [-s] [--with-server] [--log-provenance] [--provenance-output=<provenance_file>] [-p <plugin_module_name> ...]\n\
21+
hflow run <workflow_dir_or_file> [-s] [--persist] [--with-server] [--log-provenance] [--provenance-output=<provenance_file>] [-p <plugin_module_name> ...]\n\
2222
hflow recover <persistence-log> [-p <plugin_module_name> ...]\n\
2323
hflow start-server [-p <plugin_module_name> ...]\n\
2424
hflow send <wf_id> ( <signal_file> | -d <signal_data> ) [-p <plugin_module_name> ...]\n\
@@ -168,19 +168,22 @@ function hflow_run() {
168168
});
169169
}
170170

171-
// TODO: implement a plugin for different persistence backends
172-
// FIXME: generate unique persist-log file name
173-
var date = new Date().toISOString().replace(new RegExp('[T:.]', 'g'), '-').replace('Z', '');
174-
var logFileName = (wfName ? wfName: 'wf').concat('.' + date + ".log");
175-
console.log("Persistence log:", logFileName);
176-
var persistlog=pathtool.join(wfDirFull, logFileName);
177-
engine.eventServer.on('persist', function() {
178-
cargo.push( { "filename": persistlog, "args": JSON.stringify(arguments) }, function(err) {
179-
if (err) {
180-
console.log("cargo errror! " + err);
181-
}
171+
172+
if (opts['--persist']) { // enable persistence of workflow execution state
173+
// TODO: implement a plugin for different persistence backends
174+
// FIXME: generate unique persist-log file name
175+
var date = new Date().toISOString().replace(new RegExp('[T:.]', 'g'), '-').replace('Z', '');
176+
var logFileName = (wfName ? wfName: 'wf').concat('.' + date + ".log");
177+
console.log("Persistence log:", logFileName);
178+
var persistlog=pathtool.join(wfDirFull, logFileName);
179+
engine.eventServer.on('persist', function() {
180+
cargo.push( { "filename": persistlog, "args": JSON.stringify(arguments) }, function(err) {
181+
if (err) {
182+
console.log("cargo errror! " + err);
183+
}
184+
});
182185
});
183-
});
186+
}
184187

185188
// we persist the full workflow directory path and execution options used to run the workflow
186189
engine.eventServer.emit('persist', ["info", wfDirFull, JSON.stringify(opts)]);

0 commit comments

Comments
 (0)