Skip to main content

Python wrapper for the Xenon API.

Project description

ZenodoBadge Documentation Status Apache2License BuildStatus CodacyBadge

Python interface to the Xenon middleware library, v. 2.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.

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.

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.

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())

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.

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

pyxenon-2.3.0.tar.gz (47.3 MB view details)

Uploaded Source

Built Distribution

pyxenon-2.3.0-py3-none-any.whl (47.3 MB view details)

Uploaded Python 3

File details

Details for the file pyxenon-2.3.0.tar.gz.

File metadata

  • Download URL: pyxenon-2.3.0.tar.gz
  • Upload date:
  • Size: 47.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3rc1

File hashes

Hashes for pyxenon-2.3.0.tar.gz
Algorithm Hash digest
SHA256 a5502f712ce44fe9063da8ef5ee02cc0bfae8c41fddd47089d1d4277adb7614f
MD5 b335b14ae395a137848d23471593c644
BLAKE2b-256 d600ad2cdfeb905502621f2dd2a95bd9cddedfa6f37f8a957866815939873ec5

See more details on using hashes here.

Provenance

File details

Details for the file pyxenon-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyxenon-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 47.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3rc1

File hashes

Hashes for pyxenon-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 defa36bcd7ffaff902517e4f2bd22ddc23fd25491b8d2e04e4445d0c6f7a8a42
MD5 65659c69ef3aad4d5e224e26274534fe
BLAKE2b-256 24911b64f2edabbc55ac25b0284a1a85d5f2eb8a8cd2fe719c5b95855c190e8c

See more details on using hashes here.

Provenance

Supported by

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