ServiceXClient

class servicex.servicex_client.ServiceXClient(backend=None, url=None, config_path=None)[source]

Bases: object

Connection to a ServiceX deployment. Instances of this class can deployment data from the service and also interact with previously run transformations. Instances of this class are factories for Datasets`

If both backend and url are unspecified then it will attempt to pick up the default backend from .servicex

Parameters:
  • backend – Name of a deployment from the .servicex file

  • url – Direct URL of a serviceX deployment instead of using .servicex. Can only work with hosts without auth, or the token is found in a file pointed to by the environment variable BEARER_TOKEN_FILE

  • config_path – Optional path te the .servicex file. If not specified, will search in local directory and up in enclosing directories

generic_query(dataset_identifier: DataSetIdentifier | FileListDataset, query: str | QueryStringGenerator, codegen: str | None = None, title: str = 'ServiceX Client', result_format: ResultFormat = ResultFormat.parquet, ignore_cache: bool = False) Query[source]

Generate a Query object for a generic codegen specification

Parameters:
  • dataset_identifier – The dataset identifier or filelist to be the source of files

  • title – Title to be applied to the transform. This is also useful for relating transform results.

  • codegen – Name of the code generator to use with this transform

  • result_format – Do you want Paqrquet or Root? This can be set later with the set_result_format method

  • ignore_cache – Ignore the query cache and always run the query

Returns:

A Query object

get_code_generators(backend=None)[source]

Retrieve the code generators deployed with the serviceX instance :return: The list of code generators as json dictionary

get_transform_status(transform_id) TransformStatus

Get the status of a given transform :param transform_id: The uuid of the transform :return: The current status for the transform

async get_transform_status_async(transform_id) TransformStatus[source]

Get the status of a given transform :param transform_id: The uuid of the transform :return: The current status for the transform

get_transforms() List[TransformStatus]

Retrieve all transforms you have run on the server :return: List of Transform status objects

async get_transforms_async() List[TransformStatus][source]

Retrieve all transforms you have run on the server :return: List of Transform status objects