ServiceXAdaptor#

class servicex.servicex_adaptor.ServiceXAdaptor(endpoint, refresh_token=None)[source]#

Bases: object

__init__(endpoint, refresh_token=None)[source]#

Authenticated access to ServiceX

Methods

async _get_authorization(client: ClientSession)[source]#
async _get_token(client: ClientSession)[source]#
static _get_transform_stat(info: Dict[str, str], stat_name: str) Optional[int][source]#

Return the info from a servicex status reply, protecting against bad internet returns

async dump_query_errors(client: ClientSession, request_id: str)[source]#

Dumps to the logging system any error messages we find from ServiceX.

Args:

client (aiohttp.ClientSession): Client along which to send queries. request_id (str): Fetch all errors from there.

async get_query_status(client: ClientSession, request_id: str) Dict[str, str][source]#

Returns the full query information from the endpoint.

Args:

client (aiohttp.ClientSession): Client session on which to make the request. request_id (str): The request id to return the tranform status

Raises:

ServiceXException: If we fail to find the information.

Returns:

Dict[str, str]: The JSON dictionary of information returned from ServiceX

async get_transform_status(client: ClientSession, request_id: str) Tuple[Optional[int], int, Optional[int]][source]#

Internal routine that queries for the current stat of things. We expect the following things to come back:

  • files-processed

  • files-remaining

  • files-skipped

  • request-id

  • stats

If the transform has already completed, we return data from cache.

Arguments:

endpoint Web API address where servicex lives request_id The id of the request to check up on

Raises:

ServiceXException If the status returns Fatal.

Returns:

files_remaining How many files remain to be processed. None if the number

has not yet been determined

files_processed How many files have been successfully processed

by the system.

files_failed Number of files that were skipped

async submit_query(client: ClientSession, json_query: Dict[str, str]) Dict[str, str][source]#

Submit a query to ServiceX, and return a request ID