I am facing the following problem: I am in a configuration with a multi-task firework. From a task in this firework I would like to create a detour of the current firework so that it will only execute the remaining tasks in the new firework. The structure of the firework is not strictly fixed and it would be basically impossible to have a different function to handle each different case.
As a potential solution, the full list of tasks in the firework can be taken from the
_tasks attribute in the
fw_spec, so the problem is to figure out the task being executed in this list. After giving some though I concluded that a clean way could be to have access directly to the index of the task: for example having a new reserved keyword in
fw_spec (e.g. _task_index) that will be set by the rocket runner with the index of the current task in the firework.
Since I am not sure if this would be an acceptable update, I wanted to check if somebody else already had a similar problem and came up with smarter solution. Or otherwise if I can proceed to implement this in fireworks.
Alternative solutions I have thought about include:
identifying the task being executed based on the class of the task itself: may not work as more than one task with the same class could be present. One could further inspect the task and try to distinguish them based on some attribute, but this could become tricky
adding an index to each task myself: this would work but it seems much more difficult to maintain compared to having this index directly from fireworks.