Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
114deb37
Commit
114deb37
authored
Feb 25, 2019
by
Markus Scheidgen
Browse files
Improved error logging for parsing/normalizing.
parent
cbda0064
Pipeline
#44163
passed with stages
in 25 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/coe_repo/calc.py
View file @
114deb37
...
...
@@ -29,6 +29,9 @@ from .base import Base, calc_citation_association, ownership, co_authorship, sha
CodeVersion
,
StructRatio
,
UserMetaData
class
IllegalCalcMetadata
(
Exception
):
pass
class
Calc
(
Base
):
__tablename__
=
'calculations'
...
...
@@ -194,6 +197,9 @@ class Calc(Base):
def
add_users_to_relation
(
source_users
,
relation
):
for
source_user
in
source_users
:
coe_user
=
repo_db
.
query
(
User
).
get
(
source_user
.
id
)
if
coe_user
is
None
:
raise
IllegalCalcMetadata
(
'User with user_id %s does not exist.'
%
source_user
.
id
)
source_user
.
update
(
coe_user
.
to_popo
())
relation
.
append
(
coe_user
)
...
...
nomad/processing/data.py
View file @
114deb37
...
...
@@ -157,8 +157,13 @@ class Calc(Proc):
parser
=
parser_dict
[
self
.
parser
]
with
utils
.
timer
(
logger
,
'parser executed'
,
input_size
=
self
.
mainfile_file
.
size
):
self
.
_parser_backend
=
parser
.
run
(
self
.
upload_files
.
raw_file_object
(
self
.
mainfile
).
os_path
,
logger
=
logger
)
try
:
self
.
_parser_backend
=
parser
.
run
(
self
.
upload_files
.
raw_file_object
(
self
.
mainfile
).
os_path
,
logger
=
logger
)
except
Exception
as
e
:
self
.
fail
(
'parser failed with exception'
,
level
=
logging
.
ERROR
,
exc_info
=
e
,
error
=
str
(
e
),
**
context
)
self
.
_parser_backend
.
openNonOverlappingSection
(
'section_calculation_info'
)
self
.
_parser_backend
.
addValue
(
'upload_id'
,
self
.
upload_id
)
...
...
@@ -171,7 +176,7 @@ class Calc(Proc):
logger
.
error
(
self
.
_parser_backend
.
status
[
1
])
error
=
self
.
_parser_backend
.
status
[
1
]
self
.
_parser_backend
.
addValue
(
'parse_status'
,
'ParseFailure'
)
self
.
fail
(
error
,
level
=
logging
.
DEBUG
,
**
context
)
self
.
fail
(
error
,
level
=
logging
.
INFO
,
**
context
)
else
:
self
.
_parser_backend
.
addValue
(
'parse_status'
,
'ParseSuccess'
)
...
...
@@ -221,13 +226,19 @@ class Calc(Proc):
with
utils
.
timer
(
logger
,
'normalizer executed'
,
input_size
=
self
.
mainfile_file
.
size
):
with
self
.
use_parser_backend
(
normalizer_name
)
as
backend
:
normalizer
(
backend
).
normalize
(
logger
=
logger
)
try
:
normalizer
(
backend
).
normalize
(
logger
=
logger
)
except
Exception
as
e
:
self
.
fail
(
'normalizer failed with exception'
,
level
=
logging
.
ERROR
,
exc_info
=
e
,
error
=
str
(
e
),
**
context
)
self
.
_parser_backend
.
status
=
[
'ParseFailure'
,
str
(
e
)]
failed
=
self
.
_parser_backend
.
status
[
0
]
!=
'ParseSuccess'
if
failed
:
logger
.
error
(
self
.
_parser_backend
.
status
[
1
])
error
=
self
.
_parser_backend
.
status
[
1
]
self
.
fail
(
error
,
level
=
logging
.
WARNING
,
**
context
)
self
.
fail
(
error
,
level
=
logging
.
WARNING
,
error
=
error
,
**
context
)
break
else
:
logger
.
debug
(
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment