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
c90a7020
Commit
c90a7020
authored
8 months ago
by
Theodore Chang
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Some of the example archive cannot be parsed anymore"
parent
b66d2d60
No related branches found
No related tags found
1 merge request
!2130
Resolve "Some of the example archive cannot be parsed anymore"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/datamodel/datamodel.py
+24
-0
24 additions, 0 deletions
nomad/datamodel/datamodel.py
with
24 additions
and
0 deletions
nomad/datamodel/datamodel.py
+
24
−
0
View file @
c90a7020
...
@@ -70,6 +70,25 @@ except Exception:
...
@@ -70,6 +70,25 @@ except Exception:
run_def
=
None
run_def
=
None
has_mongo
=
False
logger
=
utils
.
get_logger
(
__name__
)
def
_check_mongo_connection
():
from
nomad.infrastructure
import
mongo_client
global
has_mongo
if
has_mongo
or
mongo_client
is
None
:
return
try
:
mongo_client
.
server_info
()
has_mongo
=
True
except
Exception
as
e
:
logger
.
warning
(
'
MongoDB connection failed.
'
,
exc_info
=
e
)
class
AuthLevel
(
int
,
Enum
):
class
AuthLevel
(
int
,
Enum
):
"""
"""
Used to decorate fields with the authorization level required to edit them (using `a_auth_level`).
Used to decorate fields with the authorization level required to edit them (using `a_auth_level`).
...
@@ -922,6 +941,8 @@ class EntryMetadata(MSection):
...
@@ -922,6 +941,8 @@ class EntryMetadata(MSection):
search_quantities
=
[]
search_quantities
=
[]
keywords_set
=
set
()
keywords_set
=
set
()
_check_mongo_connection
()
def
get_section_path
(
section
):
def
get_section_path
(
section
):
section_path
=
section_paths
.
get
(
section
)
section_path
=
section_paths
.
get
(
section
)
if
section_path
is
None
:
if
section_path
is
None
:
...
@@ -1001,6 +1022,9 @@ class EntryMetadata(MSection):
...
@@ -1001,6 +1022,9 @@ class EntryMetadata(MSection):
Receives a definition of a quantity
'
current_def
'
and checks if it is a reference to another entry.
Receives a definition of a quantity
'
current_def
'
and checks if it is a reference to another entry.
If yes, add the value to
'
ref_pool
'
.
If yes, add the value to
'
ref_pool
'
.
"""
"""
if
not
has_mongo
:
return
if
isinstance
(
current_def
,
Quantity
):
if
isinstance
(
current_def
,
Quantity
):
# for quantities
# for quantities
if
not
isinstance
(
current_def
.
type
,
Reference
):
if
not
isinstance
(
current_def
.
type
,
Reference
):
...
...
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