armada_client package

armada_client.client module

Armada Python GRPC Client

For the api definitions: https://armadaproject.io/api

class armada_client.client.ArmadaClient(channel, event_timeout=datetime.timedelta(seconds=900))

Client for accessing Armada over gRPC.

cancel_jobs(queue, job_set_id, job_id=None)

Cancel jobs in a given queue.

Uses the CancelJobs RPC to cancel jobs.

cancel_jobset(queue, job_set_id, filter_states)

Cancel jobs in a given queue.

Uses the CancelJobSet RPC to cancel jobs. A filter is used to only cancel jobs in certain states.

create_job_request_item(priority=1.0, pod_spec=None, pod_specs=None, namespace=None, client_id=None, labels=None, annotations=None, required_node_labels=None, ingress=None, services=None)

Create a job request.

create_queue(queue)

Uses the CreateQueue RPC to create a queue.

create_queue_request(name, priority_factor, user_owners=None, group_owners=None, resource_limits=None, permissions=None)

Create a queue request object.

create_queues(queues)

Uses the CreateQueues RPC to create a list of queues.

delete_queue(name)

Delete an empty queue by name.

Uses the DeleteQueue RPC to delete the queue.

event_health()

Health check for Event Service. :return: A HealthCheckResponse object.

get_job_details(job_ids)

Retrieves the details of a job from Armada.

get_job_events_stream(queue, job_set_id, from_message_id=None)

Get event stream for a job set.

Uses the GetJobSetEvents rpc to get a stream of events relating to the provided job_set_id.

Usage:

events = client.get_job_events_stream(...)
for event in events:
    event = client.unmarshal_event_response(event)
    print(event)

get_job_run_details(run_ids)

Retrieves the details of a job run from Armada.

get_job_status(job_ids)

Retrieves the status of a list of jobs from Armada.

get_queue(name)

Get the queue by name.

Uses the GetQueue RPC to get the queue.

preempt_jobs(queue, job_set_id, job_id)

Preempt jobs in a given queue.

Uses the PreemptJobs RPC to preempt jobs.

reprioritize_jobs(new_priority, job_ids, job_set_id, queue)

Reprioritize jobs with new_priority value.

Uses ReprioritizeJobs RPC to set a new priority on a list of jobs or job set (if job_ids are set to None or empty).

submit_health()

Health check for Submit Service. :return: A HealthCheckResponse object.

submit_jobs(queue, job_set_id, job_request_items)

Submit an armada job.

Uses SubmitJobs RPC to submit a job.

static unmarshal_event_response(event)

Unmarshal an event response from the gRPC server.

static unwatch_events(event_stream)

Closes gRPC event streams

Closes the provided event_stream.queue

update_queue(queue)

Uses the UpdateQueue RPC to update a queue.

update_queues(queues)

Uses the UpdateQueues RPC to update a list of queues.

armada_client.event module

class armada_client.event.Event(event)

Represents a gRPC proto event

Definition can be found at: https://github.com/armadaproject/armada/blob/master/pkg/api/event.proto#L284

armada_client.permissions module

class armada_client.permissions.Permissions(subjects, verbs)

Permissions including Subjects and Verbs

permissions = Permissions(...)
client = ArmadaClient(...)

queue = client.create_queue(
    permissions=[permissions],
)

to_grpc()

Convert to grpc object

namedtuple armada_client.permissions.Subject(kind, name)

Subject is a NamedTuple that represents a subject in the permission system.

to_grpc()

Convert this Subject to a grpc Subject.