Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
Import API
Commits
396da0d5
Commit
396da0d5
authored
May 11, 2021
by
Matthias
Browse files
improve logging
parent
32efc562
Changes
1
Show whitespace changes
Inline
Side-by-side
import_api_app/resources/WriteJobResultsToDrupal.py
View file @
396da0d5
...
...
@@ -119,14 +119,19 @@ def write_results(job_drupal_uuid, job_log_drupal_uuid, status, report):
getUrl
=
current_app
.
config
[
'drupal-api-url'
]
+
\
'/jsonapi/node/log_result/'
+
job_log_drupal_uuid
response
=
requests
.
get
(
getUrl
,
headers
=
headers
,
auth
=
auth
)
try
:
logResult
=
response
.
json
()[
'data'
]
previous_status
=
logResult
[
'attributes'
][
'field_status'
]
previous_report
=
logResult
[
'attributes'
][
'field_message'
]
except
Exception
:
msg
=
'could not parse response from '
+
getUrl
current_app
.
logger
.
error
(
msg
)
except
requests
.
exceptions
.
RequestException
:
message
=
'It was not possible to read form the Drupal API:'
+
getUrl
+
\
'
\n
response: '
+
response
current_app
.
logger
.
error
(
message
)
raise
ImportApiError
(
message
)
if
previous_status
==
'FAILED'
:
status
=
previous_status
if
previous_report
is
None
or
previous_report
==
'null'
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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