mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-15 04:34:16 +00:00
35fd8ffc0f
b439f69f2 Merge pull request #296 from sartography/bugfix/subprocess-access-to-data-objects 6d2a2031e update spiff subworkflow tasks too 992c38671 make data objects referenceable within subprocesses 6c8ff5cdf allow subprocesses & call activities to have different data copy policies 2b14f3a48 initialize subprocesses in _update_hook instead of _on_ready_before 791f335d5 Merge pull request #295 from sartography/improvement/remove-camunda-from-base-and-misc-cleanup 28b579beb remove a few unused, duplicative, and debugging methods 8f14d1098 remove some other unused diagrams and tests 408bc6734 rely on top level camunda parser for almost all namespace references 895b2cc9b remove camunda namespace from base bpmn parser 76ecbf7cc Merge pull request #294 from sartography/bugfix/reactivate-boundary-event 82b6c8ad4 hack to ensure timers (and other events) are reset if returned to via loop reset 590903f47 Merge pull request #292 from sartography/feature/multiinstance-refactor 537490043 fix bug & typo f31726db1 raise error on attempting to migrate workflows with MI 44e6d08d8 create spiff multiinstance task 2168c022b create camunda MI that approximates what it used to do 9894cea59 some improvements and bugfixes f857ad5d4 remove some now unused functionality & tests, create a few more tests 6fead9d04 updated serializer & fixes for most tests ec662ecdd add parallel multiinstance bd19b2a8a working sequential multiinstance 2f9c192b6 further cleanup around _update_hook 947792bf6 fix bug in exclusive gateway migration d3d87b28d add io spec to all tasks f1586e275 add support for standard loop tasks git-subtree-dir: SpiffWorkflow git-subtree-split: b439f69f23b547df4de1e8e0c636997f2fd4e33b
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
from copy import deepcopy
|
|
|
|
from SpiffWorkflow.exceptions import SpiffWorkflowException
|
|
from SpiffWorkflow.task import TaskState
|
|
from SpiffWorkflow.bpmn.specs .BpmnSpecMixin import BpmnSpecMixin
|
|
|
|
class SpiffBpmnTask(BpmnSpecMixin):
|
|
|
|
def __init__(self, wf_spec, name, prescript=None, postscript=None, **kwargs):
|
|
|
|
# WHy am I doing this instead of just calling super?
|
|
# Because I need to deal with multiple inheritance and the kwargs nightmare created by our parser design
|
|
BpmnSpecMixin.__init__(self, wf_spec, name, **kwargs)
|
|
self.prescript = prescript
|
|
self.postscript = postscript
|
|
|
|
@property
|
|
def spec_type(self):
|
|
return 'Spiff BPMN Task'
|
|
|
|
def execute_script(self, my_task, script):
|
|
try:
|
|
my_task.workflow.script_engine.execute(my_task, script)
|
|
except Exception as exc:
|
|
my_task._set_state(TaskState.WAITING)
|
|
raise exc
|
|
|
|
def get_payload(self, my_task, script, expr):
|
|
try:
|
|
data = deepcopy(my_task.data)
|
|
my_task.worklflow.script_engine.execute(my_task, script, data)
|
|
return my_task.workflow.script_engine._evaluate(expr, data)
|
|
except Exception as exc:
|
|
my_task._set_state(TaskState.WAITING)
|
|
raise exc
|
|
|
|
def _update_hook(self, my_task):
|
|
super()._update_hook(my_task)
|
|
if self.prescript is not None:
|
|
try:
|
|
self.execute_script(my_task, self.prescript)
|
|
except SpiffWorkflowException as se:
|
|
se.add_note("Error occurred in the Pre-Script")
|
|
raise se
|
|
return True
|
|
|
|
def _on_complete_hook(self, my_task):
|
|
if self.postscript is not None:
|
|
try:
|
|
self.execute_script(my_task, self.postscript)
|
|
except SpiffWorkflowException as se:
|
|
se.add_note("Error occurred in the Post-Script")
|
|
raise se
|
|
super()._on_complete_hook(my_task)
|