Project: Armada (Orchestration & Management / Scheduling & Orchestration)
File: python_armada_client.md

docname: pythonarmadaclient images: {} path: /python-armada-client title: armada_client package Armada Python GRPC Client For the api definitions: Client for accessing Armada over gRPC. Parameters* channel gRPC channel used for authentication. See for more information. Returns* an Armada client instance Cancel jobs in a given queue. Uses the CancelJobs RPC to cancel jobs. Either job_id or jobsetid is required. Parameters* queue (str | None*) The name of the queue job_id (str | None*) The name of the job id (this or jobsetid required) job_set_id (str | None*) An array of JobSubmitRequestItems. (this or job_id required) Returns* A CancellationResult object. Return type* armada.submit_pb2.CancellationResult Cancel jobs in a given queue. Uses the CancelJobSet RPC to cancel jobs. A filter is used to only cancel jobs in certain states. Parameters* queue (str*) The name of the queue job_set_id (str*) An array of JobSubmitRequestItems. filter_states (List[armada_client.typings.JobState]*) A list of states to filter by. Returns* An empty response. Return type* google.protobuf.empty_pb2.Empty Create a job request. Parameters* priority (float*) The priority of the job pod_spec (Optional[armadaclient.k8s.io.api.core.v1.generatedpb2.PodSpec]*) The k8s pod spec of the job pod_specs (Optional[List[armadaclient.k8s.io.api.core.v1.generatedpb2.PodSpec]]*) List of k8s pod specs of the job namespace (str | None*) The namespace of the job client_id (str | None*) The client id of the job labels (Dict[str, str] | None*) The labels of the job annotations (Dict[str, str] | None*) The annotations of the job required_node_labels (Dict[str, str] | None*) The required node labels of the job ingress (List[armada.submit_pb2.IngressConfig] | None*) The ingress of the job services (List[armada.submit_pb2.ServiceConfig] | None*) The services of the job Returns* A job item request object. See the api definition. Return type* armada.submit_pb2.JobSubmitRequestItem Uses the CreateQueue RPC to create a queue. Parameters* queue (armada.submit_pb2.Queue) A queue to create. Return type* google.protobuf.empty_pb2.Empty Create a queue request object. Parameters* name (str*) The name of the queue priority_factor (float | None*) The priority factor for the queue user_owners (List[str] | None*) The user owners for the queue group_owners (List[str] | None*) The group owners for the queue resource_limits (Dict[str, float] | None*) The resource limits for the queue permissions (List[armada_client.permissions.Permissions] | None*) The permissions for the queue Returns* A queue request object. Return type* armada.submit_pb2.Queue Uses the CreateQueues RPC to create a list of queues. Parameters* queues (List[armada.submit_pb2.Queue]) A list of queues to create. Return type* armada.submit_pb2.BatchQueueCreateResponse Delete an empty queue by name. Uses the DeleteQueue RPC to delete the queue. Parameters* name (str) The name of an empty queue Returns* None Return type* None Health check for Event Service. :return: A HealthCheckResponse object. Return type*

Get event stream for a job set. Uses the GetJobSetEvents rpc to get a stream of events relating to the provided jobsetid. Usage: ```python events = client.getjobevents_stream(...) for event in events: event = client.unmarshaleventresponse(event) print(event) ``` Parameters* queue (str*) The name of the queue job_set_id (str*) The name of the job set (a grouping of jobs) from_message_id (str | None*) The from message id. Returns* A job events stream for the jobsetid provided. Return type* Iterator[armada.event_pb2.EventStreamMessage] Get the queue by name. Uses the GetQueue RPC to get the queue. Parameters* name (str) The name of the queue Returns* A queue object. See the api definition. Return type* armada.submit_pb2.Queue Reprioritize jobs with new_priority value. Uses ReprioritizeJobs RPC to set a new priority on a list of jobs or job set. Parameters* new_priority (float*) The new priority value for the jobs job_ids (List[str] | None*) A list of job ids to change priority of job_set_id (str | None*) A job set id including jobs to change priority of queue (str | None*) The queue the jobs are in Returns* JobReprioritizeResponse object. It is a map of strings. Return type* armada.submit_pb2.JobReprioritizeResponse Health check for Submit Service. :return: A HealthCheckResponse object. Return type* armada.health_pb2.HealthCheckResponse Submit a armada job. Uses SubmitJobs RPC to submit a job. Parameters* queue (str*) The name of the queue job_set_id (str*) The name of the job set (a grouping of jobs) job_request_items* List[JobSubmitRequestItem] An array of JobSubmitRequestItems. Returns* A JobSubmitResponse object. Return type* armada.submit_pb2.JobSubmitResponse Unmarshal an event response from the gRPC server. Parameters* event (armada.event_pb2.EventStreamMessage) The event response from the gRPC server. Returns* An Event object. Return type* armada_client.event.Event Closes gRPC event streams Closes the provided event_stream.queue Parameters* event_stream a gRPC event stream Returns* nothing Return type* None Uses the UpdateQueue RPC to update a queue. Parameters* queue (armada.submit_pb2.Queue) A queue to update. Return type* google.protobuf.empty_pb2.Empty Uses the UpdateQueues RPC to update a list of queues. Parameters* queues (List[armada.submit_pb2.Queue]) A list of queues to update. Return type* armada.submit_pb2.BatchQueueUpdateResponse Represents a gRPC proto event Definition can be found at: Parameters* event (armada.event_pb2.EventStreamMessage) The gRPC proto event Permissions including Subjects and Verbs ```python permissions = Permissions(...) client = ArmadaClient(...) queue = client.create_queue( permissions=[permissions], ) ``` Parameters* subjects (List[armada_client.permissions.Subject]*) verbs (List[str]*) Convert to grpc object Return type* armada.submit_pb2.Permissions Subject is a NamedTuple that represents a subject in the permission system. Fields* kind (`str`) Alias for field number 0 name (`str`) Alias for field number 1 Parameters* kind (str*) name (str*) Convert this Subject to a grpc Subject. Return type* armada.submit_pb2.Subject