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
Admin message
NRAO Gitlab has been upgraded to version 17.10
Show more breadcrumbs
ssa
workspaces
Commits
9bb88ce3
Commit
9bb88ce3
authored
10 months ago
by
Daniel Nemergut
Browse files
Options
Downloads
Patches
Plain Diff
Moved the casa matrix parameters to be in the JSON body and simplified the responses
parent
e954ee2c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1706
merge 2.8.4 to main
,
!1670
WS-1405 CASA matrix service
Pipeline
#15982
passed
10 months ago
Stage: pull-db
Stage: build
Stage: unit-test
Stage: .post
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/swagger-schema.yaml
+45
-12
45 additions, 12 deletions
docs/swagger-schema.yaml
services/capability/capability/views/casa_matrix.py
+51
-32
51 additions, 32 deletions
services/capability/capability/views/casa_matrix.py
with
96 additions
and
44 deletions
docs/swagger-schema.yaml
+
45
−
12
View file @
9bb88ce3
...
...
@@ -633,6 +633,10 @@ paths:
summary
:
"
Get
a
valid
CASA
version
for
processing"
description
:
"
Get
a
valid
CASA
version
for
processing,
providing
the
optional
parameters
will
filter
the
version"
operationId
:
"
get_casa_version"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
No
CASA
version
found"
...
...
@@ -651,6 +655,10 @@ paths:
summary
:
"
Get
a
list
of
valid
CASA
versions
for
processing"
description
:
"
Get
a
list
of
valid
CASA
versions
for
processing,
providing
the
optional
parameters
will
filter
the
versions"
operationId
:
"
get_casa_versions"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
No
CASA
versions
found"
...
...
@@ -667,6 +675,10 @@ paths:
summary
:
"
Get
a
CASA
recipe
for
processing
the
given
capability"
description
:
"
Get
a
valid
CASA
recipe
for
processing
the
given
capability"
operationId
:
"
get_casa_recipe"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
No
CASA
recipe
found"
...
...
@@ -685,6 +697,10 @@ paths:
summary
:
"
Add
a
CASA
version
to
the
matrix
tables"
description
:
"
Add
a
CASA
version
to
the
matrix
tables
to
enable
for
the
given
capability
list"
operationId
:
"
add_casa_version"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
CASA
version
not
added"
...
...
@@ -698,6 +714,10 @@ paths:
summary
:
"
Update
a
CASA
version
in
the
matrix
tables"
description
:
"
Update
a
CASA
version
in
the
matrix
tables
to
enable
for
the
given
capability
list"
operationId
:
"
update_casa_version"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
CASA
version
not
updated"
...
...
@@ -711,6 +731,10 @@ paths:
summary
:
"
Delete
a
CASA
version
from
the
matrix
tables"
description
:
"
Delete
a
CASA
version
from
the
matrix
tables"
operationId
:
"
delete_casa_version"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
CASA
version
not
deleted"
...
...
@@ -725,6 +749,10 @@ paths:
summary
:
"
Refresh
the
links
of
installed
CASA
versions"
description
:
"
Refresh
the
links
of
installed
CASA
versions,
existing
links
will
be
replaced
for
this
environment"
operationId
:
"
make_casa_links"
consumes
:
-
"
application/json"
produces
:
-
"
application/json"
responses
:
404
:
description
:
"
Links
not
refreshed"
...
...
@@ -1497,36 +1525,41 @@ parameters:
required
:
true
casa-version
:
name
:
"
version"
in
:
quer
y
in
:
bod
y
description
:
"
CASA
version"
type
:
"
string"
required
:
false
schema
:
type
:
string
casa-capability
:
name
:
"
capability"
in
:
quer
y
in
:
bod
y
description
:
"
Capability
to
filter
CASA
versions"
type
:
"
string"
required
:
false
schema
:
type
:
string
casa-capabilities
:
name
:
"
capabilities"
in
:
quer
y
in
:
bod
y
description
:
"
Capability
list"
type
:
"
array"
items
:
type
:
"
string"
schema
:
type
:
array
items
:
type
:
string
required
:
false
casa-telescope
:
name
:
"
telescope"
in
:
quer
y
in
:
bod
y
description
:
"
Telescope
to
filter
CASA
versions"
type
:
"
string"
required
:
false
schema
:
type
:
string
casa-compatible
:
name
:
"
is_cluster_compatible"
in
:
quer
y
in
:
bod
y
description
:
"
Flag
to
signal
if
version
is
cluster
compatible"
type
:
boolean
required
:
false
schema
:
type
:
boolean
externalDocs
:
description
:
"
More
about
the
capability
service"
...
...
This diff is collapsed.
Click to expand it.
services/capability/capability/views/casa_matrix.py
+
51
−
32
View file @
9bb88ce3
...
...
@@ -21,7 +21,7 @@ File containing definitions for the casa_matrix routes of the Workspaces REST AP
import
http
from
pyramid.httpexceptions
import
HTTPNotFound
from
pyramid.httpexceptions
import
HTTPBadRequest
,
HTTPNotFound
from
pyramid.request
import
Request
from
pyramid.response
import
Response
from
pyramid.view
import
view_config
...
...
@@ -36,17 +36,18 @@ def get_casa_version(request: Request) -> Response:
:return: Response containing the CASA version and path
or a 404 response (HTTPNotFound) if one isn
'
t returned
"""
body
=
request
.
json_body
params
=
{
"
version
"
:
request
.
params
[
"
version
"
]
if
"
version
"
in
request
.
params
else
None
,
"
capability
"
:
request
.
params
[
"
capability
"
]
if
"
capability
"
in
request
.
params
else
None
,
"
telescope
"
:
request
.
params
[
"
telescope
"
]
if
"
telescope
"
in
request
.
params
else
None
,
"
version
"
:
body
[
"
version
"
]
if
"
version
"
in
body
else
None
,
"
capability
"
:
body
[
"
capability
"
]
if
"
capability
"
in
body
else
None
,
"
telescope
"
:
body
[
"
telescope
"
]
if
"
telescope
"
in
body
else
None
,
}
params
=
{
k
:
v
for
k
,
v
in
params
.
items
()
if
v
is
not
None
}
casa_version
=
request
.
casa_matrix_service
.
get_version
(
**
params
)
if
casa_version
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
casa_version
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
casa_version
)
else
:
return
HTTPNotFound
(
detail
=
f
"
No CASA version found.
"
)
...
...
@@ -60,17 +61,18 @@ def get_casa_versions(request: Request) -> Response:
:return: Response containing a list of CASA versions and their paths
or a 404 response (HTTPNotFound) if none are returned
"""
body
=
request
.
json_body
params
=
{
"
version
"
:
request
.
params
[
"
version
"
]
if
"
version
"
in
request
.
params
else
None
,
"
capability
"
:
request
.
params
[
"
capability
"
]
if
"
capability
"
in
request
.
params
else
None
,
"
telescope
"
:
request
.
params
[
"
telescope
"
]
if
"
telescope
"
in
request
.
params
else
None
,
"
version
"
:
body
[
"
version
"
]
if
"
version
"
in
body
else
None
,
"
capability
"
:
body
[
"
capability
"
]
if
"
capability
"
in
body
else
None
,
"
telescope
"
:
body
[
"
telescope
"
]
if
"
telescope
"
in
body
else
None
,
}
params
=
{
k
:
v
for
k
,
v
in
params
.
items
()
if
v
is
not
None
}
casa_versions
=
request
.
casa_matrix_service
.
get_versions
(
**
params
)
if
casa_versions
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
casa_versions
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
casa_versions
)
else
:
return
HTTPNotFound
(
detail
=
f
"
No CASA versions found.
"
)
...
...
@@ -84,10 +86,10 @@ def get_casa_recipe(request: Request) -> Response:
:return: Response containing the CASA recipe
or a 404 response (HTTPNotFound) if one isn
'
t returned
"""
casa_recipe
=
request
.
casa_matrix_service
.
get_recipe
(
request
.
params
[
"
capability
"
])
casa_recipe
=
request
.
casa_matrix_service
.
get_recipe
(
request
.
json_body
[
"
capability
"
])
if
casa_recipe
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
casa_recipe
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
casa_recipe
)
else
:
return
HTTPNotFound
(
detail
=
f
"
No CASA recipe found.
"
)
...
...
@@ -101,17 +103,23 @@ def add_casa_version(request: Request) -> Response:
:return: Response containing true if the new matrix version was added
or a 404 response (HTTPNotFound) if one isn
'
t added
"""
added
=
request
.
casa_matrix_service
.
add_version
(
version
=
request
.
params
[
"
version
"
],
capabilities
=
request
.
params
[
"
capabilities
"
].
split
(
"
,
"
)
if
"
capabilities
"
in
request
.
params
else
[],
is_cluster_compatible
=
False
if
"
is_cluster_compatible
"
in
request
.
params
and
request
.
params
[
"
is_cluster_compatible
"
].
lower
()
in
[
"
0
"
,
"
false
"
]
else
True
,
)
body
=
request
.
json_body
if
"
version
"
not
in
body
:
return
HTTPBadRequest
(
detail
=
f
"
CASA version not given
"
)
if
"
capabilities
"
in
body
and
not
isinstance
(
body
[
"
capabilities
"
],
list
):
return
HTTPBadRequest
(
detail
=
f
"
Capabilities given aren
'
t a valid list
"
)
params
=
{
"
version
"
:
body
[
"
version
"
],
"
capabilities
"
:
body
[
"
capabilities
"
]
if
"
capabilities
"
in
body
else
[],
"
is_cluster_compatible
"
:
False
if
"
is_cluster_compatible
"
in
body
and
body
[
"
is_cluster_compatible
"
].
lower
()
in
[
"
0
"
,
"
false
"
]
else
True
,
}
added
=
request
.
casa_matrix_service
.
add_version
(
**
params
)
if
added
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
added
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
added
)
else
:
return
HTTPNotFound
(
detail
=
f
"
Matrix version not added
"
)
...
...
@@ -125,17 +133,23 @@ def update_casa_version(request: Request) -> Response:
:return: Response containing true if the matrix version was updated
or a 404 response (HTTPNotFound) if one isn
'
t updated
"""
updated
=
request
.
casa_matrix_service
.
update_version
(
version
=
request
.
params
[
"
version
"
],
capabilities
=
request
.
params
[
"
capabilities
"
].
split
(
"
,
"
)
if
"
capabilities
"
in
request
.
params
else
[],
is_cluster_compatible
=
False
if
"
is_cluster_compatible
"
in
request
.
params
and
request
.
params
[
"
is_cluster_compatible
"
].
lower
()
in
[
"
0
"
,
"
false
"
]
else
True
,
)
body
=
request
.
json_body
if
"
version
"
not
in
body
:
return
HTTPBadRequest
(
detail
=
f
"
CASA version not given
"
)
if
"
capabilities
"
in
body
and
not
isinstance
(
body
[
"
capabilities
"
],
list
):
return
HTTPBadRequest
(
detail
=
f
"
Capabilities given aren
'
t a valid list
"
)
params
=
{
"
version
"
:
body
[
"
version
"
],
"
capabilities
"
:
body
[
"
capabilities
"
]
if
"
capabilities
"
in
body
else
[],
"
is_cluster_compatible
"
:
False
if
"
is_cluster_compatible
"
in
body
and
body
[
"
is_cluster_compatible
"
].
lower
()
in
[
"
0
"
,
"
false
"
]
else
True
,
}
updated
=
request
.
casa_matrix_service
.
update_version
(
**
params
)
if
updated
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
updated
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
updated
)
else
:
return
HTTPNotFound
(
detail
=
f
"
Matrix version not updated
"
)
...
...
@@ -149,10 +163,15 @@ def delete_casa_version(request: Request) -> Response:
:return: Response containing true if version was deleted from the matrix
or a 404 response (HTTPNotFound) if one isn
'
t deleted
"""
deleted
=
request
.
casa_matrix_service
.
delete_version
(
request
.
params
[
"
version
"
])
body
=
request
.
json_body
if
"
version
"
not
in
body
:
return
HTTPBadRequest
(
detail
=
f
"
CASA version not given
"
)
deleted
=
request
.
casa_matrix_service
.
delete_version
(
body
[
"
version
"
])
if
deleted
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
deleted
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
deleted
)
else
:
return
HTTPNotFound
(
detail
=
f
"
Matrix version not deleted
"
)
...
...
@@ -169,6 +188,6 @@ def make_casa_links(request: Request) -> Response:
found_versions
=
request
.
casa_matrix_service
.
make_links
()
if
found_versions
:
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
{
"
resp
"
:
f
"
{
found_versions
}
"
}
)
return
Response
(
status_int
=
http
.
HTTPStatus
.
OK
,
json_body
=
found_versions
)
else
:
return
HTTPNotFound
(
detail
=
f
"
CASA links not updated
"
)
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