Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bliss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alisher Gaibulaev
bliss
Commits
a62f3947
Commit
a62f3947
authored
4 years ago
by
Linus Pithan
Browse files
Options
Downloads
Patches
Plain Diff
check that metadata is only collected once
parent
d3aa560f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bliss/icat/dataset.py
+11
-5
11 additions, 5 deletions
bliss/icat/dataset.py
with
11 additions
and
5 deletions
bliss/icat/dataset.py
+
11
−
5
View file @
a62f3947
...
...
@@ -148,8 +148,9 @@ class Dataset:
if
redis_name
is
None
:
self
.
_node
.
info
[
"
__name__
"
]
=
name
# todo this needs to move!
if
self
.
_node
.
info
.
get
(
"
__closed__
"
)
is
None
:
self
.
_initialize_redis_
data
set
()
self
.
gather_meta
data
()
elif
self
.
_node
.
info
.
get
(
"
__closed__
"
)
is
None
:
raise
RuntimeError
(
...
...
@@ -161,11 +162,14 @@ class Dataset:
def
_log_debug
(
self
,
msg
):
log_debug
(
self
,
f
"
Dataset(
{
self
.
root_path
}
:
{
msg
}
"
)
def
_initialize_redis_
data
set
(
self
):
def
gather_meta
data
(
self
):
"""
Initialize the dataset node info
"""
if
self
.
is_closed
:
RuntimeError
(
"
dataset is already closed!
"
)
raise
RuntimeError
(
"
dataset is already closed!
"
)
if
self
.
_node
.
info
.
get
(
"
__metadata_gathered__
"
):
raise
RuntimeError
(
"
metadata for this dataset has already been collected!
"
)
if
current_session
.
icat_mapping
:
metadata
=
current_session
.
icat_mapping
.
get_metadata
()
...
...
@@ -184,9 +188,11 @@ class Dataset:
self
.
_node
.
info
[
"
__closed__
"
]
=
False
self
.
_node
.
info
.
update
(
metadata
)
self
.
_node
.
info
[
"
__metadata_gathered__
"
]
=
True
def
add_technique
(
self
,
technique
):
if
self
.
is_closed
:
RuntimeError
(
"
dataset is already closed!
"
)
raise
RuntimeError
(
"
dataset is already closed!
"
)
assert
isinstance
(
technique
,
FieldGroup
)
self
.
_node
.
info
[
"
__techniques__
"
]
=
self
.
_node
.
techniques
.
union
(
...
...
@@ -195,7 +201,7 @@ class Dataset:
def
write_metadata_field
(
self
,
fieldname
,
value
):
if
self
.
is_closed
:
RuntimeError
(
"
dataset is already closed!
"
)
raise
RuntimeError
(
"
dataset is already closed!
"
)
if
value
is
None
:
if
fieldname
in
self
.
_node
.
info
:
...
...
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