Skip to main content

Enables a local backend for ServiceX

Project description

ServiceX-Local

A drop in to enable local running of the ServiceX codegen and science images. This is mostly geared toward running for debugging and testing.

Installation

Install this as a library in your virtual environment with:

  • pip install servicex-local for all the Docker based codegen and science container access.
  • pip install servicex-local[xAOD] to get a local xAOD code generator (and the required dependencies) along with the docker based code.

Some science images requires a x509 certificate to run. You'll need to get the x509up into your /tmp area. If you don't have the tools installed locally, do the following:

  1. Make sure in your ~/.globus directory (on whatever OS you are no) contains the usercert.pem and userkey.pem files
  2. Use the voms_proxy_init to initialize against the atlas voms.

The science image code will pick up the location of the 509 cert.

Usage

Certificates

This will do its best to track x509 certs. If a file called x509up is located in your temp directory (including on windows), that will be copied into the docker image or other places to be used.

Example Code

This text is a DRAFT

To use this, example code is as follows:

    codegen = LocalXAOD()
    science_runner = ScienceWSL2("atlas_al9", "22.2.107")
    adaptor = SXLocalAdaptor(codegen, science_runner)

    # The simple query, take straight from the example in the documentation.
    query = q.FuncADL_ATLASr22()  # type: ignore
    jets_per_event = query.Select(lambda e: e.Jets("AnalysisJets"))
    jet_info_per_event = jets_per_event.Select(
        lambda jets: {
            "pt": jets.Select(lambda j: j.pt()),
            "eta": jets.Select(lambda j: j.eta()),
        }
    )

    spec = {
        "Sample": [
            {
                "Name": "func_adl_xAOD_simple",
                "Dataset": dataset.FileList(
                    [
                        "tests/test.root",  # noqa: E501
                    ]
                ),
                "Query": jet_info_per_event,
            }
        ]
    }
    files = deliver(spec, servicex_name="servicex-uc-af", sx_adaptor=adaptor)
    assert files is not None, "No files returned from deliver! Internal error"

Running tests

If you are on a machine with wsl2 and or docker you can run the complete set of tests with flags:

pytest --wsl2 --docker

Acknowledgments

This docker versions of this code are thanks to @ketan96-m's work on this Service MR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

servicex_local-1.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

servicex_local-1.1.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file servicex_local-1.1.0.tar.gz.

File metadata

  • Download URL: servicex_local-1.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for servicex_local-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b7769e442e946319cb31cb36663bec3d53b09ec002b248f114c16d705b5de432
MD5 f07b0d0a8aa0ae8296455b0f8a4a73c9
BLAKE2b-256 24ce0c0fc4add5b56e190f3534b60800b9447f1296fa1f69d45f19b0447ab916

See more details on using hashes here.

Provenance

The following attestation bundles were made for servicex_local-1.1.0.tar.gz:

Publisher: pypi.yaml on gordonwatts/ServiceX-Local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servicex_local-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: servicex_local-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for servicex_local-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6296890431e8424bdf1c291f0447ab19f9ff5aae82f4e70c32bc5d1c84f8d084
MD5 1f97cc5407fd996c67c08a68d1148260
BLAKE2b-256 80a8d00c3c11cf7d0efa68b7d4fcb8c77dab535a5f09e9dd05d5dd70fdc07d39

See more details on using hashes here.

Provenance

The following attestation bundles were made for servicex_local-1.1.0-py3-none-any.whl:

Publisher: pypi.yaml on gordonwatts/ServiceX-Local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page