xworkflows icon indicating copy to clipboard operation
xworkflows copied to clipboard

InvalidTransitionError raised after being pickled

Open corbinbs opened this issue 11 years ago • 0 comments

Hi

I've been experimenting with 'pausing' a workflow so that it might be resumed at a later time (and possibly a different machine). The workflow moves between transitions normally when the WorkflowEnabled object is used in the python interpreter it was created within. If the WorkflowEnabled object is pickled and loaded back up in another interpreter to be 'resumed', it raises an InvalidTransitionError on the first attempt to transition to a different State. It looks like this is due to two different state instances being compared (that have the same name and title)

https://github.com/rbarrois/xworkflows/blob/master/xworkflows/base.py#L159

since nothing is returned from the call to available_from, the InvalidTransitionError is raised. I was going to send over a pull request to allow States to be considered equal if they had the same name and title, but it looks like there are test cases that explicitly check to ensure that different State instances with the same name and title are treated as not equal. I'm wondering how best to proceed. Is it possible to reconsider the equality of States with the same name and title? Maybe it's better to investigate how to pickle/unpickle to ensure States are linked back up using the same State instance where appropriate?

Thanks,

Brian

corbinbs avatar Jan 31 '14 03:01 corbinbs