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, max_workers=None)

Client for accessing Armada over gRPC.

cancel_jobs(queue=None, job_id=None, job_set_id=None)

Cancel jobs in a given queue.

Uses the CancelJobs RPC to cancel jobs. Either job_id or job_set_id is required.

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_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_queue(name)

Get the queue by name.

Uses the GetQueue RPC to get the queue.

get_queue_info(name)

Get the queue info by name.

Uses the GetQueueInfo RPC to get queue info.

reprioritize_jobs(new_priority, job_ids=None, job_set_id=None, queue=None)

Reprioritize jobs with new_priority value.

Uses ReprioritizeJobs RPC to set a new priority on a list of jobs or job set.

submit_health()

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

submit_jobs(queue, job_set_id, job_request_items)

Submit a 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/G-Research/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.