Skip to content

Commit 9116958

Browse files
committed
restrict task search when looking for start and end (and correct typo in parameter)
1 parent 6d18cb8 commit 9116958

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, wf_spec, bpmn_id, subworkflow_spec, **kwargs):
8585

8686
def copy_data(self, my_task, subworkflow):
8787

88-
start = subworkflow.get_next_task(spec_name='Start')
88+
start = subworkflow.get_next_task(subworkflow.task_tree, skip_subprocesses=True, spec_name='Start')
8989
if subworkflow.spec.io_specification is None or len(subworkflow.spec.io_specification.data_inputs) == 0:
9090
# Copy all task data into start task if no inputs specified
9191
start.set_data(**my_task.data)
@@ -106,7 +106,7 @@ def update_data(self, my_task, subworkflow):
106106
# Copy all workflow data if no outputs are specified
107107
my_task.data = deepcopy(subworkflow.last_task.data)
108108
else:
109-
end = subworkflow.get_next_task(spec_name='End')
109+
end = subworkflow.get_next_task(subworkflow.task_tree, skip_subprocesses=True, spec_name='End')
110110
# Otherwise only copy data with the specified names
111111
for var in subworkflow.spec.io_specification.data_outputs:
112112
if var.bpmn_id not in end.data:

SpiffWorkflow/bpmn/util/task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def _catches_event(task):
4141

4242
class BpmnTaskIterator(TaskIterator):
4343

44-
def __init__(self, task, end_at_spec=None, max_depth=1000, depth_first=True, skip_subpprocesses=False, task_filter=None, **kwargs):
44+
def __init__(self, task, end_at_spec=None, max_depth=1000, depth_first=True, skip_subprocesses=False, task_filter=None, **kwargs):
4545

4646
task_filter = task_filter or BpmnTaskFilter(**kwargs)
4747
super().__init__(task, end_at_spec, max_depth, depth_first, task_filter)
48-
self.skip_subpprocesses = skip_subpprocesses
48+
self.skip_subprocesses = skip_subprocesses
4949

5050
def _next(self):
5151

@@ -64,7 +64,7 @@ def _next(self):
6464
# Do not descend into a completed subprocess to look for unfinished tasks.
6565
if (
6666
subprocess is None
67-
or self.skip_subpprocesses
67+
or self.skip_subprocesses
6868
or (task.state >= TaskState.FINISHED_MASK and self.task_filter.state <= TaskState.FINISHED_MASK)
6969
):
7070
subprocess_tasks = []

SpiffWorkflow/bpmn/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def catch(self, event):
112112
"""
113113
if event.target is not None:
114114
# This limits results to tasks in the specified workflow
115-
tasks = event.target.get_tasks(skip_subpprocesses=True, state=TaskState.NOT_FINISHED_MASK, catches_event=event)
115+
tasks = event.target.get_tasks(skip_subprocesses=True, state=TaskState.NOT_FINISHED_MASK, catches_event=event)
116116
else:
117117
self.update_collaboration(event)
118118
tasks = self.get_tasks(state=TaskState.NOT_FINISHED_MASK, catches_event=event)

0 commit comments

Comments
 (0)