Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
nomad-lab
nomad-FAIR
Commits
acefdd5d
Commit
acefdd5d
authored
3 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Plain Diff
Merge branch '883-unit-not-defined-error' into 'v1.1.1'
Resolve ""Unit not defined" error" See merge request
!701
parents
ede86576
1107acc5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!701
Resolve ""Unit not defined" error"
Pipeline
#133989
passed
3 years ago
Stage: build
Stage: test
Stage: release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/cli/dev.py
+3
-35
3 additions, 35 deletions
nomad/cli/dev.py
with
3 additions
and
35 deletions
nomad/cli/dev.py
+
3
−
35
View file @
acefdd5d
...
@@ -469,43 +469,11 @@ def units(ctx):
...
@@ -469,43 +469,11 @@ def units(ctx):
value
[
'
definition
'
]
=
str
(
a
).
replace
(
'
**
'
,
'
^
'
)
value
[
'
definition
'
]
=
str
(
a
).
replace
(
'
**
'
,
'
^
'
)
value
[
'
offset
'
]
=
b
/
a
.
magnitude
value
[
'
offset
'
]
=
b
/
a
.
magnitude
# Reorder unit list so that base dimensions come first. Units are
# Reorder unit list so that base dimensions come first. Units are
registered
#
registered
in the list order and base units need to be registered before
# in the list order and base units need to be registered before
derived
#
derived
ones.
# ones.
unit_list
.
sort
(
key
=
lambda
x
:
0
if
x
.
get
(
'
definition
'
)
is
None
else
1
)
unit_list
.
sort
(
key
=
lambda
x
:
0
if
x
.
get
(
'
definition
'
)
is
None
else
1
)
# Go through the metainfo and check that all units are defined. Note that
# this will break if complex derived units are used in the metainfo. In
# this case they can only be validated in a GUI test.
unit_names
=
set
()
for
unit
in
unit_list
:
unit_names
.
add
(
unit
[
'
name
'
])
for
alias
in
unit
.
get
(
'
aliases
'
,
[]):
unit_names
.
add
(
alias
)
all_metainfo
=
_all_metainfo_packages
()
units
=
set
()
packages
=
all_metainfo
.
m_to_dict
(
with_meta
=
True
)[
'
packages
'
]
for
package
in
packages
:
sections
=
package
.
get
(
'
section_definitions
'
,
[])
for
section
in
sections
:
quantities
=
section
.
get
(
'
quantities
'
,
[])
for
quantity
in
quantities
:
unit
=
quantity
.
get
(
'
unit
'
)
if
unit
is
not
None
:
parts
=
unit
.
split
()
for
part
in
parts
:
is_operator
=
part
in
{
'
/
'
,
'
**
'
,
'
*
'
}
is_number
=
True
try
:
int
(
part
)
except
Exception
:
is_number
=
False
if
not
is_operator
and
not
is_number
:
units
.
add
(
part
)
for
unit
in
units
:
assert
unit
in
unit_names
,
'
The unit
"
{}
"
is not defined in the unit definitions.
'
.
format
(
unit
)
# Print unit conversion table and unit systems as a Javascript source file
# Print unit conversion table and unit systems as a Javascript source file
output
=
'''
/*
output
=
'''
/*
* Copyright The NOMAD Authors.
* Copyright The NOMAD Authors.
...
...
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