diff --git a/client/python/armada_client/binoculars_client.py b/client/python/armada_client/binoculars_client.py index adc459b943b..2b05a48b904 100644 --- a/client/python/armada_client/binoculars_client.py +++ b/client/python/armada_client/binoculars_client.py @@ -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, @@ -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) diff --git a/client/python/docs/source/python_armada_client.rst b/client/python/docs/source/python_armada_client.rst index 3db43ad4c39..5b05695db73 100644 --- a/client/python/docs/source/python_armada_client.rst +++ b/client/python/docs/source/python_armada_client.rst @@ -20,4 +20,11 @@ armada\_client.permissions module --------------------------------- .. automodule:: armada_client.permissions - :members: \ No newline at end of file + :members: + + +armada\_client.binoculars_client module +--------------------------------------- + +.. automodule:: armada_client.binoculars_client + :members: diff --git a/docs/python_armada_client.md b/docs/python_armada_client.md index e2dc1228f89..91a4d6e0b25 100644 --- a/docs/python_armada_client.md +++ b/docs/python_armada_client.md @@ -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.