Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdata common public
Manage
Activity
Members
Labels
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hpc-kyb
mrdata common public
Commits
45e12304
Commit
45e12304
authored
1 year ago
by
Blake Fitch
Browse files
Options
Downloads
Patches
Plain Diff
test case for experiment ids to avoid dups and valide.
parent
53234084
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pymods/experiment_id/experiment_id_test.py
+53
-0
53 additions, 0 deletions
pymods/experiment_id/experiment_id_test.py
with
53 additions
and
0 deletions
pymods/experiment_id/experiment_id_test.py
0 → 100644
+
53
−
0
View file @
45e12304
import
sys
import
experiment_id
as
xid
print
(
"
testing experiment id
"
)
#for i in range(20):
# num = 100000 + i
# print( " i: ", str( num ), " experiment id: ", xid.experiment_number_to_id( num ) )
id_for_100000
=
"
DWSW-PYHA
"
if
xid
.
experiment_number_to_id
(
100000
)
!=
id_for_100000
:
print
(
"
First possible experiment number (100000) fails to generate correct id:
"
+
id_for_100000
)
sys
.
exit
(
-
1
)
if
not
xid
.
experiment_id_validate
(
id_for_100000
):
print
(
"
First possible experiment number (100000) fails to validate as id:
"
+
id_for_100000
)
sys
.
exit
(
-
1
)
valid_dict
=
{}
#Put a test duplicate in.
test_id
=
"
JHQO-VWJR
"
test_num
=
100017
valid_dict
[
test_id
]
=
test_num
for
i
in
range
(
100000
,
999999
):
num
=
i
id
=
xid
.
experiment_number_to_id
(
num
)
valid
=
xid
.
experiment_id_validate
(
id
)
if
not
valid
:
print
(
"
ID Failed to validate id:
"
+
str
(
id
)
+
"
valid:
"
+
str
(
valid
))
continue
if
id
in
valid_dict
:
if
id
!=
test_id
or
num
!=
test_num
:
print
(
"
ID duplicate found. id:
"
+
str
(
id
)
+
"
num
"
+
str
(
num
)
+
"
prev num:
"
+
str
(
valid_dict
[
id
])
)
valid_dict
[
id
]
=
num
print
(
"
Finished validating all usable experiment ids from 100000 to 999999
"
)
"""
num = 123456
trc = False
while True:
id = xid.experiment_number_to_id( num )
valid = xid.experiment_id_validate( id )
if not valid or num == 123283 or id ==
"
IC5G-LCTG
"
:
trc = True
print(
"
FAIL at num:
"
, num,
"
id:
"
, id )
id = xid.experiment_number_to_id( num )
valid = xid.experiment_id_validate( id )
trc = False
num += 1
"""
\ No newline at end of file
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