Skip to content

Commit

Permalink
Add docs to BinocularsClient
Browse files Browse the repository at this point in the history
  • Loading branch information
ClifHouck committed Sep 4, 2024
1 parent 2f1d060 commit 26d3aab
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
16 changes: 16 additions & 0 deletions client/python/armada_client/binoculars_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ def logs(
pod_number: Optional[int] = 0,
log_options: Optional[core_v1.PodLogOptions] = core_v1.PodLogOptions(),
):
"""Retrieve logs for a specific Armada job.
:param job_id: The ID of the job for which to retreieve logs.
:param pod_namespace: The namespace of the pod/job.
:param since_time: If the empty string, retrieves all available logs.
Otherwise, retrieves logs emitted since given timestamp.
:param pod_number: The zero-indexed pod number from which to retrieve
logs. Defaults to zero.
:param log_options: An optional Kubernetes PodLogOptions object.
:return: A LogResponse object.
"""
log_request = binoculars_pb2.LogRequest(
job_id=job_id,
pod_number=pod_number,
Expand All @@ -40,5 +51,10 @@ def logs(
return self.binoculars_stub.Logs(log_request)

def cordon(self, node_name: str):
"""Send a cordon request for a specific node.
:param node_name: The name of the node.
:return: Empty grpc object.
"""
cordon_request = binoculars_pb2.CordonRequest(node_name=node_name)
return self.binoculars_stub.Cordon(cordon_request)
9 changes: 8 additions & 1 deletion client/python/docs/source/python_armada_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ armada\_client.permissions module
---------------------------------

.. automodule:: armada_client.permissions
:members:
:members:


armada\_client.binoculars_client module
---------------------------------------

.. automodule:: armada_client.binoculars_client
:members:
67 changes: 67 additions & 0 deletions docs/python_armada_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,70 @@ Convert this Subject to a grpc Subject.
* **Return type**

armada.submit_pb2.Subject


## armada_client.binoculars_client module


### _class_ armada_client.binoculars_client.BinocularsClient(channel)
Client for accessing Armada’s Binoculars service over gRPC.


* **Parameters**

**channel** – gRPC channel used for authentication. See
[https://grpc.github.io/grpc/python/grpc.html](https://grpc.github.io/grpc/python/grpc.html)
for more information.



* **Returns**

an Binoculars client instance



#### cordon(node_name)
Send a cordon request for a specific node.


* **Parameters**

**node_name** (*str*) – The name of the node.



* **Returns**

Empty grpc object.



#### logs(job_id, pod_namespace, since_time, pod_number=0, log_options=)
Retrieve logs for a specific Armada job.


* **Parameters**


* **job_id** (*str*) – The ID of the job for which to retreieve logs.


* **pod_namespace** (*str*) – The namespace of the pod/job.


* **since_time** (*str*) – If the empty string, retrieves all available logs.
Otherwise, retrieves logs emitted since given timestamp.


* **pod_number** (*int** | **None*) – The zero-indexed pod number from which to retrieve
logs. Defaults to zero.


* **log_options** (*k8s.io.api.core.v1.generated_pb2.PodLogOptions** | **None*) – An optional Kubernetes PodLogOptions object.



* **Returns**

A LogResponse object.

0 comments on commit 26d3aab

Please sign in to comment.