cubewise-code / rushti

Smooth parallelization of TI Processes with TM1py
https://code.cubewise.com/tm1py-help-content/run-processes-in-parallel-using-only-connection
MIT License
9 stars 13 forks source link

Execute a Task only if the related predecessors finished executing successfully #56

Closed ardialikaj closed 1 year ago

ardialikaj commented 2 years ago

Can you please add a feature so a certain task, will start only if all related predecessors finished executing successfully

Let's say the below is my example: id="11" predecessors="" instance="XXfab" process="}bedrock.cube.data.export" id="21" predecessors="" instance="XXfab" process="}bedrock.cube.data.clear" id="31" predecessors="11,21" instance="XXfab" process="}bedrock.cube.data.import"

In the example above, task with id="31" will start only after both predecessors are completed. There are cases when we do not want to execute a task if any of predecessors failed. So can you consider implementing a feature so it will be possible to implement a mechanism that the process }bedrock.cube.data.import will be executed only if the predesessors completed successfully

Thank you

avanno commented 2 years ago

Hi @ardialikaj,

Quick question before we promote an enhancement for this. Would you like to control each task individually with this new feature? No matter the level of your task?

To illustrate this, let's say you have a new parameter called 'predecessors_succeed'. This parameter will trigger the execution of the task if their predecessors successfully completed. Now if I follow your example and add a new task with the same level of predecessors that your task "31" as below:

id="11" predecessors="" predecessors_succeed="" instance="XXfab" process="}bedrock.cube.data.export" id="21" predecessors="" predecessors_succeed="" instance="XXfab" process="}bedrock.cube.data.clear" id="31" predecessors="11,21" predecessors_succeed="1" instance="XXfab" process="}bedrock.cube.data.import" id="41" predecessors="11,21" predecessors_succeed="0" instance="XXfab" process="}bedrock.cube.data.export"

Both task "31" and "41" belong to the same level of execution: Unlike task "31" which will stop if "11" or "21" failed, task "41" will continue no matter the completion status of their predecessors. Are you ok with this behaviour?

Thank you,

MariusWirtz commented 2 years ago

Good question @avanno and thanks for taking over the task!

I like the idea to be able to control it on a task level. One small enhancement request on the name: Perhaps we could call it require_predecessor_success to make it very obvious what the new argument does.

ardialikaj commented 1 year ago

Hi @ardialikaj,

Quick question before we promote an enhancement for this. Would you like to control each task individually with this new feature? No matter the level of your task?

To illustrate this, let's say you have a new parameter called 'predecessors_succeed'. This parameter will trigger the execution of the task if their predecessors successfully completed. Now if I follow your example and add a new task with the same level of predecessors that your task "31" as below:

id="11" predecessors="" predecessors_succeed="" instance="XXfab" process="}bedrock.cube.data.export" id="21" predecessors="" predecessors_succeed="" instance="XXfab" process="}bedrock.cube.data.clear" id="31" predecessors="11,21" predecessors_succeed="1" instance="XXfab" process="}bedrock.cube.data.import" id="41" predecessors="11,21" predecessors_succeed="0" instance="XXfab" process="}bedrock.cube.data.export"

Both task "31" and "41" belong to the same level of execution: Unlike task "31" which will stop if "11" or "21" failed, task "41" will continue no matter the completion status of their predecessors. Are you ok with this behaviour?

Thank you,

This is exactly what I was thinking is required. Thank you

MariusWirtz commented 1 year ago

Completed with #57 and #58

@ardialikaj please confirm that it works as expected.