sartography / SpiffWorkflow

A powerful workflow engine implemented in pure Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deserialization error on subProcess from 1.2.1

george-0-huang opened this issue · comments

Issue

test5.txt

The attached diagram has a simple subProcess with one manual task (required input "credit_score" from console)
it reports following error during desrialization
File "/Users/georgehuang/Documents/VsCode/spiff-example-cli/venv/lib/python3.7/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'

Reproduce Steps

1: Copy the attached test5.txt into spiff-example-cli/bpmn folder as 'test5.bpmn'
2: Run
./run.py -p process_1 -b bpmn/test5.bpmn
-- enter D. //to enable state serialization
-- enter state.txt. //as state file name. (The generated state.txt for reference)

-- enter 1
-- enter 789. //as credit_score ...the actual value does not matter

3 Run
./run.py -r state.txt

Note
same digram works with 1.1.7

This has been fixed on the main branch of SpiffWorkflow but is not incorporated in a release:
38ce694

If you manually set the serializer version to 1.1 before you serialize a workflow, this would have the same effect.

Thanks for quick response, your suggestion works :-).

Workaround (based on essweine's suggestion)

serializer = create_serializer(
            [
                UserTaskConverter,
                StartEventConverter,
                EndEventConverter,
                IntermediateCatchEventConverter,
                IntermediateThrowEventConverter,
                BoundaryEventConverter,
                BusinessRuleTaskConverter,
            ],
            custom_data_converter,
        )
serializer.VERSION = 1.1.     #manually set version to 1.1