Skip to content

Set self.state_machine to None for terminal states #198

@chrisjsewell

Description

@chrisjsewell

The next issue is with the plumpy state, which is cyclic since the Process keeps a reference of the state and the state keeps a reference of the Process:

In [19]: from plumpy.process_states import State
In [20]: states = [o for o in all_objects if hasattr(o, "__class__") and isinstance(o, State)] 
    ...: states                                                                                                                   
Out[20]: [<plumpy.process_states.Finished at 0x7f56a01f5ac0>]

In [21]: f = states[0]                                                                                                            

In [22]: f.__dict__                                                                                                               
Out[22]: 
{'state_machine': <aiida_sleep.sleep_job.SleepCalculation at 0x7f56a04f55e0>,
 'in_state': True,
 'result': ExitCode(status=0, message=None, invalidates_cache=False),
 'successful': True,
 '_called': 0,
 'state': None}

In [23]: f.state_machine._state
Out[23]: <plumpy.process_states.Finished at 0x7f56a01f5ac0>

Originally posted by @chrisjsewell in aiidateam/aiida-core#4603 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions