ServiceXConfigAdaptor#

class servicex.servicex_config.ServiceXConfigAdaptor(config: Optional[ConfigView] = None)[source]#

Bases: object

Contains the logic to extract all the configuration information needed, as driven from things the user has given us and program parameters. This concentrates all the complex config logic in on place, and, hopefully, leaves the logic out of all the other code.

__init__(config: Optional[ConfigView] = None)[source]#

The config needed for the app.

Note: The config is held onto and only queired when the information is required.

Args:
config (ConfigView): The config information for the app. If null, then we just use the

standard servicex name.

Attributes

settings#

Return the config settings.

Eventually this should not be used other than for testing!

Returns:

ConfigSettings: The config settings that gives us a view on everything the user wants

Methods

_get_backend_info(backend_name: Optional[str]) Dict[str, str][source]#

Returns all the info for a backend name/type.

Search algorithm is non-trivial: 1. If backend_name is not None:

  1. Look at the api_endpoints for a name matching backend_name.

  2. Look at the api_endpoints for a type matching backend_name, complain that name wasn’t present.

  3. Fail if nothing matches

  1. If backend_name is None: 1. Use the first end point in the list, and complain.

Given the above is done, then look at backend_types for a matching type, and for any key found there not already present, add it, and return the dictionary.

Args:

backend_name (str): Name or type of the api end point we are going to look up.

Returns:

Dict[str, str]: Attributes for this backend’s configuration

get_backend_info(backend_name: Optional[str], key: str) Optional[str][source]#

Find an item in the backend info, searching first for the backend name/type and then the defaults with a given type.

Args:

backend_name (str): Backend name key (str): The key for the info we are after

Returns:
Optional[str]: Return a string for the info we are after, or return None if we can’t

find it.

get_default_returned_datatype(backend_name: Optional[str]) str[source]#

Return the default return data type, given the backend is a certian type.

Args:

backend_name (Optional[str]): The backend type string (xaod, uproot, etc)

Returns:

str: The backend datatype, like root or parquet.

get_servicex_adaptor_config(backend_name: Optional[str] = None) Tuple[str, Optional[str]][source]#

Return the servicex (endpoint, token) from a given backend configuration.

Args:

backend_name (str): The backend name (like xaod) which we hopefully can find in the configuration file.

Returns:

Tuple[str, str]: The tuple of info to create a ServiceXAdaptor: end point, token (optionally).