added an event to use when a process instance is forced to run w/ burnettk (#1277)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-03-26 15:44:41 +00:00 committed by GitHub
parent 0700194db5
commit aa7c2b587b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ from spiffworkflow_backend.models.user import UserModel
# event types take the form [SUBJECT]_[PAST_TENSE_VERB] since subject is not always the same.
class ProcessInstanceEventType(SpiffEnum):
process_instance_error = "process_instance_error"
process_instance_force_run = "process_instance_force_run"
process_instance_resumed = "process_instance_resumed"
process_instance_rewound_to_task = "process_instance_rewound_to_task"
process_instance_suspended = "process_instance_suspended"
@ -40,9 +41,7 @@ class ProcessInstanceEventModel(SpiffworkflowBaseDBModel):
user_id = db.Column(ForeignKey(UserModel.id), nullable=True, index=True) # type: ignore
error_details = relationship(
"ProcessInstanceErrorDetailModel", back_populates="process_instance_event", cascade="delete"
) # type: ignore
error_details = relationship("ProcessInstanceErrorDetailModel", back_populates="process_instance_event", cascade="delete") # type: ignore
@validates("event_type")
def validate_event_type(self, key: str, value: Any) -> Any:

View File

@ -55,6 +55,7 @@ from spiffworkflow_backend.services.process_instance_queue_service import Proces
from spiffworkflow_backend.services.process_instance_queue_service import ProcessInstanceQueueService
from spiffworkflow_backend.services.process_instance_report_service import ProcessInstanceReportService
from spiffworkflow_backend.services.process_instance_service import ProcessInstanceService
from spiffworkflow_backend.services.process_instance_tmp_service import ProcessInstanceTmpService
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.task_service import TaskService
@ -658,6 +659,7 @@ def _process_instance_run(
processor = None
try:
ProcessInstanceTmpService.add_event_to_process_instance(process_instance, "process_instance_force_run")
if not queue_process_instance_if_appropriate(
process_instance, execution_mode=execution_mode
) and not ProcessInstanceQueueService.is_enqueued_to_run_in_the_future(process_instance):