core.requester

Requester object to make HTTP requests to the Jobmon Flask services.

Attributes

logger

Classes

Requester

Requester object to make HTTP requests to the Jobmon Flask services.

Functions

http_request_ok(→ bool)

Return True if HTTP return codes that are deemed ok.

get_content(→ Tuple[int, Any])

Parse the response.

Module Contents

core.requester.logger[source]
core.requester.http_request_ok(status_code: int) bool[source]

Return True if HTTP return codes that are deemed ok.

class core.requester.Requester(url: str, route_prefix: str = '', request_timeout: int = 20, retries_timeout: int = 300, retries_attempts: int = 10, use_otlp: bool = False)[source]

Bases: object

Requester object to make HTTP requests to the Jobmon Flask services.

_otlp_api = None[source]
base_url[source]
route_prefix[source]
request_timeout[source]
retries_timeout[source]
retries_attempts[source]
server_structlog_context: Dict[str, str][source]
classmethod _init_otlp() None[source]
classmethod from_defaults() Requester[source]

Instantiate a requester from default config values.

property url: str[source]

Return the base url for the requester.

add_server_structlog_context(**kwargs: Any) None[source]

Add the structlogging context if it has been provided.

tracing_span(app_route: str, request_type: str) Any[source]
_maybe_trace(func: Callable) Callable[source]
_maybe_retry(func: Callable, tenacious: bool) Any[source]
_send_request(app_route: str, message: dict, request_type: str) Tuple[int, Any][source]
send_request(app_route: str, message: dict, request_type: str, tenacious: bool = True) Tuple[int, Any][source]

Send a request to the Jobmon server.

core.requester.get_content(response: Any) Tuple[int, Any][source]

Parse the response.