Commit e3ed9a2
committed
Engine: Ensure node is sealed when process excepts (#6549)
Processes that hit a certain exception were not being sealed. This would
cause problems when trying to export them, which only allows sealed
nodes. The problem occurs when another exception occurs while handling
the original exception.
An example is when `Process.update_outputs` would raise a `ValueError`
because an unstored node had be attached as an output. Since this method
is called in `on_entered`, which is called when the process entered a
new state, it would be called again when it entered the excepted state.
Since the process was already excepted, the rest of the state changes is
cut short by `plumpy`. This would cause the process to never go to the
final `TERMINATED` state and so the `on_terminated` method would not be
called, which is where the process' node is sealed.
The solution is to check the current state in `on_entered` and if it is
`EXCEPTED` to simply return and no longer perform any updates on the
node. This should prevent any other exceptions from being hit and ensure
the process transitions properly to the final terminated state. The only
update that is still performed is to update the process state on the
process' node, otherwise it would not properly be shown as excepted.
Cherry-pick: cbf672f1 parent 389fc48 commit e3ed9a2
File tree
2 files changed
+12
-1
lines changed- src/aiida/engine/processes
- tests/engine
2 files changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| 417 | + | |
| 418 | + | |
417 | 419 | | |
418 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
419 | 430 | | |
420 | 431 | | |
421 | 432 | | |
| |||
431 | 442 | | |
432 | 443 | | |
433 | 444 | | |
434 | | - | |
435 | 445 | | |
436 | 446 | | |
437 | 447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| 425 | + | |
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| |||
0 commit comments