From e63ad66d7bdff69eba05a58915e4a257d041ba75 Mon Sep 17 00:00:00 2001
From: chausman <chausman@nrao.edu>
Date: Fri, 16 Oct 2020 16:21:58 -0600
Subject: [PATCH] misc. clean up

---
 shared/workspaces/src/workspaces/services.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/shared/workspaces/src/workspaces/services.py b/shared/workspaces/src/workspaces/services.py
index db605f51e..549871b60 100644
--- a/shared/workspaces/src/workspaces/services.py
+++ b/shared/workspaces/src/workspaces/services.py
@@ -337,15 +337,10 @@ class CapabilityEngine(CapabilityEngineIF):
         cur_step = step_sequence[int(self.execution.current_step)]
         workflow_name = cur_step.step_value
         workflow_args = cur_step.step_args
-        workflow_request = WorkflowRequest(
-            workflow_name=workflow_name,
-            argument=workflow_args,
-            state=WorkflowRequestState.Created,
-            execution_id=self.execution_id,
-        )
         # FIXME: Add support for files
         files = []
 
+        workflow_request = self.workflow_service.info.create_workflow_request(workflow_name, workflow_args)
         self.workflow_service.execute(workflow_request, files)
 
     def is_complete(self):
@@ -481,7 +476,7 @@ class WorkflowService(WorkflowServiceIF):
 
         # Start listening for events from the wf_monitor stream
         self.listener = threading.Thread(
-            target=lambda: workflow_events.listen(self.on_workflow_event)
+            target=lambda: workflow_events.listen(self.on_workflow_event, threaded=True)
         )
         self.listener.start()
 
@@ -521,7 +516,7 @@ class WorkflowService(WorkflowServiceIF):
         """
         # 1. create a temporary directory
         # TODO: decide where to put temp directory and make capo property
-        temp_folder = Path(mkdtemp(dir=str(Path.home())))
+        temp_folder = Path(mkdtemp(dir=str(Path.home())+"/workspaces_tmp"))
 
         # 2. spool each of the temp files to it
         for file in files:
@@ -623,7 +618,6 @@ class WorkflowInfo(WorkflowInfoIF):
         Create new workflow request and save to database
         :param workflow: workflow to run
         :param argument: workflow arguments
-        :param execution_id: execution id of parent capability execution (optional for now)
         :return: new WorkflowRequest
         """
         request = WorkflowRequest(
@@ -632,6 +626,7 @@ class WorkflowInfo(WorkflowInfoIF):
             state=WorkflowRequestState.Created.name,
         )
         self.save_request(request)
+        print(f"Created Workflow Request {request}")
         return request
 
     def save_request(self, request: WorkflowRequest):
-- 
GitLab