-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CalcJob
: Fix bug causing exception after restarting daemon (#5886)
In `v2.2.0`, a feature was added to attach monitors to a `CalcJob` for which the `Waiting` (see `aiida.engine.processes.calcjob.tasks`) state of the process was modified. The `_command` attribute was moved inside the `data` argument passed to the constructor and was initialized only in the constructor. However, when the process is loaded from a serialized checkpoint, such as after a daemon restart, the constructor is not called but `load_instance_state` is. In this case, the `_command` attribute would not be set and when referenced it would cause an exception. The solution is to add the `_command` attribute to the `auto_persist` decorator as this will be called on `load_instance_state` and will reinitialize these attributes from the persisted checkpoint. A similar problem was lurking with the `_monitors` attribute which was also only initialized in the constructor. Since this has a custom data type `CalcJobMonitors` which may not be serializable by `auto_persist` a property `monitors` is added that will recreate the attribute and populate it with the `CalcJobMonitors` instance with the monitors specified in the inputs.
- Loading branch information
Showing
2 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters