most lints and checks are passing and cleaned up some debug code

This commit is contained in:
jasquat 2022-08-23 09:30:34 -04:00
parent cbab371fd3
commit 4cc2601210
6 changed files with 29 additions and 32 deletions

View File

@ -84,7 +84,7 @@ def create_app() -> flask.app.Flask:
app.json_encoder = MyJSONEncoder
# if app.config["PROCESS_WAITING_MESSAGES"]:
# start_scheduler(app)
if app.config["PROCESS_WAITING_MESSAGES"]:
start_scheduler(app)
return app # type: ignore

View File

@ -37,7 +37,6 @@ from spiffworkflow_backend.models.process_instance_report import (
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.process_model import ProcessModelInfoSchema
from spiffworkflow_backend.services.error_handling_service import ErrorHandlingService
from spiffworkflow_backend.services.message_service import MessageService
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)

View File

@ -1,9 +1,9 @@
"""Message_service."""
from typing import Any
from typing import Optional
import flask
from flask_bpmn.models.db import db
from SpiffWorkflow.bpmn.specs.events.event_definitions import MessageEventDefinition # type: ignore
from sqlalchemy import and_
from sqlalchemy import or_
from sqlalchemy import select
@ -194,7 +194,7 @@ class MessageService:
or_(*message_correlation_filter),
)
)
.join(MessageCorrelationMessageInstanceModel)
.join(MessageCorrelationMessageInstanceModel) # type: ignore
.filter_by(
message_instance_id=message_instance_receive.id,
)
@ -216,7 +216,7 @@ class MessageService:
def get_process_instance_for_message_instance(
self, message_instance: MessageInstanceModel
) -> ProcessInstanceModel:
) -> Any:
"""Get_process_instance_for_message_instance."""
process_instance = ProcessInstanceModel.query.filter_by(
id=message_instance.process_instance_id

View File

@ -4,6 +4,7 @@ import time
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
from flask import current_app
@ -28,7 +29,7 @@ from SpiffWorkflow.dmn.serializer import BusinessRuleTaskConverter # type: igno
from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore
from SpiffWorkflow.specs import WorkflowSpec # type: ignore
from SpiffWorkflow.spiff.parser.process import SpiffBpmnParser # type: ignore
from SpiffWorkflow.spiff.serializer import BoundaryEventConverter
from SpiffWorkflow.spiff.serializer import BoundaryEventConverter # type: ignore
from SpiffWorkflow.spiff.serializer import CallActivityTaskConverter
from SpiffWorkflow.spiff.serializer import EndEventConverter
from SpiffWorkflow.spiff.serializer import IntermediateCatchEventConverter
@ -80,22 +81,22 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
"""Evaluate."""
return self._evaluate(expression, task.data, task)
# def _evaluate(
# self,
# expression: str,
# context: Dict[str, Union[Box, str]],
# task: Optional[SpiffTask] = None,
# _external_methods: None = None,
# ) -> Any:
# """Evaluate the given expression, within the context of the given task and return the result."""
# try:
# return super()._evaluate(expression, context, task, {})
# except Exception as exception:
# raise WorkflowTaskExecException(
# task,
# "Error evaluating expression "
# "'%s', %s" % (expression, str(exception)),
# ) from exception
def _evaluate(
self,
expression: str,
context: Dict[str, Union[Box, str]],
task: Optional[SpiffTask] = None,
_external_methods: None = None,
) -> Any:
"""Evaluate the given expression, within the context of the given task and return the result."""
try:
return super()._evaluate(expression, context, task, {})
except Exception as exception:
raise WorkflowTaskExecException(
task,
"Error evaluating expression "
"'%s', %s" % (expression, str(exception)),
) from exception
def execute(
self, task: SpiffTask, script: str, data: Dict[str, Dict[str, str]]
@ -527,7 +528,8 @@ class ProcessInstanceProcessor:
if message_correlation_property is None:
raise ApiError(
"message_correlations_missing_from_process",
f"Could not find a known message correlation with identifier: {message_correlation_property_identifier}",
"Could not find a known message correlation with identifier:"
f"{message_correlation_property_identifier}",
)
message_correlations.append(
{

View File

@ -297,7 +297,8 @@ class SpecFileService(FileSystemService):
!= process_model_info.process_group_id
):
raise ValidationException(
f"Message model is already used to start process model '{process_model_info.process_group_id}/{process_model_info.id}'"
"Message model is already used to start process model"
f"'{process_model_info.process_group_id}/{process_model_info.id}'"
)
for child in et_root:
@ -328,7 +329,7 @@ class SpecFileService(FileSystemService):
if message_model is None:
raise ValidationException(
f"Could not find message model with identifier '{message_model_identifier}'"
f"specified by message event definition: {message_event_definition}"
f"specified by correlation property: {cpre}"
)
message_correlation_property = (

View File

@ -1,12 +1,6 @@
"""Test_message_service."""
from flask import Flask
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel
from spiffworkflow_backend.models.message_instance import MessageInstanceModel
from spiffworkflow_backend.models.message_model import MessageModel
class TestSpecFileService(BaseTest):
@ -15,4 +9,5 @@ class TestSpecFileService(BaseTest):
def test_can_check_for_messages_in_bpmn_xml(
self, app: Flask, with_db_and_bpmn_file_cleanup: None
) -> None:
"""Test_can_check_for_messages_in_bpmn_xml."""
assert True