Skip to content

Instantly share code, notes, and snippets.

View danfunk's full-sized avatar

Dan Funk danfunk

View GitHub Profile
version: "3.8"
services:
spiffworkflow-db:
container_name: spiffworkflow-db
image: mysql:8.0.29
platform: linux/amd64
cap_add:
- SYS_NICE
restart: "no"
environment:

Version 1.2

This Version of SpiffWorkflow adds support for Data Objects, Messages, and Service Tasks, powerful new tools from the BPMN standard. It is our first step towards offering support for a customized BPMN Editor that is still under development, but available on GitHub and perfectly serviceable. Please try it out!

In addition to some major new features, we've improved some existing core features. The Python Expression Engine is now easier to extend and modify for custom deployments, and SubProcesses have a far stronger and more consistent logical representation and are easier to control. We've also added the ability to unit test your script tasks - to make it much easier to write small python scripts to re-structure your data.

Finally, we undertook hours of effort to clean up the code base, so that imports are consistent, circular dependencies are removed, and code smells are eliminated. It is by no means perfect, but we are arcing in t

<bpmn:sendTask id="send_task_letter" name="Send romantic words" messageRef="love_letter">
<bpmn:extension>
<spiffworkflow:messagePayload>
{
'to': {'name': my_lover_var},
'from': {'name': 'buddy'},
'salutation': 'Dear Beloved',
'body': 'Oh how my heart yearns for you!'
}
</spiffworkflow:messagePayload>
<bpmn:collaboration id="my_collaboration">
<bpmn:participant id="buddy" name="Buddy" processRef="process_buddy" />
<bpmn:participant id="Person" name="Person"
processRef="random_person_process" />
<bpmn:messageFlow id="love_letter_flow" name="Love Letter Flow"
sourceRef="ActivitySendLetter" targetRef="Event_0ym6ptw" />
<bpmn:messageFlow id="response_flow" name="response flow"
sourceRef="Activity_13eq2gr" targetRef="EventReceiveLetter" />
<bpmn:correlationKey name="lover">
<bpmn:correlationPropertyRef>Lover_first_name</bpmn:correlationPropertyRef>
<bpmn:message id="love_letter" name="Love Letter"/>
<bpmn:message id="love_letter_response" name="Love Letter Response" />
<bpmn:correlationProperty id="lover_name" name="Lover's Name">
<bpmn:correlationPropertyRetrievalExpression messageRef="love_letter">
<bpmn:formalExpression>lover.name</bpmn:formalExpression>
</bpmn:correlationPropertyRetrievalExpression>
<bpmn:correlationPropertyRetrievalExpression messageRef="love_letter_response">
<bpmn:formalExpression>from.name</bpmn:formalExpression>
</bpmn:correlationPropertyRetrievalExpression>
</bpmn:correlationProperty>
import ast
import logging
from RestrictedPython import safe_globals, compile_restricted
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine
from SpiffWorkflow.bpmn.specs.ScriptTask import ScriptTask
from SpiffWorkflow.exceptions import WorkflowTaskExecException
logger = logging.getLogger(__name__)
git clone https://github.com/sartography/SpiffyDuck.git
cd SpiffyDuck
python3 -m venv venv
source ./venv/bin/activate
pip3 install spiffworkflow
python ducks.py
<bpmn:scriptTask id="Activity_1jz3ih0" name="Determine Duck Worthiness">
<bpmn:incoming>Flow_2</bpmn:incoming>
<bpmn:outgoing>Flow_1olpa6l</bpmn:outgoing>
<bpmn:script>
if not tolerant or variety == 'Dead':
is_safe = False
else:
is_safe = True
</bpmn:script>
</bpmn:scriptTask>
if not tolerant or variety == 'dead':
is_safe = False
else:
is_safe = True
def show_form(task):
model = {}
form = task.task_spec.form
if task.data is None:
task.data = {}
for field in form.fields:
prompt = field.label
if isinstance(field, EnumFormField):