diff --git a/.gitignore b/.gitignore index e0ba762..c1cdaf0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea .vscode +.python-version venv .venv docs/build 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 1b9ec65..bcc7adb 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,12 @@ Set up virtual environment python3 -m venv venv source ./venv/bin/activate +Note: Some libraries included in requirements.txt only work in Python versions up to +and including 3.11. So if you run into troubles installing the required dependencies +(see below), you might want to consider using `pyenv ` +to install an additional version of Python on your system *before* creating the virtual +environment. + Install Requirements -------------------- @@ -72,12 +78,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 "$@" diff --git a/bpmn/tutorial/timer_start.bpmn b/bpmn/tutorial/timer_start.bpmn index f0fe903..9503137 100644 --- a/bpmn/tutorial/timer_start.bpmn +++ b/bpmn/tutorial/timer_start.bpmn @@ -17,16 +17,10 @@ Flow_032rj36 - "PT1D" + "P1D" - - Flow_0exxc43 - - "PT1D" - - diff --git a/spiff_example/misc/event_handler.py b/spiff_example/misc/event_handler.py index cc10575..4974a18 100644 --- a/spiff_example/misc/event_handler.py +++ b/spiff_example/misc/event_handler.py @@ -38,8 +38,12 @@ def _execute(self, my_task): # The param also has a type, but I don't need it params = dict((name, script_engine.evaluate(my_task, p['value'])) for name, p in self.operation_params.items()) try: - result = script_engine.call_service(self.operation_name, params, my_task.data) - my_task.data[self._result_variable(my_task)] = result + result = script_engine.call_service( + my_task, + operation_name=self.operation_name, + operation_params=params + ) + my_task.data[self.result_variable] = result return True except FileNotFoundError as exc: event_definition = ErrorEventDefinition('file_not_found', code='1') @@ -52,7 +56,7 @@ def _execute(self, my_task): class ServiceTaskEnvironment(TaskDataEnvironment): - def call_service(self, operation_name, operation_params, context): + def call_service(self, context, operation_name, operation_params): if operation_name == 'read_file': return open(operation_params['filename']).read() else: diff --git a/spiff_example/misc/threaded_service_task.py b/spiff_example/misc/threaded_service_task.py index 2aa4b51..72857fa 100644 --- a/spiff_example/misc/threaded_service_task.py +++ b/spiff_example/misc/threaded_service_task.py @@ -42,7 +42,11 @@ def _execute(self, my_task): script_engine = my_task.workflow.script_engine params = dict((name, script_engine.evaluate(my_task, p['value'])) for name, p in self.operation_params.items()) try: - future = script_engine.call_service(self.operation_name, params, my_task.data) + future = script_engine.call_service( + my_task, + operation_name=self.operation_name, + operation_params=params + ) script_engine.environment.futures[future] = my_task except Exception as exc: raise WorkflowTaskException('Service Task execution error', task=my_task, exception=exc) @@ -54,7 +58,7 @@ def __init__(self): self.pool = ThreadPoolExecutor(max_workers=10) self.futures = {} - def call_service(self, operation_name, operation_params, context): + def call_service(self, context, operation_name, operation_params): if operation_name == 'wait': seconds = randrange(1, 30) return self.pool.submit(wait, seconds, operation_params['job_id']) @@ -69,7 +73,7 @@ def update_completed_futures(self): for future in finished: task = futures.pop(future) result = future.result() - task.data[task.task_spec._result_variable(task)] = result + task.data[task.task_spec.result_variable] = result task.complete() def run_ready_events(self): diff --git a/spiff_example/spiff/service_task.py b/spiff_example/spiff/service_task.py index fa74b8c..357f013 100644 --- a/spiff_example/spiff/service_task.py +++ b/spiff_example/spiff/service_task.py @@ -48,7 +48,7 @@ def __init__(self): 'datetime': datetime, }) - def call_service(self, operation_name, operation_params, task_data): + def call_service(self, task_data, operation_name, operation_params): if operation_name == 'lookup_product_info': product_info = lookup_product_info(operation_params['product_name']['value']) result = product_info_to_dict(product_info)