Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
575c21b5
Commit
575c21b5
authored
4 years ago
by
Charlotte Hausman
Committed by
Charlotte Hausman
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
SWS-29: make workflow and capability requests handle arguments/parameters the same
parent
df79a180
No related branches found
No related tags found
1 merge request
!66
workflow and capability request submission
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/workflow/src/workflow/server.py
+18
-9
18 additions, 9 deletions
services/workflow/src/workflow/server.py
with
18 additions
and
9 deletions
services/workflow/src/workflow/server.py
+
18
−
9
View file @
575c21b5
...
...
@@ -4,6 +4,7 @@ from pyramid.renderers import JSONP
from
pyramid.request
import
Request
from
pyramid.view
import
view_config
,
view_defaults
from
pyramid_beaker
import
session_factory_from_settings
import
json
from
workspaces.system.schema
import
get_engine
,
get_session_factory
from
workspaces.workflow.services.workflow_info
import
WorkflowInfo
...
...
@@ -27,6 +28,11 @@ def lookup_workflow(request):
return
request
.
info
.
lookup_workflow_definition
(
request
.
matchdict
[
"
name
"
])
def
lookup_workflow_json
(
request
):
req
=
request
.
json_body
return
request
.
info
.
lookup_workflow_definition
(
req
[
"
workflow
"
])
def
lookup_request
(
request
):
return
request
.
info
.
lookup_workflow_request
(
request
.
matchdict
[
"
request_id
"
])
...
...
@@ -94,12 +100,9 @@ class WorkflowRequestRestService:
Audience: front-end and CLI
:return:
"""
# 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
.
info
.
create_workflow_request
(
self
.
request
.
context
,
self
.
request
.
GET
.
getall
(
"
args
"
)
)
req
=
self
.
request
.
json_body
request
=
self
.
request
.
info
.
create_workflow_request
(
req
[
"
workflow
"
],
req
[
"
args
"
])
return
request
@view_config
(
request_method
=
"
POST
"
,
route_name
=
"
submit_workflow_request
"
)
...
...
@@ -111,8 +114,9 @@ class WorkflowRequestRestService:
:return:
"""
print
(
f
"
Submitting workflow
{
self
.
request
.
context
}
"
)
return
self
.
request
.
workflows
.
execute
(
self
.
request
.
context
,
self
.
request
.
GET
.
getall
(
"
files
"
)
self
.
request
.
context
,
self
.
request
.
json_body
[
"
files
"
]
)
...
...
@@ -246,10 +250,12 @@ def main(global_config, **settings):
config
.
add_route
(
"
workflows
"
,
"
/workflows
"
)
config
.
add_route
(
"
workflow
"
,
"
/workflows/{name}
"
,
factory
=
lookup_workflow
)
# parameters are passed with json: {workflow:<name>, args: <args>}
config
.
add_route
(
"
create_workflow_request
"
,
"
/workflows/
{name}/
requests/create
"
,
factory
=
lookup_workflow
,
"
/workflows/requests/create
"
,
factory
=
lookup_workflow
_json
,
)
config
.
add_route
(
"
workflow_request
"
,
...
...
@@ -266,6 +272,9 @@ def main(global_config, **settings):
"
/workflows/requests/{request_id}/files/{filename}
"
,
factory
=
lookup_request
,
)
# parameters are passed with json: {files:{<name>}}.
# Use empty braces for no additional files
config
.
add_route
(
"
submit_workflow_request
"
,
"
/workflows/requests/{request_id}/submit
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment