Skip to content

Commit c1150c6

Browse files
committed
simplify subprocess state changes
1 parent 25dafe9 commit c1150c6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ def _on_subworkflow_completed(self, subworkflow, my_task):
4747
# could be used to run post-completed actions automatically.
4848
# However, until I align the events with state transitions, I don't want to encourage external use of
4949
# callback methods (though completed event is not going to change).
50-
if my_task.state is TaskState.COMPLETED:
51-
my_task._set_state(TaskState.READY)
50+
my_task._set_state(TaskState.READY)
5251

5352
def _update_hook(self, my_task):
5453
subprocess = my_task.workflow.top_workflow.subprocesses.get(my_task.id)
5554
if subprocess is None:
5655
super()._update_hook(my_task)
57-
self.create_workflow(my_task)
5856
self.start_workflow(my_task)
5957
my_task._set_state(TaskState.STARTED)
6058
else:
@@ -72,16 +70,12 @@ def copy_data(self, my_task, subworkflow):
7270
def update_data(self, my_task, subworkflow):
7371
my_task.data = deepcopy(subworkflow.last_task.data)
7472

75-
def create_workflow(self, my_task):
73+
def start_workflow(self, my_task):
7674
subworkflow = my_task.workflow.top_workflow.create_subprocess(my_task, self.spec)
7775
subworkflow.completed_event.connect(self._on_subworkflow_completed, my_task)
78-
79-
def start_workflow(self, my_task):
80-
subworkflow = my_task.workflow.top_workflow.get_subprocess(my_task)
8176
self.copy_data(my_task, subworkflow)
8277
start = subworkflow.get_next_task(spec_name='Start')
8378
start.run()
84-
my_task._set_state(TaskState.WAITING)
8579

8680

8781
class CallActivity(SubWorkflowTask):

0 commit comments

Comments
 (0)