Conditional task execution
I’d like to condition the execution of a task on the success of another task. For example, I’d like to avoid checking (and displaying message for) the types of the arguments of a function call if no function with the specified name exists.
Submitted by Vlad Vergu on 9 July 2013 at 01:52
Issue Log
You can pass dependencies to the task creators.
Say i have the following:
def-task := <lookup-def(|ctx)> name;
calc-task := <type-of(|ctx, def-task)> term;
<task-create-error-on-failure(|ctx, calc-task, “incompatible arguments”)> callIf def-task fails, then the error is present. I want the error to be present only if calc-task fails not if it’s dependencies fail.
I.e. there is no difference between task failed and task failed because it has unmet dependencies.
I see, this is indeed an issue. This requires to distinguish failure from not executed due to missing dependencies. I am not sure if this distinction can be achieved at the error message creation level or needs to be made in the task engine itself.
This requires modification of the task engine. Currently each task has a failed flag that indicates failure of that task or failure of its dependencies. To distinguish this we need another flag that indicates failure of dependencies. Message tasks should then only be evaluated if all its dependencies do not have the dependency failure flag set to true.
However, we do want to evaluate Choice tasks that have dependencies with dependency failures, since there might be one dependency that has results. So we would need another flag to indicate if a task should be evaluated if its dependencies have a dependency failure.
You might also make this a derived value, i.e. not store it, but calculate it if needed.
real-failure = failure && all-dependencies-fullfilled
. I am not sure ifall-dependencies-fullfilled
is already there. If not, it would be useful to have, because it basically tells this task is available for execution.
Implemented in https://github.com/metaborg/runtime-libraries/tree/separate-depfail, will merge into master after testing.
Looks like this was merged in 24464f3882.
Log in to post comments