Pydantic models for nomad
Actively maintained. Last release 7 weeks ago, commits in 15 of the last 26 weeks. A safe choice.
pip install nomad-pydanticREADME as published on PyPI with version 0.2.1.
nomad-pydantic
Typed Python models for building, validating, rendering, and managing Nomad jobs.
nomad-pydantic represents jobs, task groups, tasks, resources, services,
volumes, and periodic schedules as Pydantic models. It renders the JSON envelope
accepted by nomad job run -json and provides a mockable client for common
Nomad CLI lifecycle operations.
from nomad_pydantic import Job, NomadConfiguration, Task, TaskGroup
config = NomadConfiguration(
job=Job(
id="hello",
type="batch",
task_groups=[
TaskGroup(
name="hello",
tasks=[
Task(
name="hello",
driver="docker",
config={"image": "alpine:3", "args": ["echo", "hello"]},
)
],
)
],
)
)
config.write()
Documentation
- Tutorial builds and renders a first job.
- How-to guides cover Hydra, periodic jobs, and lifecycle operations.
- Concepts explains the model hierarchy and JSON boundary.