Skip to content

Commit

Permalink
Rename also httpjson timeout to retry_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Jan 16, 2025
1 parent 7bf459d commit 347ef6c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
10 changes: 9 additions & 1 deletion docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,9 @@ This handler transmits the whole log record, meaning that all the information wi

.. py:attribute:: logging.handlers_perflog..httpjson..backoff_intervals
:required: No
:default: ``[0.1, 0.2, 0.4, 0.8, 1.6, 3.2]``

List of wait intervals in seconds when server responds with HTTP error 429 (``TOO_MANY_REQUESTS``).

In this case, ReFrame will retry contacting the server after waiting an amount of time that is determined by cyclically iterating this list of intervals.
Expand All @@ -1615,10 +1618,15 @@ This handler transmits the whole log record, meaning that all the information wi
.. versionadded:: 4.7.3


.. py:attribute:: logging.handlers_perflog..httpjson..timeout
.. py:attribute:: logging.handlers_perflog..httpjson..retry_timeout
:required: No
:default: ``0``

Timeout in seconds for retrying when server responds with HTTP error 429 (``TOO_MANY_REQUESTS``).

If set to zero, ReFrame will retry until another HTTP response (success or error) is received.


.. versionadded:: 4.7.3

Expand Down
9 changes: 5 additions & 4 deletions reframe/core/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def _create_httpjson_handler(site_config, config_prefix):
extra_headers = site_config.get(f'{config_prefix}/extra_headers')
debug = site_config.get(f'{config_prefix}/debug')
backoff_intervals = site_config.get(f'{config_prefix}/backoff_intervals')
timeout = site_config.get(f'{config_prefix}/timeout')
retry_timeout = site_config.get(f'{config_prefix}/retry_timeout')

parsed_url = urllib.parse.urlparse(url)
if parsed_url.scheme not in {'http', 'https'}:
Expand Down Expand Up @@ -598,7 +598,8 @@ def _create_httpjson_handler(site_config, config_prefix):
'no data will be sent to the server')

return HTTPJSONHandler(url, extras, ignore_keys, json_formatter,
extra_headers, debug, backoff_intervals, timeout)
extra_headers, debug, backoff_intervals,
retry_timeout)


def _record_to_json(record, extras, ignore_keys):
Expand Down Expand Up @@ -648,7 +649,7 @@ class HTTPJSONHandler(logging.Handler):

def __init__(self, url, extras=None, ignore_keys=None,
json_formatter=None, extra_headers=None,
debug=False, backoff_intervals=(1, 2, 3), timeout=0):
debug=False, backoff_intervals=(1, 2, 3), retry_timeout=0):
super().__init__()
self._url = url
self._extras = extras
Expand All @@ -672,7 +673,7 @@ def __init__(self, url, extras=None, ignore_keys=None,
self._headers.update(extra_headers)

self._debug = debug
self._timeout = timeout
self._timeout = retry_timeout
self._backoff_intervals = backoff_intervals

def emit(self, record):
Expand Down
8 changes: 4 additions & 4 deletions reframe/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@
"json_formatter": {},
"extra_headers": {"type": "object"},
"debug": {"type": "boolean"},
"sleep_intervals": {
"backoff_intervals": {
"type": "array",
"items": {"type": "number"}
},
"timeout": {"type": "number"}
"retry_timeout": {"type": "number"}
},
"required": ["url"]
}
Expand Down Expand Up @@ -637,8 +637,8 @@
"logging/handlers_perflog/httpjson_json_formatter": null,
"logging/handlers_perflog/httpjson_extra_headers": {},
"logging/handlers_perflog/httpjson_debug": false,
"logging/handlers_perflog/httpjson_sleep_intervals": [0.1, 0.2, 0.4, 0.8, 1.6, 3.2],
"logging/handlers_perflog/httpjson_timeout": 0,
"logging/handlers_perflog/httpjson_backoff_intervals": [0.1, 0.2, 0.4, 0.8, 1.6, 3.2],
"logging/handlers_perflog/httpjson_retry_timeout": 0,
"modes/options": [],
"modes/target_systems": ["*"],
"storage/enable": false,
Expand Down

0 comments on commit 347ef6c

Please sign in to comment.