-
Hello! I'm wondering, I have built a workflow in which several calculations are submitted internally via a loop. It is basically a custom EOS plugin with some bells and whistles. However, in the code I'm using there is the possibility that one calculation (out of the many sent by the loop) ends in an irrecoverable failure state (i.e. the So I wonder is it possible to kill the workchain in case of one of these calculations submitted to the context fails, before waiting for all the other ones to finish? Or would you solve the problem in a different manner? How do you normally handle cases like this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @JPchico! Thanks for your question, and happy to see you've found your way to the GitHub Discussions. 😃 Would it be possible to share the work chain you are working on somehow? It's probably easier if I can have a look. To be honest though, @sphuber is probably best suited to answer your question 😅, and he's AFK at the moment. |
Beta Was this translation helpful? Give feedback.
-
There is nothing built into def submit_sub(self):
for i in range(5):
sub = self.submit(SomeProcess, **inputs)
self.to_context_new(f'sub_{i}', sub, callback=self.check_sub)
def check_sub(self, sub_node):
if sub_node.is_excepted or sub_node.is_killed or sub_node.exit_code.status < 400:
return self.exit_codes.SUB_PROCESS_FAILED The new method The one thing missing here is that the other subprocesses are not killed. It is not clear if this should be done automatically (maybe in some cases you actually want to keep them running) so maybe the user should do this manually in the callback. But in that case you need the TLDR: there is nothing built-in, but if thought to be useful, some support could be built into |
Beta Was this translation helpful? Give feedback.
There is nothing built into
aiida-core
that let's you instruct the workchain to terminate itself as soon as one of the "awaitables" excepts, is killed or terminates with a specific exit code. One could think of adding such a thing, but it would require a change in the current interface. One option would be to allow specifying a callback when adding an awaitable to the context, for example: