-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bugfix] Improve handling of requests in httpjson logger #3354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -680,7 +680,6 @@ def emit(self, record): | |
return | ||
|
||
if self._debug: | ||
import time | ||
ts = int(time.time() * 1_000) | ||
dump_file = f'httpjson_record_{ts}.json' | ||
with open(dump_file, 'w') as fp: | ||
|
@@ -689,10 +688,22 @@ def emit(self, record): | |
return | ||
|
||
try: | ||
requests.post( | ||
self._url, data=json_record, | ||
headers=self._headers | ||
) | ||
while True: | ||
response = requests.post( | ||
self._url, data=json_record, | ||
headers=self._headers | ||
) | ||
if response.status_code == 200: | ||
break | ||
|
||
if response.status_code == 429: | ||
time.sleep(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this can slow down the pipeline what about spreading the wait with a cyclic interval list, say |
||
continue | ||
|
||
raise LoggingError( | ||
f'logging failed: HTTP response code ' | ||
f'{response.status_code}' | ||
) | ||
Comment on lines
+703
to
+706
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should Reframe crash in this case, or try to print a warning? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does the outpupt look like when we raise |
||
except requests.exceptions.RequestException as e: | ||
raise LoggingError('logging failed') from e | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should go for the more inclusive: