Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atlas
athena
Commits
d2c10678
Commit
d2c10678
authored
1 year ago
by
Dan Guest
Browse files
Options
Downloads
Patches
Plain Diff
maybe fix
parent
9f4d869d
No related branches found
No related tags found
2 merge requests
!69822
2024-03-14: merge of 24.0 into main
,
!69729
Bug fix for !68913
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Control/AthenaConfiguration/python/AthConfigFlags.py
+20
-6
20 additions, 6 deletions
Control/AthenaConfiguration/python/AthConfigFlags.py
Control/AthenaConfiguration/test/testAthConfigFlags.py
+12
-5
12 additions, 5 deletions
Control/AthenaConfiguration/test/testAthConfigFlags.py
with
32 additions
and
11 deletions
Control/AthenaConfiguration/python/AthConfigFlags.py
+
20
−
6
View file @
d2c10678
...
...
@@ -188,12 +188,12 @@ class FlagAddress(object):
"""
self
.
_flags
.
loadAllDynamicFlags
()
address
=
self
.
_name
rename
=
self
.
_flags
.
_renamed_map
()
for
key
in
self
.
_flags
.
_flagdict
.
keys
():
key
=
self
.
_flags
.
_renames
.
get
(
key
,
key
)
if
key
.
startswith
(
address
.
rstrip
(
'
.
'
)
+
'
.
'
):
ntrim
=
len
(
address
)
+
1
remaining
=
key
[
ntrim
:]
yield
key
,
getattr
(
self
,
remaining
)
yield
rename
[
key
]
,
getattr
(
self
,
remaining
)
def
asdict
(
self
):
"""
Convert to a python dictionary
...
...
@@ -207,7 +207,7 @@ class FlagAddress(object):
"""
d
=
_asdict
(
self
.
_subflag_itr
())
for
k
in
self
.
_name
.
split
(
'
.
'
):
for
k
in
self
.
_name
.
split
(
'
.
'
):
d
=
d
[
k
]
return
d
...
...
@@ -305,14 +305,28 @@ class AthConfigFlags(object):
"""
return
_asdict
(
self
.
_subflag_itr
())
def
_renamed_map
(
self
):
self
.
loadAllDynamicFlags
()
def
rename
(
key
):
for
new
,
old
in
self
.
_renames
.
items
():
if
key
.
startswith
(
old
+
'
.
'
):
stem
=
key
.
removeprefix
(
old
)
if
not
new
:
return
''
else
:
return
f
'
{
new
}{
stem
}
'
return
key
return
{
x
:
rename
(
x
)
for
x
in
self
.
_flagdict
.
keys
()}
def
_subflag_itr
(
self
):
"""
Subflag iterator for all flags
This is used by the asdict() function.
"""
self
.
loadAllDynamicFlags
()
for
key
in
self
.
_flagdict
.
keys
():
key
=
self
.
_renames
.
get
(
key
,
key
)
for
old
,
new
in
self
.
_renamed_map
().
items
():
# Lots of modules are missing in analysis releases. I
# tried to prevent imports using the _addFlagsCategory
# function which checks if some module exists, but this
...
...
@@ -320,7 +334,7 @@ class AthConfigFlags(object):
# the missing module exception seems to work, even if it's
# not pretty.
try
:
yield
key
,
getattr
(
self
,
key
)
yield
new
,
getattr
(
self
,
old
)
except
ModuleNotFoundError
as
err
:
_msg
.
debug
(
f
'
missing module:
{
err
}
'
)
pass
...
...
This diff is collapsed.
Click to expand it.
Control/AthenaConfiguration/test/testAthConfigFlags.py
+
12
−
5
View file @
d2c10678
...
...
@@ -206,10 +206,6 @@ class BasicTests(FlagsSetup):
self
.
assertEqual
(
self
.
flags
.
A
.
B
.
C
,
full_dict
[
'
A
'
][
'
B
'
][
'
C
'
])
bdict
=
self
.
flags
.
A
.
B
.
asdict
()
self
.
assertEqual
(
self
.
flags
.
A
.
B
.
C
,
bdict
[
'
C
'
])
# cloneAndReplace creates a lot more potential issues
clone
=
self
.
flags
.
cloneAndReplace
(
'
X
'
,
'
A.B
'
)
self
.
assertEqual
(
clone
.
A
.
asdict
(),
bdict
)
self
.
assertEqual
(
clone
.
asdict
(),
full_dict
)
def
test_iterator
(
self
):
self
.
assertTrue
(
'
A
'
in
self
.
flags
)
...
...
@@ -305,7 +301,18 @@ class TestFlagsSetupDynamic(FlagsSetup):
print
(
"
\n
Flag after double remap ..
"
)
print
(
"
-
"
*
80
)
def
test_copyAsDict
(
self
):
"""
test for asdict with cloned flags
"""
zdict
=
self
.
flags
.
asdict
()[
'
Z
'
]
copyf
=
self
.
flags
.
cloneAndReplace
(
'
W
'
,
'
Z
'
)
wdict
=
copyf
.
asdict
()[
'
W
'
]
self
.
assertEqual
(
zdict
,
wdict
)
# try again with flag address
cdict
=
self
.
flags
.
Z
.
asdict
()[
'
C
'
]
copyf
=
self
.
flags
.
cloneAndReplace
(
'
Z.W
'
,
'
Z.C
'
)
wdict
=
copyf
.
Z
.
asdict
()[
'
W
'
]
self
.
assertEqual
(
cdict
,
wdict
)
def
test_exists
(
self
):
...
...
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