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
7d78ec00
Commit
7d78ec00
authored
9 months ago
by
Daniel Nemergut
Browse files
Options
Downloads
Patches
Plain Diff
Not comparing pipeline versions if they're bogus
parent
ec4a6d2a
No related branches found
No related tags found
3 merge requests
!1706
merge 2.8.4 to main
,
!1696
Catch 2.8.5-DEVELOPMENT up with the latest 2.8.4
,
!1695
CASA matrix testing fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/workspaces/workspaces/system/services/casa_matrix_service.py
+22
-3
22 additions, 3 deletions
...kspaces/workspaces/system/services/casa_matrix_service.py
with
22 additions
and
3 deletions
shared/workspaces/workspaces/system/services/casa_matrix_service.py
+
22
−
3
View file @
7d78ec00
...
...
@@ -94,6 +94,24 @@ def natural_sort(in_list: list, reverse: bool = False) -> list:
return
sorted
(
in_list
,
key
=
alphanum_key
,
reverse
=
reverse
)
def
versions_match
(
db_ver
:
str
,
dir_ver
:
str
)
->
bool
:
"""
Compares CASA+pipeline version formats stored in the database vs. those installed.
:param db_ver: Version coming from the database
:param dir_ver: Version coming from a directory path
:return: True if the CASA+pipeline versions match
"""
if
db_ver
==
dir_ver
:
return
True
# Ignore comparing pipeline versions if they don't exist in the installed version's name
if
dir_ver
.
split
(
"
|
"
)[
1
]
==
"
default
"
:
return
db_ver
.
split
(
"
|
"
)[
0
]
==
dir_ver
.
split
(
"
|
"
)[
0
]
return
False
class
CasaMatrixService
(
CasaMatrixServiceIF
):
"""
Service that enables clients to access the CASA Version Matrix.
...
...
@@ -253,16 +271,17 @@ class CasaMatrixService(CasaMatrixServiceIF):
# Put the requested version as first in the list if it's valid
for
v
in
versions
:
if
v
[
"
version
"
]
==
version
:
# TODO: This needs to be converted if the pipeline number is missing from the directory name like 5.1.1-5
if
versions_match
(
version
,
v
[
"
version
"
]):
versions
.
insert
(
0
,
versions
.
pop
(
versions
.
index
(
v
)))
# If the requested version is invalid, put the default as first in the list
# If the default is invalid, the newest version will be first in the list
if
versions
and
versions
[
0
][
"
version
"
]
!=
version
:
if
versions
and
versions
_match
(
version
,
version
s
[
0
][
"
version
"
])
:
default
=
self
.
get_default_version
(
capability
,
telescope
)
if
default
:
for
v
in
versions
:
if
v
[
"
version
"
]
==
default
:
if
version
s_match
(
default
,
v
[
"
version
"
])
:
versions
.
insert
(
0
,
versions
.
pop
(
versions
.
index
(
v
)))
logger
.
debug
(
f
"
Found CASA versions for
{
capability
}
:
{
versions
}
"
)
...
...
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