From 1cb779015fb99437673d64ff3bb7c96ca6330738 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 12 Oct 2022 14:19:51 -0400 Subject: [PATCH] run the save all bpmn script on server boot w/ burnettk --- bin/boot_server_in_docker | 2 ++ bin/run_server_locally | 1 + bin/save_all_bpmn.py | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/boot_server_in_docker b/bin/boot_server_in_docker index 23aab408..806839c0 100755 --- a/bin/boot_server_in_docker +++ b/bin/boot_server_in_docker @@ -38,6 +38,8 @@ if [[ "${SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA:-}" == "true" ]]; then workers=1 fi +SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false poetry run python bin/save_all_bpmn.py + export IS_GUNICORN="true" export PROCESS_WAITING_MESSAGES="true" diff --git a/bin/run_server_locally b/bin/run_server_locally index 45cbfbed..087e5033 100755 --- a/bin/run_server_locally +++ b/bin/run_server_locally @@ -32,5 +32,6 @@ else export PROCESS_WAITING_MESSAGES="true" fi export FLASK_DEBUG=1 + SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false poetry run python bin/save_all_bpmn.py FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000 fi diff --git a/bin/save_all_bpmn.py b/bin/save_all_bpmn.py index 89dbdbbc..97f2908e 100644 --- a/bin/save_all_bpmn.py +++ b/bin/save_all_bpmn.py @@ -1,4 +1,5 @@ """Grabs tickets from csv and makes process instances.""" +import os from spiffworkflow_backend import get_hacked_up_app_for_script from spiffworkflow_backend.services.data_setup_service import DataSetupService @@ -10,7 +11,7 @@ def main() -> None: failing_process_models = DataSetupService.save_all() for bpmn_errors in failing_process_models: print(bpmn_errors) - if len(failing_process_models) > 0: + if os.environ.get('SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS') != "false" and len(failing_process_models) > 0: exit(1)