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
c60533f2
Commit
c60533f2
authored
6 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Re-replaced ujson [skip-tests].
parent
eecc0dbe
No related branches found
No related tags found
1 merge request
!33
Merge version 0.4.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/files.py
+7
-7
7 additions, 7 deletions
nomad/files.py
with
7 additions
and
7 deletions
nomad/files.py
+
7
−
7
View file @
c60533f2
...
...
@@ -55,7 +55,7 @@ being other mainfiles. Therefore, the aux files of a restricted calc might becom
from
abc
import
ABCMeta
from
typing
import
IO
,
Generator
,
Dict
,
Iterator
,
Iterable
,
Callable
import
json
import
u
json
import
os.path
import
os
import
shutil
...
...
@@ -177,7 +177,7 @@ class StagingMetadata(Metadata):
path
=
self
.
_dir
.
join_file
(
'
%s.json
'
%
id
)
assert
not
path
.
exists
()
with
open
(
path
.
os_path
,
'
wt
'
)
as
f
:
json
.
dump
(
calc
,
f
)
u
json
.
dump
(
calc
,
f
)
def
update
(
self
,
calc_id
:
str
,
updates
:
dict
)
->
dict
:
"""
Updating a calc, using calc_id as key and running dict update with the given data.
"""
...
...
@@ -185,13 +185,13 @@ class StagingMetadata(Metadata):
metadata
.
update
(
updates
)
path
=
self
.
_dir
.
join_file
(
'
%s.json
'
%
calc_id
)
with
open
(
path
.
os_path
,
'
wt
'
)
as
f
:
json
.
dump
(
metadata
,
f
)
u
json
.
dump
(
metadata
,
f
)
return
metadata
def
get
(
self
,
calc_id
:
str
)
->
dict
:
try
:
with
open
(
self
.
_dir
.
join_file
(
'
%s.json
'
%
calc_id
).
os_path
,
'
rt
'
)
as
f
:
return
json
.
load
(
f
)
return
u
json
.
load
(
f
)
except
FileNotFoundError
:
raise
KeyError
()
...
...
@@ -199,7 +199,7 @@ class StagingMetadata(Metadata):
for
root
,
_
,
files
in
os
.
walk
(
self
.
_dir
.
os_path
):
for
file
in
files
:
with
open
(
os
.
path
.
join
(
root
,
file
),
'
rt
'
)
as
f
:
yield
json
.
load
(
f
)
yield
u
json
.
load
(
f
)
def
__len__
(
self
)
->
int
:
return
len
(
os
.
listdir
(
self
.
_dir
.
os_path
))
...
...
@@ -221,14 +221,14 @@ class PublicMetadata(Metadata):
def
data
(
self
):
if
self
.
_data
is
None
:
with
gzip
.
open
(
self
.
_db_file
,
'
rt
'
)
as
f
:
self
.
_data
=
json
.
load
(
f
)
self
.
_data
=
u
json
.
load
(
f
)
return
self
.
_data
def
_create
(
self
,
calcs
:
Iterable
[
dict
])
->
None
:
assert
not
os
.
path
.
exists
(
self
.
_db_file
)
and
self
.
_data
is
None
self
.
_data
=
{
data
[
'
calc_id
'
]:
data
for
data
in
calcs
}
with
gzip
.
open
(
self
.
_db_file
,
'
wt
'
)
as
f
:
json
.
dump
(
self
.
_data
,
f
)
u
json
.
dump
(
self
.
_data
,
f
)
def
insert
(
self
,
calc
:
dict
)
->
None
:
assert
self
.
data
is
not
None
,
"
Metadata is not open.
"
...
...
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