Skip to content
Snippets Groups Projects
Commit 687b62a1 authored by Charlotte Hausman's avatar Charlotte Hausman Committed by Charlotte Hausman
Browse files

SWS-26: fixed workflow event to capability event conversion

parent b16f4a64
No related branches found
No related tags found
1 merge request!82SWS-26: fixed workflow event to capability event conversion
Pipeline #571 passed
......@@ -158,7 +158,7 @@ class CapabilityInfo(CapabilityInfoIF):
"""
return (
self.session.query(CapabilityExecution)
.filter_by(workflow_request_id=workflow_request_id)
.filter_by(current_workflow_request_id=workflow_request_id)
.one()
)
......
......@@ -81,6 +81,8 @@ class CapabilityService(CapabilityServiceIF):
:param event: Incoming event
"""
capability_event = self.workflow_to_capability_event(event)
# TODO:add capability event sending
# capability_events = Channel(CapabilityEventChannel(), threaded=True)
if not capability_event:
# WorkflowEvent does not need to update the execution
......@@ -89,14 +91,14 @@ class CapabilityService(CapabilityServiceIF):
execution = self.capability_info.lookup_execution(capability_event.execution_id)
step_sequence = CapabilitySequence.from_str(execution.steps)
current_step = step_sequence[execution.current_step]
event_type = CapabilityEventType[capability_event.event_type]
event_type = CapabilityEventType[capability_event.event_type.name]
# Check to make sure event type is correct
if current_step.step_type.value == event_type.value:
# Check if previous step (that just completed) is run workflow step
if (
step_sequence[execution.current_step].step_type
== CapabilityStepType.PrepareAndRunWorkflow.name
== CapabilityStepType.PrepareAndRunWorkflow
):
# Return capability engine to available state
self.queues[execution.capability.name].complete_execution(
......@@ -167,10 +169,10 @@ class CapabilityService(CapabilityServiceIF):
:param event: Workflow event
:return: Capability event translated from given workflow event
"""
if event.type == WorkflowEventType.SUBMITTED.name:
if event.type == WorkflowEventType.SUBMITTED:
# Workflow submitted
event_type = CapabilityEventType.WorkflowReady
elif event.type == WorkflowEventType.TERMINATED.name and event.retval == 0:
elif event.type == WorkflowEventType.TERMINATED and event.retval == 0:
# Workflow completed successfully
event_type = CapabilityEventType.WorkflowComplete
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment