Update the spec for workflow. Args: diff (`WorkflowDiff`): the diff of this workflow and spec workflow (`BpmnWorkflow` or `BpmnSubWorkflow`): the workflow spec (`BpmnProcessSpec`): the new spec Keyword Args: reset_mask (`TaskState`): reset and repredict task
(diff, workflow, spec, reset_mask=None)
| 211 | return [t for t in tasks if task_filter.matches(t)] |
| 212 | |
| 213 | def migrate_workflow(diff, workflow, spec, reset_mask=None): |
| 214 | """Update the spec for workflow. |
| 215 | |
| 216 | Args: |
| 217 | diff (`WorkflowDiff`): the diff of this workflow and spec |
| 218 | workflow (`BpmnWorkflow` or `BpmnSubWorkflow`): the workflow |
| 219 | spec (`BpmnProcessSpec`): the new spec |
| 220 | |
| 221 | Keyword Args: |
| 222 | reset_mask (`TaskState`): reset and repredict tasks in this state |
| 223 | |
| 224 | Returns |
| 225 | a list of deleted `Task` |
| 226 | |
| 227 | The default rest_mask is TaskState.READY|TaskState.WAITING but can be overridden. |
| 228 | """ |
| 229 | workflow.spec = spec |
| 230 | for task in workflow.tasks.values(): |
| 231 | if diff.alignment.get(task) is not None: |
| 232 | task.task_spec = diff.alignment.get(task) |
| 233 | |
| 234 | default_mask = TaskState.READY|TaskState.WAITING |
| 235 | removed_tasks = [] |
| 236 | for task in list(workflow.get_tasks(state=reset_mask or default_mask, skip_subprocesses=True)): |
| 237 | # In some cases, completed tasks with ready or waiting children could get removed |
| 238 | # (for example, in cycle timer). If a task has already been removed from the tree, ignore it. |
| 239 | if task.id in workflow.tasks: |
| 240 | removed_tasks.extend(task.reset_branch(None)) |
| 241 | |
| 242 | if workflow.last_task not in workflow.tasks: |
| 243 | workflow.last_task = None |
| 244 | |
| 245 | return removed_tasks |
nothing calls this directly
no test coverage detected