sartography/SpiffWorkflow

When running spiff-example-cli I receive error when trying to restore a flow

kokhoor opened this issue · 3 comments

I am facing trouble restoring workflow using the spiff-example-cli example.

As per the instructions in github, I run:

python run.py -p order_product -d bpmn/product_prices.dmn bpmn/shipping_costs.dmn -b bpmn/multiinstance.bpmn bpmn/call_activity_multi.bpmn

When prompted what to do, I chose to dump the workflow state into a file named flow.1

1.  Select Product and Quantity (Activity_1uazifo)
Select task to complete, enter to wait, or D to dump the workflow state: D
Enter filename: flow.1

I then exit the program and proceed to run the same flow with the restore command line

python run.py -d bpmn/product_prices.dmn bpmn/shipping_costs.dmn -b bpmn/multiinstance.bpmn bpmn/call_activity_multi.bpmn --restore flow.1

And this is the error I get:

Traceback (most recent call last):
  File "spiff-example-cli\run.py", line 79, in <module>
    wf = serializer.deserialize_json(state.read())
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\bpmn\Lib\site-packages\SpiffWorkflow\bpmn\serializer\workflow.py", line 143, in deserialize_json
    return self.workflow_from_dict(dct, read_only)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\bpmn\Lib\site-packages\SpiffWorkflow\bpmn\serializer\workflow.py", line 189, in workflow_from_dict
    dct_copy = MIGRATIONS[version](dct_copy)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\bpmn\Lib\site-packages\SpiffWorkflow\bpmn\serializer\version_migration.py", line 26, in version_1_0_to_1_1
    subprocesses[sp]['tasks'][task_id]['parent'] = None
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'data'

How do I fix this?

By the way, I am using 64-bit Python 3.11.2 running on windows

I apologize for the delay in responding to this. You are seeing this error because the wrong serialization format version is being written. If you update the serializer_version key from 1.0 to 1.1 in any already serialized workflows, it should work. I also just push a fix to override the version in the example application (so from here on out, the correct version should be written).

Not a problem. Thanks a lot. It works now.

Keep up the great work, everyone!