From b588de47c9995308d86f1aa3fde12fe5594b4556 Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 5 Oct 2022 12:07:51 -0400 Subject: [PATCH] Revert "garbage related to trimming down process instance logging" This reverts commit 4361a5f8ec515cd466f773ce72d6757bb206ea4e. --- poetry.lock | 13 ++++++---- pyproject.toml | 4 +-- .../routes/process_api_blueprint.py | 18 ++++++------- .../services/process_instance_processor.py | 25 +++++++++---------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0a5b33c5..6aa985e1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1827,22 +1827,25 @@ test = ["pytest"] [[package]] name = "SpiffWorkflow" version = "1.1.7" -description = "A workflow framework and BPMN/DMN Processor" +description = "" category = "main" optional = false python-versions = "*" -develop = true +develop = false [package.dependencies] celery = "*" configparser = "*" dateparser = "*" +importlib-metadata = "<5.0" lxml = "*" pytz = "*" [package.source] -type = "directory" -url = "../SpiffWorkflow" +type = "git" +url = "https://github.com/sartography/SpiffWorkflow" +reference = "main" +resolved_reference = "76947aa98d81826b88b2eefd05ebae4427b00e02" [[package]] name = "SQLAlchemy" @@ -2154,7 +2157,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "5288d4bb2291fc469014bda00cf8da705423a050a20d526a8a089df35c746042" +content-hash = "7a3c07a2eef00685adbf44b6e26b740e20fc52bf85e916b6c171b13d4fcc6dc9" [metadata.files] alabaster = [ diff --git a/pyproject.toml b/pyproject.toml index 0941c1ab..261da3f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,8 @@ flask-migrate = "*" flask-restful = "*" werkzeug = "*" # go back to main once https://github.com/sartography/SpiffWorkflow/pull/241 is merged -# SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "main"} -SpiffWorkflow = {develop = true, path = "/Users/kevin/projects/github/sartography/SpiffWorkflow"} +SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "main"} +# SpiffWorkflow = {develop = true, path = "/Users/kevin/projects/github/sartography/SpiffWorkflow"} # SpiffWorkflow = {develop = true, path = "/home/jason/projects/github/sartography/SpiffWorkflow"} sentry-sdk = "1.9.0" sphinx-autoapi = "^1.8.4" diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index 6c835836..c3a2a24a 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -845,17 +845,17 @@ def process_instance_task_list( process_instance = find_process_instance_by_id_or_raise(process_instance_id) processor = ProcessInstanceProcessor(process_instance) - # spiff_tasks = None - # if all_tasks: - # spiff_tasks = processor.bpmn_process_instance.get_tasks(TaskState.ANY_MASK) - # else: - # spiff_tasks = processor.get_all_user_tasks() + spiff_tasks = None + if all_tasks: + spiff_tasks = processor.bpmn_process_instance.get_tasks(TaskState.ANY_MASK) + else: + spiff_tasks = processor.get_all_user_tasks() tasks = [] - # for spiff_task in spiff_tasks: - # task = ProcessInstanceService.spiff_task_to_api_task(spiff_task) - # task.data = spiff_task.data - # tasks.append(task) + for spiff_task in spiff_tasks: + task = ProcessInstanceService.spiff_task_to_api_task(spiff_task) + task.data = spiff_task.data + tasks.append(task) return make_response(jsonify(tasks), 200) diff --git a/src/spiffworkflow_backend/services/process_instance_processor.py b/src/spiffworkflow_backend/services/process_instance_processor.py index 17ff2aae..c5a4c635 100644 --- a/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/src/spiffworkflow_backend/services/process_instance_processor.py @@ -271,7 +271,6 @@ class ProcessInstanceProcessor: self.add_user_info_to_process_instance(self.bpmn_process_instance) if self.PROCESS_INSTANCE_ID_KEY not in self.bpmn_process_instance.data: - if not process_instance_model.id: db.session.add(process_instance_model) # If the model is new, and has no id, save it, write it into the process_instance model @@ -419,20 +418,20 @@ class ProcessInstanceProcessor: """__get_bpmn_process_instance.""" if process_instance_model.bpmn_json: # turn off logging to avoid duplicated spiff logs - # spiff_logger = logging.getLogger("spiff") - # original_spiff_logger_log_level = spiff_logger.level - # spiff_logger.setLevel(logging.WARNING) + spiff_logger = logging.getLogger("spiff") + original_spiff_logger_log_level = spiff_logger.level + spiff_logger.setLevel(logging.WARNING) - # try: - bpmn_process_instance = ( - ProcessInstanceProcessor._serializer.deserialize_json( - process_instance_model.bpmn_json + try: + bpmn_process_instance = ( + ProcessInstanceProcessor._serializer.deserialize_json( + process_instance_model.bpmn_json + ) ) - ) - # except Exception as err: - # raise (err) - # finally: - # spiff_logger.setLevel(original_spiff_logger_log_level) + except Exception as err: + raise (err) + finally: + spiff_logger.setLevel(original_spiff_logger_log_level) bpmn_process_instance.script_engine = ( ProcessInstanceProcessor._script_engine