Skip to content

Instantly share code, notes, and snippets.

@danfunk
Last active October 14, 2022 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danfunk/b46fa0e07d58412c1a0f019e2612b087 to your computer and use it in GitHub Desktop.
Save danfunk/b46fa0e07d58412c1a0f019e2612b087 to your computer and use it in GitHub Desktop.

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 the right direction.

Major Changes

Data Objects, Inputs and Outputs

We now support Data Objects, providing powerful tools for controling the scope and access of variables within a workflow. For an overview of how we are looking at Data Objects, please checkout our article "Understanding BPMN Data Objects" which provides an overview of how Data Objects work in SpiffWorkflow. Detailed information is also available in our ReadTheDocs page.

  • explicitly add data associations on reserializing MI tasks by @danfunk in PR
  • add messages to data object exceptions by @essweine in PR

Messages

Communication between running workflow instances is a powerful tool as workflows become more complex. For a detailed overview of this topic, please checkout our article "Understanding BPMN Messages"

  • messages and business rules by @burnettk in PR
  • messages no longer send all keys by @essweine in PR

Service Tasks

Service Tasks are now supported, and offer an easy way for BPMN Developers to make calls to external APIs. Examples for working with this critical new tool will be documented in our ReadTheDocs page.

  • First pass of ServiceTask handling by @jbirddog in PR
  • Service task connector delegate by @jbirddog in PR
  • Store service task response in task data by @jbirddog in PR
  • get description aka name when parsing service tasks by @burnettk in PR
  • Follow up on service task bug fix, quote string literals by @jbirddog in PR
  • Pass task data to service task delegate by @jbirddog in PR

Custom BPMN Editor Support

Still in heavy development is a custom BPMN Editor, which you can find on GitHub This new editor provides the tools that will make creating valid Service Tasks, Data Objects, and Messages possible. Much thanks to the BPMN.js community for this highly extensible diagramming library!

  • Support for Spiff pre/postscript extensions. PR
  • parses out spiffworklow:property tags in bpmn extensions and makes th… by @danfunk in PR

Improved Script Engine

A Script Engine that is overall easier to understand and extend.

  • Feature/improved script engine by @essweine in PR
  • make globals an argument in the script engine by @essweine in PR

Script Task Unit Testing

Added the ability to create, store, and execute assertions against Script Tasks. Allows you to define a Json data structure as input, and an expected Json data structure as output. So you can assert your script is producing exactly the right data.

  • Script Task Unit Test Extensions (Attempt #2) by @danfunk in PR

New spec_type attribute

Given the ability to overload classes, and mix-in properties, it could be difficult to look at a Task Spec's class to determine if it was a User Task or Script Task, etc... All Task Specs now have a spec_type attribute, containing a descriptive string of the type, expect to see "User Task", "Script Task", "Start Event" etc...

  • add spec type property to task specs with BPMN names by @essweine in PR

Improved Subprocess Handling

  • Allows recursive calls to subprocesses, and improves serialization and execution PR
  • add bpmn spec mixin functionality to subworkflow tasks by @essweine in PR
  • handle all data copying in bpmn subworkflow task by @essweine in PR

Vastly Faster Tests!

  • Profile and improve run time of the test suite by @jbirddog in PR
  • Improve test suite run time, part 2 by @jbirddog in PR
  • ParallelTest.py split by @jbirddog in PR
  • Up some sleep times in tests for CI stability by @jbirddog in PR

Bug Fixes

  • fix loop reset task to handle multiple subprocess properly by @essweine in PR
  • Bugfix/separate subprocess dict for serializer by @danfunk in PR
  • Update make tests to run tests per the README, remove unused test runners by @jbirddog in PR
  • Bug/service task variable by @jbirddog in PR
  • Fix for failures with Python 3.7 by @jbirddog in PR

Code Cleanup and Documentation Changes

  • Support custom JSON encoder/decoder in BpmnWorkflowSerializer by @soby in PR
  • Add Python 3.10 to CI by @jbirddog in PR
  • list dependencies by @danfunk in PR
  • Feature/centralized logging by @essweine in PR
  • [FIX] Use self.spec_class instead of direct use of base object by @Giulios74 in PR
  • add more documentation about serializer migration by @essweine in PR
  • docs: Fix a few typos by @timgates42 in PR
  • Fix a few docstring typos in the tests by @jbirddog in PR
  • Remove unused imports by @jbirddog in PR
  • Reorganized parser PR
  • fix for a serialization bug by @danfunk in PR
  • fix serialization bug by @essweine in PR
  • Don't use bpmn exception from core spec by @jbirddog in PR
  • added task name to the spiff logs by @burnettk in PR
  • Remove navigation.py, tests and related bpmn files by @jbirddog in PR
  • Remove bpmn imports from task.py by @jbirddog in PR
  • Remove bpmn references from dict.py and json.py by @jbirddog in PR
  • Remove some lingering bpmn imports by @jbirddog in PR
  • Empty SpiffWorkflow/init.py by @jbirddog in PR
  • Various fixes as I attempted to get our CR-Connect application working against the lastest SpiffWorkflow build by @danfunk in PR

Minor Breaking Changes and their Fixes

This Minor Release includes a few minor breaking changes that should be easy to correct. Please apply these fixes as appropriate

  1. Top Level Imports moved to appropriate modules
REPLACE 'from SpiffWorkflow import WorkflowException'
WITH 'from SpiffWorkflow.exceptions import WorkflowException'
REPLACE 'from SpiffWorkflow import TaskState'
WITH:  'from SpiffWorkflow.task import TaskState'
REPLACE:  'from SpiffWorkflow import Task'
WITH  'from SpiffWorkflow.task import Task'
  1. Navigation code was removed
    • Proved to be of little use to folks, was super complex and difficult to maintain.
    • If you depended on this code, you can take the original code and embed it in your project.
  2. remove all references of timeit (no longer in SpiffWorkflow)
    • Same as above, this stand alone code can be added to your code if needed.
  3. pythonScriptEngine._evaluate no longer accepts a task argument. If you were overwriding this method for some reason, please change your method signature
  4. CancelEventDefinition was removed - please use SignalEventDefinition instead
REPLACE: bpmn_workflow.signal('cancel')  # generate a cancel signal.
         bpmn_workflow.catch(CancelEventDefinition())
WITH: bpmn_workflow.catch(SignalEventDefinition('cancel'))
  1. Task States are JUST integers and TaskSpecNames is now a public dictionary, and can be used to covert a state to human readable string
REPLACE:  user_task.state.name
WITH: TaskStateNames[user_task.state]

Other Notes

  1. When inserting custom functions into the PythonExecutionEngine - be aware that the task data will act as the full context for execution, and will contain global functions and methods during the exec call.

New Contributors

  • @Giulios74 made their first contribution in PR
  • @jbirddog made their first contribution in PR
  • @burnettk made their first contribution in PR

Full Changelog: PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment