diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-13 18:59:01 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-13 18:59:01 +0200 |
| commit | a456f4aeade66f93768583c5838591684c914092 (patch) | |
| tree | e9951d43e3fd67bf44bc02216837b7350e72a001 /app/relay/runner.js | |
| parent | 15752a2225e382d235a123f65b4eb9089590ce17 (diff) | |
recursive task
Diffstat (limited to 'app/relay/runner.js')
| -rw-r--r-- | app/relay/runner.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/relay/runner.js b/app/relay/runner.js index dbfcb4b..d42316d 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -98,6 +98,9 @@ export function build_params(module, activity, task) { let opt_params, activity_params; if (typeof activity.params === 'function') { opt_params = activity.params(task) + if (opt_params === 'CANCEL') { + return { cancelled: true }; + } activity_params = [] } else { @@ -267,7 +270,8 @@ export function run_script(task, cb) { } const module = modules[task.module] const activity = module.activities[task.activity] - const { interpreter, params } = build_params(module, activity, task) + const { interpreter, params, cancelled } = build_params(module, activity, task) + if (cancelled) return { type: 'error', error: "Task builder cancelled process" } if (! interpreter) return { type: 'error', error: "No such interpreter: " + activity.interpreter } if (! activity.isScript) return { type: 'error', error: "Not a script: " + task.module } @@ -306,7 +310,7 @@ export function run_task(task, preempt=false, watch=false){ } export function run_task_with_activity(task, module, activity, preempt=false, watch=false) { - const { interpreter, params } = build_params(module, activity, task) + const { interpreter, params, cancelled } = build_params(module, activity, task) if (! interpreter) return { type: 'error', error: "No such interpreter: " + activity.interpreter } if (interpreter.gpu && state.current_gpu_task.status !== 'IDLE') { |
