set the subprocess task state back to STARTED in pi migrations w/ burnettk (#1970)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-07-22 13:14:12 -04:00 committed by GitHub
parent 0fc4e3b630
commit a4e0386ab7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -231,9 +231,25 @@ class ProcessInstanceService:
subprocesses_diffs,
) = cls.check_process_instance_can_be_migrated(process_instance, target_bpmn_process_hash=target_bpmn_process_hash)
deleted_tasks = migrate_workflow(top_level_bpmn_process_diff, processor.bpmn_process_instance, target_bpmn_process_spec)
migration_task_mask = TaskState.READY | TaskState.WAITING | TaskState.STARTED
deleted_tasks = migrate_workflow(
top_level_bpmn_process_diff,
processor.bpmn_process_instance,
target_bpmn_process_spec,
reset_mask=migration_task_mask,
)
for sp_id, sp in processor.bpmn_process_instance.subprocesses.items():
deleted_tasks += migrate_workflow(subprocesses_diffs[sp_id], sp, target_subprocess_specs.get(sp.spec.name))
deleted_tasks += migrate_workflow(
subprocesses_diffs[sp_id],
sp,
target_subprocess_specs.get(sp.spec.name),
reset_mask=migration_task_mask,
)
# make sure we change the subprocess_spiff_task state back to STARTED after the migration
if not sp.is_completed():
subprocess_spiff_task = processor.bpmn_process_instance.get_task_from_id(sp_id)
subprocess_spiff_task._set_state(TaskState.STARTED)
processor.bpmn_process_instance.subprocess_specs = target_subprocess_specs
if preserve_old_process_instance: