python-nomad
Installation
pip install python-nomad
Documentation
https://python-nomad.readthedocs.io/en/latest/
Examples
import nomad
# For HTTP Nomad instances
n = nomad.Nomad(host="172.16.100.10", timeout=5)
# For HTTPS Nomad instances with non-self-signed SSL certificates
n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=True)
# For HTTPS Nomad instances with self-signed SSL certificates and no validate the cert
n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=False)
# For HTTPS Nomad instances with self-signed SSL certificates that must validate with cert
n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=True, cert="/path/to/certfile") # See http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
# For HTTPS Nomad instances with cert file and key
n = nomad.Nomad(host="https://172.16.100.10", secure=True, timeout=5, verify=True, cert=("/path/to/certfile", "/path/to/key")) # See http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
# For HTTPS Nomad instances with namespace and acl token
n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=False, namespace='Namespace-example',token='3f4a0fcd-7c42-773c-25db-2d31ba0c05fe')
"example" in n.jobs
j = n.jobs["example"]["ID"]
example_allocation = n.job.get_allocations(j)
n.job.deregister_job(j)
Environment Variables
This library also supports environment variables: NOMAD_ADDR, NOMAD_NAMESPACE, NOMAD_TOKEN, NOMAD_REGION, NOMAD_CLIENT_CERT, and NOMAD_CLIENT_KEY
for ease of configuration and unifying with nomad cli tools and other libraries.
NOMAD_ADDR=http://127.0.0.1:4646
NOMAD_NAMESPACE=default
NOMAD_TOKEN=xxxx-xxxx-xxxx-xxxx
NOMAD_REGION=us-east-1a
NOMAD_CLIENT_CERT=/path/to/tls/client.crt
NOMAD_CLIENT_KEY=/path/to/tls/client.key
Class Dunders
| Class | contains | len | getitem | iter |
|---|---|---|---|---|
| agent | N | N | N | N |
| allocation | Y | N | Y | N |
| allocations | N | Y | N | Y |
| client | N | N | N | N |
| evaluation | Y | N | Y | N |
| evaluations | Y | Y | Y | Y |
| event | N | N | N | N |
| job | Y | N | Y | N |
| jobs | Y | Y | Y | Y |
| node | Y | N | Y | N |
| nodes | Y | Y | Y | Y |
| regions | Y | Y | Y | Y |
| status.leader | Y | Y | N | N |
| status.peers | Y | Y | Y | Y |
| system | N | N | N | N |
| validate | N | N | N | N |
| deployments | Y | Y | Y | Y |
| deployment | Y | N | Y | N |
| namespace | Y | N | Y | N |
| namespaces | Y | Y | Y | Y |
| acl | Y | N | Y | N |
| sentinel | Y | N | Y | N |
Development
- create virtualenv and activate
- install requirements-dev.txt
- can either use the Vagrantfile for local integration testing or create environment variables
NOMAD_IPandNOMAD_PORTthat are assigned to a nomad binary that is running
virtualenv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
Testing with vagrant and virtualbox
vagrant up --provider virtualbox
py.test --cov=nomad --cov-report=term-missing --runxfail tests/
Testing with nomad binary
./nomad agent -dev -node pynomad1 --acl-enabled
NOMAD_IP=127.0.0.1 NOMAD_VERSION=<SEMNATIC_VERSION> py.test --cov=nomad --cov-report=term-missing --runxfail tests/
- Examples
- Acl :link:
- Agent :link:
- Allocation :link:
- Allocations :link:
- Deployment :link:
- Deployments :link:
- Client :link:
- Evaluation :link:
- Evaluations :link:
- Event :link:
- Job :link:
- Jobs :link:
- Namespace :link:
- Namespaces :link:
- Node :link:
- Nodes :link:
- Regions :link:
- Sentinel :link:
- Search :link:
- Status :link:
- System :link:
- Validate :link:
- Variable :link:
- Variables :link:
Metadata
Release files for python-nomad 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python_nomad-2.1.0.tar.gz | 33.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_nomad-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.5 kB
Release files / python_nomad-2.1.0.tar.gz
| Download URL | python_nomad-2.1.0.tar.gz |
|---|---|
| Size | 33.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53e6d9ec6f66b672ae9d6d03591a24be2d8b5450dd7fdbe1003831cb9b77f847
|
|
BLAKE2b-256 checksum How to use checksums |
8a2eda51f38d18518818f6ac85ec2c5e64680330720d910c6abe49764cd36aff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / python_nomad-2.1.0-py3-none-any.whl
| Download URL | python_nomad-2.1.0-py3-none-any.whl |
|---|---|
| Size | 37.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c48a48d3b1774176a690493ad72d27a585714d0f2396752f9d1b6c7c1901458
|
|
BLAKE2b-256 checksum How to use checksums |
548383c46ffdd9268b00739bf05022c973baf769e31aff5f285e25c654483e92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for python-nomad 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.