fix lint errors

This commit is contained in:
Elizabeth Esswein 2022-12-20 11:05:46 -05:00
parent fed2062ccf
commit 421a6440c7
2 changed files with 8 additions and 6 deletions

View File

@ -2290,6 +2290,7 @@ def send_bpmn_event(
process_instance_id: str, process_instance_id: str,
body: Dict, body: Dict,
) -> Response: ) -> Response:
"""Send a bpmn event to a workflow"""
process_instance = ProcessInstanceModel.query.filter( process_instance = ProcessInstanceModel.query.filter(
ProcessInstanceModel.id == int(process_instance_id) ProcessInstanceModel.id == int(process_instance_id)
).first() ).first()
@ -2314,6 +2315,7 @@ def mark_task_complete(
task_id: str, task_id: str,
body: Dict, body: Dict,
) -> Response: ) -> Response:
"""Mark a task complete without executing it"""
process_instance = ProcessInstanceModel.query.filter( process_instance = ProcessInstanceModel.query.filter(
ProcessInstanceModel.id == int(process_instance_id) ProcessInstanceModel.id == int(process_instance_id)
).first() ).first()

View File

@ -44,11 +44,9 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import (
CallActivityTaskConverter, CallActivityTaskConverter,
) )
from SpiffWorkflow.spiff.serializer.task_spec_converters import EndEventConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import EndEventConverter
from SpiffWorkflow.spiff.serializer.task_spec_converters import ( from SpiffWorkflow.spiff.serializer.task_spec_converters import EventBasedGatewayConverter
IntermediateCatchEventConverter, from SpiffWorkflow.spiff.serializer.task_spec_converters import IntermediateCatchEventConverter
IntermediateThrowEventConverter, from SpiffWorkflow.spiff.serializer.task_spec_converters import IntermediateThrowEventConverter
EventBasedGatewayConverter,
)
from SpiffWorkflow.spiff.serializer.task_spec_converters import ManualTaskConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import ManualTaskConverter
from SpiffWorkflow.spiff.serializer.task_spec_converters import NoneTaskConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import NoneTaskConverter
from SpiffWorkflow.spiff.serializer.task_spec_converters import ReceiveTaskConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import ReceiveTaskConverter
@ -64,7 +62,6 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import UserTaskConverte
from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from SpiffWorkflow.task import TaskState from SpiffWorkflow.task import TaskState
from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore
from spiffworkflow_backend.models.file import File from spiffworkflow_backend.models.file import File
from spiffworkflow_backend.models.file import FileType from spiffworkflow_backend.models.file import FileType
from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.group import GroupModel
@ -708,11 +705,13 @@ class ProcessInstanceProcessor:
db.session.commit() db.session.commit()
def serialize_task_spec(self, task_spec: SpiffTask) -> Any: def serialize_task_spec(self, task_spec: SpiffTask) -> Any:
"""Get a serialized version of a task spec"""
# The task spec is NOT actually a SpiffTask, it is the task spec attached to a SpiffTask # The task spec is NOT actually a SpiffTask, it is the task spec attached to a SpiffTask
# Not sure why mypy accepts this but whatever. # Not sure why mypy accepts this but whatever.
return self._serializer.spec_converter.convert(task_spec) return self._serializer.spec_converter.convert(task_spec)
def send_bpmn_event(self, event_data: dict[str, Any]) -> None: def send_bpmn_event(self, event_data: dict[str, Any]) -> None:
"""Send an event to the workflow"""
payload = event_data.pop("payload", None) payload = event_data.pop("payload", None)
event_definition = self._event_serializer.restore(event_data) event_definition = self._event_serializer.restore(event_data)
if payload is not None: if payload is not None:
@ -724,6 +723,7 @@ class ProcessInstanceProcessor:
self.do_engine_steps(save=True) self.do_engine_steps(save=True)
def mark_task_complete(self, task_id: str) -> None: def mark_task_complete(self, task_id: str) -> None:
"""Mark the task complete without executing it"""
spiff_task = self.bpmn_process_instance.get_task(UUID(task_id)) spiff_task = self.bpmn_process_instance.get_task(UUID(task_id))
spiff_task._set_state(TaskState.COMPLETED) spiff_task._set_state(TaskState.COMPLETED)
self.bpmn_process_instance.last_task = spiff_task self.bpmn_process_instance.last_task = spiff_task