diff --git a/SpiffWorkflow/SpiffWorkflow/task.py b/SpiffWorkflow/SpiffWorkflow/task.py
index a214eb5b..39eb3fdc 100644
--- a/SpiffWorkflow/SpiffWorkflow/task.py
+++ b/SpiffWorkflow/SpiffWorkflow/task.py
@@ -708,18 +708,22 @@ class Task(object, metaclass=DeprecatedMetaTask):
def _get_internal_data(self, name, default=None):
return self.internal_data.get(name, default)
- def set_data(self, **kwargs):
+ def set_data(self, write_to_log=True, **kwargs):
"""
Defines the given attribute/value pairs.
"""
self.data.update(kwargs)
- data_log.info('Set data', extra=self.log_info())
+
+ if write_to_log:
+ data_log.info('Set data', extra=self.log_info())
def _inherit_data(self):
"""
Inherits the data from the parent.
"""
- self.set_data(**self.parent.data)
+
+ # no need to write to a log when we are just inheriting data
+ self.set_data(**self.parent.data, write_to_log=False)
def get_data(self, name, default=None):
"""
diff --git a/spiffworkflow-backend/bin/run_server_locally b/spiffworkflow-backend/bin/run_server_locally
index 3e9f712b..0fa63d21 100755
--- a/spiffworkflow-backend/bin/run_server_locally
+++ b/spiffworkflow-backend/bin/run_server_locally
@@ -29,7 +29,13 @@ else
export FLASK_DEBUG=1
if [[ "${SPIFFWORKFLOW_BACKEND_RUN_DATA_SETUP:-}" != "false" ]]; then
- SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false poetry run python bin/save_all_bpmn.py
+ RUN_BACKGROUND_SCHEDULER=false SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false poetry run python bin/save_all_bpmn.py
fi
- FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000
+
+ if [[ -z "${RUN_BACKGROUND_SCHEDULER:-}" ]]; then
+ RUN_BACKGROUND_SCHEDULER=true
+ fi
+
+ # this line blocks
+ RUN_BACKGROUND_SCHEDULER="${RUN_BACKGROUND_SCHEDULER}" FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000
fi
diff --git a/spiffworkflow-backend/poetry.lock b/spiffworkflow-backend/poetry.lock
index 2e001a93..2758fe96 100644
--- a/spiffworkflow-backend/poetry.lock
+++ b/spiffworkflow-backend/poetry.lock
@@ -1787,7 +1787,7 @@ lxml = "*"
type = "git"
url = "https://github.com/sartography/SpiffWorkflow"
reference = "main"
-resolved_reference = "be26100bcbef8026e26312c665dae42faf476485"
+resolved_reference = "655e415e1522a8f4eb29c3e8531f74bf826b5ef4"
[[package]]
name = "SQLAlchemy"
diff --git a/spiffworkflow-backend/pyproject.toml b/spiffworkflow-backend/pyproject.toml
index 83a43482..1ec9375a 100644
--- a/spiffworkflow-backend/pyproject.toml
+++ b/spiffworkflow-backend/pyproject.toml
@@ -28,7 +28,7 @@ flask-migrate = "*"
flask-restful = "*"
werkzeug = "*"
SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "main"}
-#SpiffWorkflow = {develop = true, path = "../SpiffWorkflow" }
+# SpiffWorkflow = {develop = true, path = "../SpiffWorkflow" }
sentry-sdk = "^1.10"
sphinx-autoapi = "^2.0"
flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"}
diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py
index f67dccc0..eef7eb18 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py
@@ -125,7 +125,11 @@ def create_app() -> flask.app.Flask:
app.json = MyJSONEncoder(app)
- if app.config["RUN_BACKGROUND_SCHEDULER"]:
+ # do not start the scheduler twice in flask debug mode
+ if (
+ app.config["RUN_BACKGROUND_SCHEDULER"]
+ and os.environ.get("WERKZEUG_RUN_MAIN") != "true"
+ ):
start_scheduler(app)
configure_sentry(app)
diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py
index 39e10cb5..b1ea980c 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py
@@ -10,7 +10,7 @@ SPIFFWORKFLOW_BACKEND_LOG_LEVEL = environ.get(
)
RUN_BACKGROUND_SCHEDULER = (
- environ.get("RUN_BACKGROUND_SCHEDULER", default="true") == "true"
+ environ.get("RUN_BACKGROUND_SCHEDULER", default="false") == "true"
)
GIT_CLONE_URL_FOR_PUBLISHING = environ.get(
"GIT_CLONE_URL", default="https://github.com/sartography/sample-process-models.git"
diff --git a/spiffworkflow-backend/tests/data/call-activity-to-human-task/manual_task.bpmn b/spiffworkflow-backend/tests/data/call-activity-to-human-task/manual_task.bpmn
new file mode 100644
index 00000000..ff9c4000
--- /dev/null
+++ b/spiffworkflow-backend/tests/data/call-activity-to-human-task/manual_task.bpmn
@@ -0,0 +1,42 @@
+
+
+
+
+ Flow_1nxz6rd
+
+
+
+ Flow_1jtitb1
+
+
+
+
+ NOOOOOOOOOOOOOOOOOO!!!!!!!!!!
+
+ Flow_1nxz6rd
+ Flow_1jtitb1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spiffworkflow-backend/tests/data/call-activity-to-human-task/primary_process.bpmn b/spiffworkflow-backend/tests/data/call-activity-to-human-task/primary_process.bpmn
new file mode 100644
index 00000000..8278559b
--- /dev/null
+++ b/spiffworkflow-backend/tests/data/call-activity-to-human-task/primary_process.bpmn
@@ -0,0 +1,39 @@
+
+
+
+
+ Flow_0fdzi5f
+
+
+
+ Flow_0ii0wgu
+
+
+
+ Flow_0fdzi5f
+ Flow_0ii0wgu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_service.py
new file mode 100644
index 00000000..bacde125
--- /dev/null
+++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_service.py
@@ -0,0 +1,46 @@
+"""Test_process_instance_processor."""
+import os
+from flask.app import Flask
+from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel
+from tests.spiffworkflow_backend.helpers.base_test import BaseTest
+from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
+
+from spiffworkflow_backend.models.user import UserModel
+from spiffworkflow_backend.services.process_instance_processor import (
+ ProcessInstanceProcessor,
+)
+
+
+class TestProcessInstanceService(BaseTest):
+ """TestProcessInstanceService."""
+
+ def test_does_not_log_set_data_when_calling_engine_steps_on_waiting_call_activity(
+ self,
+ app: Flask,
+ with_db_and_bpmn_file_cleanup: None,
+ with_super_admin_user: UserModel,
+ ) -> None:
+ """Test_does_not_log_set_data_when_calling_engine_steps_on_waiting_call_activity."""
+ tmp_file = '/tmp/testfile.txt'
+ if os.path.isfile(tmp_file):
+ os.remove(tmp_file)
+ process_model = load_test_spec(
+ process_model_id="test_group/call-activity-to-human-task",
+ process_model_source_directory="call-activity-to-human-task",
+ )
+ process_instance = self.create_process_instance_from_process_model(
+ process_model=process_model, user=with_super_admin_user
+ )
+ processor = ProcessInstanceProcessor(process_instance)
+ processor.do_engine_steps(save=True)
+
+ process_instance_logs = SpiffLoggingModel.query.filter_by(process_instance_id=process_instance.id).all()
+ initial_length = len(process_instance_logs)
+
+ # logs should NOT increase after running this a second time since it's just waiting on a human task
+ print("HEY NOW")
+ with open(tmp_file, 'w') as f:
+ f.write("HEY")
+ processor.do_engine_steps(save=True)
+ process_instance_logs = SpiffLoggingModel.query.filter_by(process_instance_id=process_instance.id).all()
+ assert len(process_instance_logs) == initial_length