From 10f9761632bad3a551f2a53e095982d5629bc7ac Mon Sep 17 00:00:00 2001 From: chausman <chausman@nrao.edu> Date: Fri, 9 Oct 2020 14:28:58 -0600 Subject: [PATCH] workflow rest api work - requests now persist ... sort of ... --- services/workflow/src/workflow/server.py | 4 ++-- shared/workspaces/src/workspaces/schema.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/workflow/src/workflow/server.py b/services/workflow/src/workflow/server.py index 61202d3ed..0815c729f 100644 --- a/services/workflow/src/workflow/server.py +++ b/services/workflow/src/workflow/server.py @@ -59,7 +59,7 @@ class WorkflowRestService: # all we should have to do here is take the WorkflowRequest from the context and # hand it to WorkflowInfo to save it, but we're still conflating # workflows and workflow requests right now - request = self.request.workflows.create_workflow_request( + request = self.request.info.create_workflow_request( workflow_name=self.request.GET.get('name'), argument=self.request.GET.getall('args')) return request @@ -188,7 +188,7 @@ def main(global_config, **settings): config.add_route('workflows', '/workflows') config.add_route('workflow', '/workflows/{name}', factory=lookup_workflow) - config.add_route('create_workflow', '/workflows/create', factory=lookup_workflow) + config.add_route('create_workflow', '/workflows/{name}/create', factory=lookup_workflow) config.add_route('submit_workflow', '/workflows/{name}/submit', factory=lookup_workflow) config.add_route('workflow_files', '/workflows/{name}/files', factory=lookup_workflow) config.add_route('workflow_file', '/workflows/{name}/files/{filename}', factory=lookup_file) diff --git a/shared/workspaces/src/workspaces/schema.py b/shared/workspaces/src/workspaces/schema.py index 2d1f8e351..587bac84d 100644 --- a/shared/workspaces/src/workspaces/schema.py +++ b/shared/workspaces/src/workspaces/schema.py @@ -443,6 +443,12 @@ class WorkflowRequest(Base): def set_end_time(self, time: str): self.end_time = time + def __json__(self, request) -> dict: + return dict( + workflow_request_id=self.workflow_request_id, + workflow_name=self.workflow_name, + argument=self.argument,) + def __repr__(self): return f"<WorkflowRequest workflow_request_id= {self.workflow_request_id}>" -- GitLab