run_pyl (part 2)

This commit is contained in:
Dan 2023-02-23 15:09:22 -05:00
parent 8466d823c2
commit 0d468a825a
6 changed files with 889 additions and 1014 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
"""__init__."""
import faulthandler
import sys
import os
import sys
from typing import Any
import connexion # type: ignore

View File

@ -105,7 +105,7 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel):
return False
return True
elif other_message_instance.message_type == MessageTypes.receive.value:
return other_message_instance.correlates(self, expression_engine)
return other_message_instance.correlates(self, expression_engine) # type: ignore
return False

View File

@ -30,7 +30,7 @@ class MessageInstanceCorrelationModel(SpiffworkflowBaseDBModel):
id = db.Column(db.Integer, primary_key=True)
message_instance_id = db.Column(
ForeignKey(MessageInstanceModel.id), nullable=False, index=True
ForeignKey(MessageInstanceModel.id), nullable=False, index=True # type: ignore
)
name: str = db.Column(db.String(50), nullable=False)
expected_value: str = db.Column(db.String(255), nullable=True, index=True)

View File

@ -44,7 +44,7 @@ class MessageService:
available_receive_messages = MessageInstanceModel.query.filter_by(
name=message_instance_send.name, status=MessageStatuses.ready.value
).all()
message_instance_receive = None
message_instance_receive: MessageInstanceModel | None = None
try:
for message_instance in available_receive_messages:
if message_instance.correlates(
@ -84,7 +84,7 @@ class MessageService:
message_instance_send.status = "ready"
db.session.add(message_instance_send)
db.session.commit()
return
return None
# Set the receiving message to running, so it is not altered elswhere ...
message_instance_receive.status = "running"
@ -145,9 +145,11 @@ class MessageService:
message_instance_receive: MessageInstanceModel,
) -> ProcessInstanceModel:
"""Process_message_receive."""
process_instance_receive = ProcessInstanceModel.query.filter_by(
process_instance_receive: ProcessInstanceModel = (
ProcessInstanceModel.query.filter_by(
id=message_instance_receive.process_instance_id
).first()
)
if process_instance_receive is None:
raise MessageServiceError(
(

View File

@ -771,7 +771,7 @@ class ProcessInstanceProcessor:
Rerturns: {process_name: [task_1, task_2, ...], ...}
"""
bpmn_json = json.loads(self.process_instance_model.bpmn_json or '{}')
bpmn_json = json.loads(self.process_instance_model.bpmn_json or "{}")
processes: dict[str, list[str]] = {bpmn_json["spec"]["name"]: []}
for task_name, _task_spec in bpmn_json["spec"]["task_specs"].items():
processes[bpmn_json["spec"]["name"]].append(task_name)
@ -843,7 +843,7 @@ class ProcessInstanceProcessor:
Also note that subprocess_task_id might in fact be a call activity, because spiff treats
call activities like subprocesses in terms of the serialization.
"""
bpmn_json = json.loads(self.process_instance_model.bpmn_json or '{}')
bpmn_json = json.loads(self.process_instance_model.bpmn_json or "{}")
spiff_task_json = self.get_all_task_specs(bpmn_json)
subprocesses_by_child_task_ids = {}
@ -1480,7 +1480,7 @@ class ProcessInstanceProcessor:
spiff_logger = logging.getLogger("spiff")
for handler in spiff_logger.handlers:
if hasattr(handler, "bulk_insert_logs"):
handler.bulk_insert_logs()
handler.bulk_insert_logs() # type: ignore
db.session.commit()
if save: