Skip to main content

Python interface to Xenon 3.0

ZenodoBadge Documentation Status Apache2License BuildStatus CodacyBadge

Python interface to the Xenon middleware library, v. 3.0. Xenon provides a simple programming interface to various pieces of software that can be used to access distributed compute and storage resources.

Underneath it uses GRPC, to connect to the Xenon-GRPC service. We’ve taken care to mirror the original Java API in this Python module as much as possible.

Installing

Clone this repository, and do:

pip install .

The code will appear on PyPI when it is ready for release.

Documentation

The compiled documentation is hosted on Read the Docs. This includes a quick-start guide.

Example

import xenon
from pathlib import Path
import os

xenon.init()

# create a new job scheduler, using SSH to localhost to submit new jobs.
with xenon.Scheduler.create(
        adaptor='ssh', location='localhost') as scheduler:

    # make a new job description. The executable must already be present on
    # the target host.
    target = Path('.') / 'stdout.txt'
    desc = xenon.JobDescription(
        executable='hostname',
        stdout=str(target.resolve()))

    # submit a job
    job = scheduler.submit_batch_job(desc)
    status = scheduler.wait_until_done(job, 1000)

    # read the standard output of the job. We can do this directly because
    # we ran on localhost, otherwise, we need to transfer the file first.
    with open(target) as f:
        print(f.read())

Development

PyXenon ships with the Xenon-GRPC jar-file and command-line executable. If these need upgrading, build them manually, following instructions at Xenon-GRPC, and place the contents of the build/install/xenon-grpc-shadow folder (lib and bin) here.

To generate the GRPC code, run scripts/protoc.sh from the project root.

Steps for upgrading Xenon-GRPC

In the xenon-grpc repository, run:

./gradlew shadowJar

The updated JAR file will be located in ./build/libs/xenon-grpc-${version}.jar. Also make sure to copy updated binary files from ./build/install/xenon-grpc/bin. The target files should go to the ./bin and ./lib folders in the pyxenon repository.

Update ./xenon/versions.py.

To update the GRPC Python bindings, run the ./scripts/protoc.sh script.

To update the Xenon adaptor documentation, first pip install --upgrade ., then run python ./scripts/print_adaptor_docs.py > docs/adaptors.rst.

Run tox before pushing anything back to github.

Testing

Unit tests all run against the local scheduler and the file adaptor for filesystems. To run them, just do:

$ pytest ./tests

For faster testing it may be useful to start the xenon-grpc daemon manually; start it in a separate terminal as it may give useful output for debugging.

For integration testing, run the following docker container to test against remote slurm

docker run --detach --publish 10022:22 nlesc/xenon-slurm:17

An example of some code running against this container is in examples/tutorial.py.

Contributing

Contributions can be made using GitHub pull requests. To add a feature, first install the test requirements

pip install -U tox

and then run

tox

until all tests succeed. The command checks against flake8 code standards and syntax errors on Python 3.5 and 3.6. Then commit, to make sure the change didn’t break any code. The pull request will be evaluated in Travis.

Metadata

Release files for pyxenon 3.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyxenon 3.0.3
File Size Uploaded
pyxenon-3.0.3.tar.gz 22.2 MB Details

Release files / pyxenon-3.0.3.tar.gz

Download URL pyxenon-3.0.3.tar.gz
Size 22.2 MB
Tags Source
SHA-256 checksum
How to use checksums
6840771716974da68d69e5cc24e017698f8f9bcebcfaf3cb5da41555d5ec772b
BLAKE2b-256 checksum
How to use checksums
7fccaf5083868d6f0354a0a79ddabe60cb78e60d6024a31c6f1c3a526fe28212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4+

Release history Release notifications | RSS feed

This release

3.0.3 This release

1 release file

3.0.2

1 release file

3.0.1

1 release file

2.3.1

2 release files

2.3.0

2 release files

2.2.3

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2

1 release file

0.3

2 release files

0.2.2

2 release files

0.2.1

3 release files

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page