Skip to content
Snippets Groups Projects
Commit f0a95218 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

WorkflowInfo/CapabilityInfo: added methods to test persistence

parent fdca1268
No related branches found
No related tags found
No related merge requests found
"""
Services defined by the Workspaces system, to be used by our APIs and client programs.
"""
import shutil
import stat
import threading
import subprocess
......@@ -294,6 +293,19 @@ class CapabilityInfo(CapabilityInfoIF):
.one()
)
def requests_for_capability(self, capability_name: str) -> List[CapabilityRequest]:
"""
Gets all capability requests for a given capability
:param capability_name: Name of capability
:return: List of associated requests
"""
capability = self.lookup_capability(capability_name)
return (
self.session.query(CapabilityRequest)
.filter_by(capability_id=capability.id)
.all()
)
class CapabilityEngine(CapabilityEngineIF):
"""
......@@ -486,7 +498,9 @@ class WorkflowService(WorkflowServiceIF):
log_file = self._execute_prepared(temp_folder)
# 6. start reading log file
monitor = WorkflowMonitor(logfile_path=(log_file), workflow_request_id=request.workflow_request_id)
monitor = WorkflowMonitor(
logfile_path=(log_file), workflow_request_id=request.workflow_request_id
)
# parse events from log
events = monitor.events
with workflow_events:
......@@ -609,6 +623,9 @@ class WorkflowInfo(WorkflowInfoIF):
def all_workflows(self) -> List[Workflow]:
return self.session.query(Workflow).all()
def all_workflow_requests(self) -> List[WorkflowRequest]:
return self.session.query(WorkflowRequest).all()
def create_workflow_request(
self, workflow: Workflow, argument: Dict
) -> WorkflowRequest:
......
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