From c193d27238b71e0e7596190c0e71382f7549938c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Pru=C3=9F?= Date: Mon, 27 Jan 2025 14:45:34 +0100 Subject: [PATCH 1/4] Rename the directory with the model definitions Rename the 'bpmn' directory into 'models' to i) prevent confusion with the identically named directory in the SpiffWorkflow library and ii) because it also contains DMN definitions. Only track changes in the 'camunda'- and 'tutorial'-subdirectory to allow the user to add their own workflows. --- .gitignore | 6 ++++++ {bpmn => models}/camunda/call_activity.bpmn | 0 {bpmn => models}/camunda/call_activity_multi.bpmn | 0 {bpmn => models}/camunda/call_activity_script.bpmn | 0 {bpmn => models}/camunda/events.bpmn | 0 {bpmn => models}/camunda/multiinstance.bpmn | 0 {bpmn => models}/camunda/product_prices.dmn | 0 {bpmn => models}/camunda/shipping_costs.dmn | 0 {bpmn => models}/camunda/task_types.bpmn | 0 {bpmn => models}/camunda/top_level_script.bpmn | 0 {bpmn => models}/tutorial/call_activity.bpmn | 0 {bpmn => models}/tutorial/call_activity_multi.bpmn | 0 {bpmn => models}/tutorial/call_activity_script.bpmn | 0 {bpmn => models}/tutorial/call_activity_service_task.bpmn | 0 {bpmn => models}/tutorial/dangerous.bpmn | 0 {bpmn => models}/tutorial/data_output.bpmn | 0 {bpmn => models}/tutorial/event_handler.bpmn | 0 {bpmn => models}/tutorial/events.bpmn | 0 {bpmn => models}/tutorial/forms/ask_for_feedback.json | 0 {bpmn => models}/tutorial/forms/charge_customer.json | 0 {bpmn => models}/tutorial/forms/continue_shopping.json | 0 {bpmn => models}/tutorial/forms/dangerous.json | 0 {bpmn => models}/tutorial/forms/enter_payment_info.json | 0 {bpmn => models}/tutorial/forms/enter_shipping_address.json | 0 {bpmn => models}/tutorial/forms/get_filename.json | 0 {bpmn => models}/tutorial/forms/investigate_delay.json | 0 {bpmn => models}/tutorial/forms/resolve_failed_charge.json | 0 {bpmn => models}/tutorial/forms/retrieve_product.json | 0 {bpmn => models}/tutorial/forms/review_order.json | 0 .../tutorial/forms/select_product_and_quantity.json | 0 {bpmn => models}/tutorial/forms/select_product_color.json | 0 {bpmn => models}/tutorial/forms/select_product_size.json | 0 {bpmn => models}/tutorial/forms/select_product_style.json | 0 {bpmn => models}/tutorial/forms/select_shipping_method.json | 0 {bpmn => models}/tutorial/forms/ship_product.json | 0 {bpmn => models}/tutorial/gateway_types.bpmn | 0 {bpmn => models}/tutorial/lanes.bpmn | 0 {bpmn => models}/tutorial/product_prices.dmn | 0 {bpmn => models}/tutorial/shipping_costs.dmn | 0 {bpmn => models}/tutorial/signal_event.bpmn | 0 {bpmn => models}/tutorial/task_types.bpmn | 0 {bpmn => models}/tutorial/threaded_service_task.bpmn | 0 {bpmn => models}/tutorial/timer_start.bpmn | 0 {bpmn => models}/tutorial/top_level.bpmn | 0 {bpmn => models}/tutorial/top_level_multi.bpmn | 0 {bpmn => models}/tutorial/top_level_script.bpmn | 0 {bpmn => models}/tutorial/top_level_service_task.bpmn | 0 {bpmn => models}/tutorial/transaction.bpmn | 0 spiff_example/spiff/curses_handlers.py | 2 +- 49 files changed, 7 insertions(+), 1 deletion(-) rename {bpmn => models}/camunda/call_activity.bpmn (100%) rename {bpmn => models}/camunda/call_activity_multi.bpmn (100%) rename {bpmn => models}/camunda/call_activity_script.bpmn (100%) rename {bpmn => models}/camunda/events.bpmn (100%) rename {bpmn => models}/camunda/multiinstance.bpmn (100%) rename {bpmn => models}/camunda/product_prices.dmn (100%) rename {bpmn => models}/camunda/shipping_costs.dmn (100%) rename {bpmn => models}/camunda/task_types.bpmn (100%) rename {bpmn => models}/camunda/top_level_script.bpmn (100%) rename {bpmn => models}/tutorial/call_activity.bpmn (100%) rename {bpmn => models}/tutorial/call_activity_multi.bpmn (100%) rename {bpmn => models}/tutorial/call_activity_script.bpmn (100%) rename {bpmn => models}/tutorial/call_activity_service_task.bpmn (100%) rename {bpmn => models}/tutorial/dangerous.bpmn (100%) rename {bpmn => models}/tutorial/data_output.bpmn (100%) rename {bpmn => models}/tutorial/event_handler.bpmn (100%) rename {bpmn => models}/tutorial/events.bpmn (100%) rename {bpmn => models}/tutorial/forms/ask_for_feedback.json (100%) rename {bpmn => models}/tutorial/forms/charge_customer.json (100%) rename {bpmn => models}/tutorial/forms/continue_shopping.json (100%) rename {bpmn => models}/tutorial/forms/dangerous.json (100%) rename {bpmn => models}/tutorial/forms/enter_payment_info.json (100%) rename {bpmn => models}/tutorial/forms/enter_shipping_address.json (100%) rename {bpmn => models}/tutorial/forms/get_filename.json (100%) rename {bpmn => models}/tutorial/forms/investigate_delay.json (100%) rename {bpmn => models}/tutorial/forms/resolve_failed_charge.json (100%) rename {bpmn => models}/tutorial/forms/retrieve_product.json (100%) rename {bpmn => models}/tutorial/forms/review_order.json (100%) rename {bpmn => models}/tutorial/forms/select_product_and_quantity.json (100%) rename {bpmn => models}/tutorial/forms/select_product_color.json (100%) rename {bpmn => models}/tutorial/forms/select_product_size.json (100%) rename {bpmn => models}/tutorial/forms/select_product_style.json (100%) rename {bpmn => models}/tutorial/forms/select_shipping_method.json (100%) rename {bpmn => models}/tutorial/forms/ship_product.json (100%) rename {bpmn => models}/tutorial/gateway_types.bpmn (100%) rename {bpmn => models}/tutorial/lanes.bpmn (100%) rename {bpmn => models}/tutorial/product_prices.dmn (100%) rename {bpmn => models}/tutorial/shipping_costs.dmn (100%) rename {bpmn => models}/tutorial/signal_event.bpmn (100%) rename {bpmn => models}/tutorial/task_types.bpmn (100%) rename {bpmn => models}/tutorial/threaded_service_task.bpmn (100%) rename {bpmn => models}/tutorial/timer_start.bpmn (100%) rename {bpmn => models}/tutorial/top_level.bpmn (100%) rename {bpmn => models}/tutorial/top_level_multi.bpmn (100%) rename {bpmn => models}/tutorial/top_level_script.bpmn (100%) rename {bpmn => models}/tutorial/top_level_service_task.bpmn (100%) rename {bpmn => models}/tutorial/transaction.bpmn (100%) diff --git a/.gitignore b/.gitignore index e0ba762..f7355c9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,9 @@ __pycache__ *.log *.db wfdata + +# Don't track model definitions of the user, but keep the examples that are part of the +# repository. +models/* +!models/camunds +!models/tutorial diff --git a/bpmn/camunda/call_activity.bpmn b/models/camunda/call_activity.bpmn similarity index 100% rename from bpmn/camunda/call_activity.bpmn rename to models/camunda/call_activity.bpmn diff --git a/bpmn/camunda/call_activity_multi.bpmn b/models/camunda/call_activity_multi.bpmn similarity index 100% rename from bpmn/camunda/call_activity_multi.bpmn rename to models/camunda/call_activity_multi.bpmn diff --git a/bpmn/camunda/call_activity_script.bpmn b/models/camunda/call_activity_script.bpmn similarity index 100% rename from bpmn/camunda/call_activity_script.bpmn rename to models/camunda/call_activity_script.bpmn diff --git a/bpmn/camunda/events.bpmn b/models/camunda/events.bpmn similarity index 100% rename from bpmn/camunda/events.bpmn rename to models/camunda/events.bpmn diff --git a/bpmn/camunda/multiinstance.bpmn b/models/camunda/multiinstance.bpmn similarity index 100% rename from bpmn/camunda/multiinstance.bpmn rename to models/camunda/multiinstance.bpmn diff --git a/bpmn/camunda/product_prices.dmn b/models/camunda/product_prices.dmn similarity index 100% rename from bpmn/camunda/product_prices.dmn rename to models/camunda/product_prices.dmn diff --git a/bpmn/camunda/shipping_costs.dmn b/models/camunda/shipping_costs.dmn similarity index 100% rename from bpmn/camunda/shipping_costs.dmn rename to models/camunda/shipping_costs.dmn diff --git a/bpmn/camunda/task_types.bpmn b/models/camunda/task_types.bpmn similarity index 100% rename from bpmn/camunda/task_types.bpmn rename to models/camunda/task_types.bpmn diff --git a/bpmn/camunda/top_level_script.bpmn b/models/camunda/top_level_script.bpmn similarity index 100% rename from bpmn/camunda/top_level_script.bpmn rename to models/camunda/top_level_script.bpmn diff --git a/bpmn/tutorial/call_activity.bpmn b/models/tutorial/call_activity.bpmn similarity index 100% rename from bpmn/tutorial/call_activity.bpmn rename to models/tutorial/call_activity.bpmn diff --git a/bpmn/tutorial/call_activity_multi.bpmn b/models/tutorial/call_activity_multi.bpmn similarity index 100% rename from bpmn/tutorial/call_activity_multi.bpmn rename to models/tutorial/call_activity_multi.bpmn diff --git a/bpmn/tutorial/call_activity_script.bpmn b/models/tutorial/call_activity_script.bpmn similarity index 100% rename from bpmn/tutorial/call_activity_script.bpmn rename to models/tutorial/call_activity_script.bpmn diff --git a/bpmn/tutorial/call_activity_service_task.bpmn b/models/tutorial/call_activity_service_task.bpmn similarity index 100% rename from bpmn/tutorial/call_activity_service_task.bpmn rename to models/tutorial/call_activity_service_task.bpmn diff --git a/bpmn/tutorial/dangerous.bpmn b/models/tutorial/dangerous.bpmn similarity index 100% rename from bpmn/tutorial/dangerous.bpmn rename to models/tutorial/dangerous.bpmn diff --git a/bpmn/tutorial/data_output.bpmn b/models/tutorial/data_output.bpmn similarity index 100% rename from bpmn/tutorial/data_output.bpmn rename to models/tutorial/data_output.bpmn diff --git a/bpmn/tutorial/event_handler.bpmn b/models/tutorial/event_handler.bpmn similarity index 100% rename from bpmn/tutorial/event_handler.bpmn rename to models/tutorial/event_handler.bpmn diff --git a/bpmn/tutorial/events.bpmn b/models/tutorial/events.bpmn similarity index 100% rename from bpmn/tutorial/events.bpmn rename to models/tutorial/events.bpmn diff --git a/bpmn/tutorial/forms/ask_for_feedback.json b/models/tutorial/forms/ask_for_feedback.json similarity index 100% rename from bpmn/tutorial/forms/ask_for_feedback.json rename to models/tutorial/forms/ask_for_feedback.json diff --git a/bpmn/tutorial/forms/charge_customer.json b/models/tutorial/forms/charge_customer.json similarity index 100% rename from bpmn/tutorial/forms/charge_customer.json rename to models/tutorial/forms/charge_customer.json diff --git a/bpmn/tutorial/forms/continue_shopping.json b/models/tutorial/forms/continue_shopping.json similarity index 100% rename from bpmn/tutorial/forms/continue_shopping.json rename to models/tutorial/forms/continue_shopping.json diff --git a/bpmn/tutorial/forms/dangerous.json b/models/tutorial/forms/dangerous.json similarity index 100% rename from bpmn/tutorial/forms/dangerous.json rename to models/tutorial/forms/dangerous.json diff --git a/bpmn/tutorial/forms/enter_payment_info.json b/models/tutorial/forms/enter_payment_info.json similarity index 100% rename from bpmn/tutorial/forms/enter_payment_info.json rename to models/tutorial/forms/enter_payment_info.json diff --git a/bpmn/tutorial/forms/enter_shipping_address.json b/models/tutorial/forms/enter_shipping_address.json similarity index 100% rename from bpmn/tutorial/forms/enter_shipping_address.json rename to models/tutorial/forms/enter_shipping_address.json diff --git a/bpmn/tutorial/forms/get_filename.json b/models/tutorial/forms/get_filename.json similarity index 100% rename from bpmn/tutorial/forms/get_filename.json rename to models/tutorial/forms/get_filename.json diff --git a/bpmn/tutorial/forms/investigate_delay.json b/models/tutorial/forms/investigate_delay.json similarity index 100% rename from bpmn/tutorial/forms/investigate_delay.json rename to models/tutorial/forms/investigate_delay.json diff --git a/bpmn/tutorial/forms/resolve_failed_charge.json b/models/tutorial/forms/resolve_failed_charge.json similarity index 100% rename from bpmn/tutorial/forms/resolve_failed_charge.json rename to models/tutorial/forms/resolve_failed_charge.json diff --git a/bpmn/tutorial/forms/retrieve_product.json b/models/tutorial/forms/retrieve_product.json similarity index 100% rename from bpmn/tutorial/forms/retrieve_product.json rename to models/tutorial/forms/retrieve_product.json diff --git a/bpmn/tutorial/forms/review_order.json b/models/tutorial/forms/review_order.json similarity index 100% rename from bpmn/tutorial/forms/review_order.json rename to models/tutorial/forms/review_order.json diff --git a/bpmn/tutorial/forms/select_product_and_quantity.json b/models/tutorial/forms/select_product_and_quantity.json similarity index 100% rename from bpmn/tutorial/forms/select_product_and_quantity.json rename to models/tutorial/forms/select_product_and_quantity.json diff --git a/bpmn/tutorial/forms/select_product_color.json b/models/tutorial/forms/select_product_color.json similarity index 100% rename from bpmn/tutorial/forms/select_product_color.json rename to models/tutorial/forms/select_product_color.json diff --git a/bpmn/tutorial/forms/select_product_size.json b/models/tutorial/forms/select_product_size.json similarity index 100% rename from bpmn/tutorial/forms/select_product_size.json rename to models/tutorial/forms/select_product_size.json diff --git a/bpmn/tutorial/forms/select_product_style.json b/models/tutorial/forms/select_product_style.json similarity index 100% rename from bpmn/tutorial/forms/select_product_style.json rename to models/tutorial/forms/select_product_style.json diff --git a/bpmn/tutorial/forms/select_shipping_method.json b/models/tutorial/forms/select_shipping_method.json similarity index 100% rename from bpmn/tutorial/forms/select_shipping_method.json rename to models/tutorial/forms/select_shipping_method.json diff --git a/bpmn/tutorial/forms/ship_product.json b/models/tutorial/forms/ship_product.json similarity index 100% rename from bpmn/tutorial/forms/ship_product.json rename to models/tutorial/forms/ship_product.json diff --git a/bpmn/tutorial/gateway_types.bpmn b/models/tutorial/gateway_types.bpmn similarity index 100% rename from bpmn/tutorial/gateway_types.bpmn rename to models/tutorial/gateway_types.bpmn diff --git a/bpmn/tutorial/lanes.bpmn b/models/tutorial/lanes.bpmn similarity index 100% rename from bpmn/tutorial/lanes.bpmn rename to models/tutorial/lanes.bpmn diff --git a/bpmn/tutorial/product_prices.dmn b/models/tutorial/product_prices.dmn similarity index 100% rename from bpmn/tutorial/product_prices.dmn rename to models/tutorial/product_prices.dmn diff --git a/bpmn/tutorial/shipping_costs.dmn b/models/tutorial/shipping_costs.dmn similarity index 100% rename from bpmn/tutorial/shipping_costs.dmn rename to models/tutorial/shipping_costs.dmn diff --git a/bpmn/tutorial/signal_event.bpmn b/models/tutorial/signal_event.bpmn similarity index 100% rename from bpmn/tutorial/signal_event.bpmn rename to models/tutorial/signal_event.bpmn diff --git a/bpmn/tutorial/task_types.bpmn b/models/tutorial/task_types.bpmn similarity index 100% rename from bpmn/tutorial/task_types.bpmn rename to models/tutorial/task_types.bpmn diff --git a/bpmn/tutorial/threaded_service_task.bpmn b/models/tutorial/threaded_service_task.bpmn similarity index 100% rename from bpmn/tutorial/threaded_service_task.bpmn rename to models/tutorial/threaded_service_task.bpmn diff --git a/bpmn/tutorial/timer_start.bpmn b/models/tutorial/timer_start.bpmn similarity index 100% rename from bpmn/tutorial/timer_start.bpmn rename to models/tutorial/timer_start.bpmn diff --git a/bpmn/tutorial/top_level.bpmn b/models/tutorial/top_level.bpmn similarity index 100% rename from bpmn/tutorial/top_level.bpmn rename to models/tutorial/top_level.bpmn diff --git a/bpmn/tutorial/top_level_multi.bpmn b/models/tutorial/top_level_multi.bpmn similarity index 100% rename from bpmn/tutorial/top_level_multi.bpmn rename to models/tutorial/top_level_multi.bpmn diff --git a/bpmn/tutorial/top_level_script.bpmn b/models/tutorial/top_level_script.bpmn similarity index 100% rename from bpmn/tutorial/top_level_script.bpmn rename to models/tutorial/top_level_script.bpmn diff --git a/bpmn/tutorial/top_level_service_task.bpmn b/models/tutorial/top_level_service_task.bpmn similarity index 100% rename from bpmn/tutorial/top_level_service_task.bpmn rename to models/tutorial/top_level_service_task.bpmn diff --git a/bpmn/tutorial/transaction.bpmn b/models/tutorial/transaction.bpmn similarity index 100% rename from bpmn/tutorial/transaction.bpmn rename to models/tutorial/transaction.bpmn diff --git a/spiff_example/spiff/curses_handlers.py b/spiff_example/spiff/curses_handlers.py index 05827e1..1cd4a6c 100644 --- a/spiff_example/spiff/curses_handlers.py +++ b/spiff_example/spiff/curses_handlers.py @@ -6,7 +6,7 @@ from ..curses_ui.user_input import SimpleField, Option, JsonField from ..curses_ui.human_task_handler import TaskHandler -forms_dir = 'bpmn/tutorial/forms' +forms_dir = 'models/tutorial/forms' class SpiffTaskHandler(TaskHandler): From 6d1d35a0c1516ffa394d4ba4a68b9c58d5a729e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Pru=C3=9F?= Date: Tue, 28 Jan 2025 10:29:24 +0100 Subject: [PATCH 2/4] Update readme file to reflect renaming of bpmn --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 1b9ec65..ee491ed 100644 --- a/README.rst +++ b/README.rst @@ -43,9 +43,9 @@ the models and application can be found there. Models ^^^^^^ -Example BPMN and DMN files can be found in the `bpmn` directory of this repository. +Example BPMN and DMN files can be found in the `models` directory of this repository. There are several versions of a product ordering process of variying complexity located in the -`bpmn/tutorial` directory of the repo which contain most of the elements that SpiffWorkflow supports. These +`models/tutorial` directory of the repo which contain most of the elements that SpiffWorkflow supports. These diagrams can be viewed in any BPMN editor, but many of them have custom extensions created with `bpmn-js-spiffworflow `_. @@ -58,8 +58,8 @@ To add a workflow via the command line and store serialized specs in JSON files: ./runner.py -e spiff_example.spiff.file add \ -p order_product \ - -b bpmn/tutorial/{top_level,call_activity}.bpmn \ - -d bpmn/tutorial/{product_prices,shipping_costs}.dmn + -b models/tutorial/{top_level,call_activity}.bpmn \ + -d models/tutorial/{product_prices,shipping_costs}.dmn Running Workflows ^^^^^^^^^^^^^^^^^ From 2f0acc292d5459f6ae814c3d6b2c34f01c358e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Pru=C3=9F?= Date: Mon, 27 Jan 2025 10:23:16 +0100 Subject: [PATCH 3/4] Drop the option to run the CLI example in docker The docker option does not increase the user experience with the CLI example considerably, but adds to the amount of maintenance required (see issue #32). --- Dockerfile | 11 ----------- README.rst | 7 ------- bin/run_in_docker | 11 ----------- 3 files changed, 29 deletions(-) delete mode 100644 Dockerfile delete mode 100755 bin/run_in_docker diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a95e688..0000000 --- a/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.11-slim-bookworm - -RUN apt-get update && apt-get install -y git sqlite3 - -WORKDIR /app -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -ADD . . - -ENTRYPOINT [ "./runner.py -e spiff_example.spiff.file" ] diff --git a/README.rst b/README.rst index ee491ed..86bb4f1 100644 --- a/README.rst +++ b/README.rst @@ -72,12 +72,5 @@ To run the curses application using serialized JSON files: Select the 'Start Workflow' screen and start the process. -Run in docker -^^^^^^^^^^^^^ - -.. code:: bash - - ./bin/run_in_docker --help - ## License GNU LESSER GENERAL PUBLIC LICENSE diff --git a/bin/run_in_docker b/bin/run_in_docker deleted file mode 100755 index 648f79a..0000000 --- a/bin/run_in_docker +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -function error_handler() { - >&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}." - exit "$2" -} -trap 'error_handler ${LINENO} $?' ERR -set -o errtrace -o errexit -o nounset -o pipefail - -docker build . -t spiff_example_cli -docker run -it --rm spiff_example_cli "$@" From d3c29a0239347240de8aa93f5127f2079c9f8247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Pru=C3=9F?= Date: Mon, 27 Jan 2025 11:17:29 +0100 Subject: [PATCH 4/4] Fix model timer_start.bpmn The timer duration PT1D caused an invalid timer duration exception and there were two start event tasks with the same ID present in the file. Opened the file with the SpiffWorkflow editor and changed the duration to P1D. The duplicated start event was automatically removed by the editor. --- models/tutorial/timer_start.bpmn | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/models/tutorial/timer_start.bpmn b/models/tutorial/timer_start.bpmn index f0fe903..9503137 100644 --- a/models/tutorial/timer_start.bpmn +++ b/models/tutorial/timer_start.bpmn @@ -17,16 +17,10 @@ Flow_032rj36 - "PT1D" + "P1D" - - Flow_0exxc43 - - "PT1D" - -