Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
9aa69b8
add prefixes option and tests
jonathanrcross Nov 29, 2018
30f093d
Merge pull request #85 from jrxFive/prefix_support
jrxFive Nov 29, 2018
03557e3
bump version
jrxFive Nov 29, 2018
e10abe4
response will always be None, pass in the exception
damoxc Jan 24, 2019
99816da
Update acl.md
automaticgiant Mar 21, 2019
37df37e
Merge pull request #91 from automaticgiant/patch-1
jrxFive Mar 21, 2019
85c9213
add missing param in drain call
Apr 24, 2019
5048306
Merge pull request #92 from commarla/fix-drain-doc
jrxFive May 1, 2019
9b0c6aa
Rename alocations.md to allocations.md
rvilim Jul 25, 2019
b74ac41
Merge pull request #93 from rvilim/patch-1
jrxFive Jul 27, 2019
dd0a5dd
Adding __str__ method to improve errors readability
Sep 9, 2019
fc0975f
support NOMAD_CLIENT_CERT and NOMAD_CLIENT_KEY
erhlee-bird Sep 11, 2019
8fca9e4
Removing pass
Sep 15, 2019
824ec5c
Merge pull request #94 from SlipJ/exceptions-str
jrxFive Oct 8, 2019
7a349ea
add README mention of NOMAD_CLIENT_CERT and NOMAD_CLIENT_KEY
erhlee-bird Oct 8, 2019
641a39e
Merge pull request #96 from erhlee-bird/master
jrxFive Oct 9, 2019
e2aec80
Fix example
atillamas Nov 7, 2019
7f07ffe
Merge pull request #99 from atillamas/patch-1
erhlee-bird Jan 30, 2020
5fa997a
Merge pull request #90 from cloudbuy/fix-requests-error
erhlee-bird Jan 31, 2020
14a9e59
remove py34 support
resmo Feb 3, 2020
b6899d8
Merge pull request #101 from resmo/enh/remove-py34
erhlee-bird Feb 3, 2020
c3d1ee7
namespaces: client, node
sherrman Feb 4, 2020
8c9e2e6
Merge pull request #103 from sherrman/add-to-required-namespaces
erhlee-bird Feb 10, 2020
44bff33
1.2.0 release
jrxFive Mar 27, 2020
ca040ba
ensure python 3.7 and 3.8 are supported/tested against
jonathanrcross Mar 27, 2020
461537d
Merge pull request #104 from jrxFive/add-py37-py38-to-travis
resmo Mar 27, 2020
7006cef
update encrypted token to deploy to pypi change condition to python 3…
jonathanrcross Mar 29, 2020
e038c68
switch user to token, add wheel and skip existing options (#106)
jonathanrcross Mar 29, 2020
ff6e8dc
add safety check to verify that nomad_resp is indeed an requests.Resp…
jonathanrcross Mar 31, 2020
f24cf31
add tests to ensure no regression for bug
jonathanrcross Mar 31, 2020
b7e3c09
switch to pytest.raises to ensure that assertions are raised and not …
jonathanrcross Mar 31, 2020
fe3b6ab
Merge pull request #109 from jrxFive/107-bug-fix
erhlee-bird Apr 1, 2020
c758391
bump version to 1.2.1 for exception hotfix (#110)
jonathanrcross Apr 1, 2020
d0556f6
Support stopping an allocation
jrnk Apr 30, 2020
d5788ff
Stop allocation support is present on Nomad >= 0.9.2
jrnk May 1, 2020
1cf9840
Adhere to PEP8
jrnk May 6, 2020
a3f26fd
Merge pull request #111 from jrnk/master
erhlee-bird May 6, 2020
33ab459
add function for allocation restart endpoint
phreakocious Feb 11, 2021
7c1bca8
Merge pull request #112 from phreakocious/master
jonathanrcross Feb 28, 2021
73701a4
added support for namespace in get_jobs
fumblehool Apr 20, 2021
fcaa4a7
Documentation fix
amirsaar May 31, 2021
8c41f30
Merge pull request #116 from amirsaar/patch-1
jonathanrcross Jun 1, 2021
0d462bd
Merge pull request #115 from fumblehool/add-namespaces-support
resmo Jun 6, 2021
1cc1077
update base._query_string_builder to take params as argument (#120)
jrxFive Aug 30, 2021
100e68b
Rndmh3ro namespace get job with tests (#121)
jrxFive Aug 31, 2021
e57f668
Update setup.py
jrxFive Aug 31, 2021
f6dcba8
Add support for Event Stream. (#122)
jrxFive Sep 3, 2021
768c57e
add exception handling for import queue, python2.7 uses capital Q, bu…
jrxFive Sep 3, 2021
1ae45d8
github-actions
jrxFive Sep 5, 2021
dc6bd47
Update job.md
Kludex Sep 5, 2021
ce57557
Merge pull request #124 from Kludex/patch-1
jrxFive Sep 6, 2021
a09434e
GitHub actions integration (#125)
jrxFive Sep 6, 2021
e7951a1
Update deployment docs
cdowney Nov 20, 2021
84d99ca
add namepsace arguments and python 3.10 support
nikita-b Sep 5, 2022
23c21c5
change requests lib version
nikita-b Sep 5, 2022
c6cab12
add tests
nikita-b Sep 5, 2022
1796a61
fix tests and README.me
nikita-b Sep 18, 2022
b04f724
Merge pull request #133 from nikita-b/add_namespace_agrs
jonathanrcross Oct 10, 2022
690add1
Add support for pre-populated Sessions (#132)
minor-fixes Oct 10, 2022
9cf0883
add scaling policy endpoint
nikita-b Oct 16, 2022
587cc63
bump nomad version in tests
nikita-b Oct 16, 2022
dce5157
Merge branch 'master' of github.com:nikita-b/python-nomad into add_sc…
nikita-b Oct 16, 2022
451a8cf
Merge pull request #127 from cdowney/patch-1
nikita-b Oct 21, 2022
3c6af97
Bump mkdocs from 0.15.3 to 1.2.3 (#135)
dependabot[bot] Oct 21, 2022
d8a54bd
Merge pull request #136 from nikita-b/add_scaling_policy
nikita-b Oct 27, 2022
da760de
Add CHANGELOG.me, add all modern Nomad version to tests and fix CI (#…
nikita-b Nov 3, 2022
9ddf688
add search endpoint (#134)
nikita-b Nov 8, 2022
1463307
Add support for variables endpoint (#141)
nikita-b Nov 29, 2022
490b148
Remove support for Python 2, Python 3.6 and upgrade deps (#142)
nikita-b Dec 6, 2022
78452b6
Add pylint (#143)
nikita-b Dec 22, 2022
fb8afc2
Add missing parameters, do not pass None (#144)
Kamilcuk Jan 16, 2023
9422591
Add code formatter and change _id to id_ (#146)
nikita-b Jan 31, 2023
975b902
Fixed ${NOMAD_META_TIME -> ${NOMAD_META_TIME} (#147)
elnerd Feb 22, 2023
d65f5da
chore(docs): update link to the docs (#148)
scor2k Mar 27, 2023
ef6bc84
add option for custom user agent (#150)
nikita-b Apr 12, 2023
364f063
Add missing arguments to get_allocations() (#149)
nikita-b Apr 17, 2023
f5dcfd1
add missing arguments to node endpoints (#152)
nikita-b May 23, 2023
5cc2beb
Bump requests from 2.28.1 to 2.31.0 (#154)
dependabot[bot] May 23, 2023
6b9ebd6
add nomad 1.5.x to tests (#151)
nikita-b May 23, 2023
2b02b70
2.0.0 release (#155)
nikita-b May 26, 2023
41df869
Update parameters in `Job` functions (#153)
IgnacioHeredia Jun 2, 2023
d5d5c4c
fix node filter (#162)
bernardoVale Apr 22, 2024
7239fec
Fix errror in "Namespace" docs (#161)
freebacca Apr 22, 2024
35556fa
Only read env variables on __init__ (#157)
atwam Apr 22, 2024
ad83fff
include event api docs (#160)
j-aub Apr 22, 2024
2aca1a4
Bump black from 22.12.0 to 24.3.0 and fix format (#163)
dependabot[bot] Apr 22, 2024
816100e
add release workflow (#156)
nikita-b Apr 22, 2024
17df294
Prepare 2.0.1 release (#164)
nikita-b Apr 23, 2024
060ced3
add latest Nomad and Python to tests (#165)
nikita-b Apr 23, 2024
79ae9d9
feat: Update dispatch jobs to support `templateprefix` and `idempoten…
aas47 Jan 30, 2025
1befcb4
Bump requests from 2.31.0 to 2.32.2 (#172)
dependabot[bot] Jan 30, 2025
ff1f1db
Feature: signal allocations (#169)
Parselon Feb 3, 2025
db31eaa
update version (#173)
nikita-b Feb 4, 2025
45c4773
Fix: Update Requester.verify typing to support TLS CA certificate pat…
JannikSt May 1, 2025
e949a8b
Bump requests from 2.32.2 to 2.32.4 (#175)
dependabot[bot] Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches:
- master
pull_request:
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install Dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-lint.txt
- name: Lint
shell: bash
run: |
pylint nomad/
black --check -l 120 -t py312 nomad/
65 changes: 65 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python Nomad Test and Publish

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
registry_package:
types: [published]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
env:
NOMAD_IP: '127.0.0.1'
NOMAD_PORT: '4646'

strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.13'] # the oldest and newest support versions
nomad-version: ['1.4.14', '1.5.17', '1.6.10', '1.7.7', '1.8.4', '1.9.5']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Nomad ${{ matrix.nomad-version }}
env:
NOMAD_VERSION: ${{ matrix.nomad-version }}
shell: bash
run: |
echo ${NOMAD_VERSION}

echo "downloading nomad"
curl -L -o /tmp/nomad_${NOMAD_VERSION}_linux_amd64.zip https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip

echo "unzip nomad"
unzip -o -d /usr/local/bin/ /tmp/nomad_${NOMAD_VERSION}_linux_amd64.zip
chmod +x /usr/local/bin/nomad
/usr/local/bin/nomad version
- name: Install Dependencies
shell: bash
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r requirements-dev.txt
- name: Before Tests
shell: bash
run: |
nomad init example.nomad
nomad run -output example.nomad > example.json
- name: Unit and Integration Tests
env:
NOMAD_VERSION: ${{ matrix.nomad-version }}
shell: bash
run: |
./run_tests.sh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish

on:
release:
types:
- created

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Dependencies
shell: bash
run: pip install build
- name: Create Package
shell: bash
run: python -m build --sdist --wheel
- name: Publish/Release Package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
.vagrant
.build
.venv

# dev related files
example.json
example.nomad
nomad.log
6 changes: 6 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=120

[MESSAGES CONTROL]
disable=duplicate-code
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**Changes of the next versions will be published in the [releases](https://github.com/jrxFive/python-nomad/releases) section of the repository**

## 2.0.1
* update parameters in `Job` functions by @IgnacioHeredia #153
* Fix nodes API filter by @bernardoVale #162
* Read env variables on __init__ by @atwam #157

## 2.0.0
### BREAKING CHANGES
* Drop Python 2 and Python 3.6 support
* Rename `id` arguments to `id_` across of code base
* Rename `type` arguments to `type_` across of code base
### Other changes
* Add more missing parameters to allocations.get_allocations()
* Up `requests` lib version to 2.28.1
* Add missing parameters to allocations.get_allocations and jobs.get_jobs (#144). Thanks @Kamilcuk
* Add option for custom user agent (#150)
* Add missing parameters to nodes.get_nodes (#152).
## 1.5.0
* Add `namespace` argument support for `get_allocations` and `get_deployments` endpoints (#133)
* Add Python 3.10 support (#133)
* Add support for pre-populated Sessions (#132)
* Add scaling policy endpoint (#136)
* Drop Python 3.5 support
* Up `requests` lib version
* Add support for /var and /vars endpoints ()
* Add support for /search endpoint (#134)
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class <Endpoint>(Requester):
ENDPOINT = "<endpoint>"

def __init__(self, **kwargs):
super(<Endpoint>, self).__init__(**kwargs)
super().__init__(**kwargs)
```

##### Entity
Expand Down Expand Up @@ -249,7 +249,7 @@ class cat(Requester):
ENDPOINT = "client/fs/cat"

def __init__(self, **kwargs):
super(cat, self).__init__(**kwargs)
super().__init__(**kwargs)

def read_file(self, id=None, path="/"):
""" Read contents of a file in an allocation directory.
Expand Down Expand Up @@ -382,7 +382,7 @@ class <Endpoint>(Requester):
ENDPOINT = "<endpoint>"

def __init__(self, **kwargs):
super(<Endpoint>, self).__init__(**kwargs)
super().__init__(**kwargs)

def __str__(self):
return "{0}".format(self.__dict__)
Expand Down
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# python-nomad


Branch | Status | Coverage |
---| ---| ---
master | [![Build Status](https://travis-ci.org/jrxFive/python-nomad.svg?branch=master)](https://travis-ci.org/jrxFive/python-nomad) | [![codecov](https://codecov.io/gh/jrxFive/python-nomad/branch/master/graph/badge.svg)](https://codecov.io/gh/jrxFive/python-nomad)
[![Python Nomad Test and Publish](https://github.com/jrxFive/python-nomad/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/jrxFive/python-nomad/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/jrxFive/python-nomad/branch/master/graph/badge.svg)](https://codecov.io/gh/jrxFive/python-nomad)
[![PyPI version](https://badge.fury.io/py/python-nomad.svg)](https://badge.fury.io/py/python-nomad)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/python-nomad.svg)](https://pypi.python.org/pypi/python-nomad/)
[![Downloads](https://pepy.tech/badge/python-nomad/month)](https://pepy.tech/project/python-nomad)
[![Downloads](https://static.pepy.tech/personalized-badge/python-nomad?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads)](https://pepy.tech/project/python-nomad)
[![PyPI license](https://img.shields.io/pypi/l/python-nomad.svg)](https://pypi.python.org/pypi/python-nomad/)


## Installation
Expand Down Expand Up @@ -34,6 +38,9 @@ n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=True, cert=
# 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 instance with cert file and key and CA file
n = nomad.Nomad(host="https://172.16.100.10", secure=True, timeout=5, verify="/path/to/cacert", cert=("/path/to/certfile", "/path/to/key"))

# 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')

Expand All @@ -48,14 +55,16 @@ n.job.deregister_job(j)

## Environment Variables

This library also supports environment variables: `NOMAD_ADDR`, `NOMAD_NAMESPACE`, `NOMAD_TOKEN`, `NOMAD_REGION` for ease of configuration
and unifying with nomad cli tools and other libraries.
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.

```bash
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
Expand All @@ -68,6 +77,7 @@ NOMAD_REGION=us-east-1a
|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
Expand All @@ -90,8 +100,8 @@ NOMAD_REGION=us-east-1a
* can either use the Vagrantfile for local integration testing or create environment variables `NOMAD_IP` and `NOMAD_PORT` that are assigned to a nomad binary that is running

```
virutalenv venv
source venv/bin/activate
virtualenv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
```

Expand All @@ -117,6 +127,7 @@ NOMAD_IP=127.0.0.1 NOMAD_VERSION=<SEMNATIC_VERSION> py.test --cov=nomad --cov-re
- [x] Client [:link:](docs/api/client.md)
- [x] Evaluation [:link:](docs/api/evaluation.md)
- [x] Evaluations [:link:](docs/api/evaluations.md)
- [x] Event [:link:](docs/api/event.md)
- [x] Job [:link:](docs/api/job.md)
- [x] Jobs [:link:](docs/api/jobs.md)
- [x] Namespace [:link:](docs/api/namespace.md)
Expand All @@ -125,6 +136,9 @@ NOMAD_IP=127.0.0.1 NOMAD_VERSION=<SEMNATIC_VERSION> py.test --cov=nomad --cov-re
- [x] Nodes [:link:](docs/api/nodes.md)
- [x] Regions [:link:](docs/api/regions.md)
- [x] Sentinel [:link:](docs/api/sentinel.md)
- [x] Search [:link:](docs/api/search.md)
- [x] Status [:link:](docs/api/status.md)
- [x] System [:link:](docs/api/system.md)
- [x] Validate [:link:](docs/api/validate.md)
- [x] Variable [:link:](docs/api/variable.md)
- [x] Variables [:link:](docs/api/variables.md)
Loading