Skip to content

Commit

Permalink
add ua for k8s client
Browse files Browse the repository at this point in the history
  • Loading branch information
BalaBalaYi committed Jun 7, 2024
1 parent aff7c11 commit c90eb05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dlrover/python/scheduler/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
}

JOB_SUFFIX = "-edljob-"
USER_AGENT = "easyDL/29.0.0/python"


def convert_memory_to_mb(memory: str):
Expand Down Expand Up @@ -148,6 +149,7 @@ def __init__(self, namespace):
self.client = client.CoreV1Api()
self.api_instance = client.CustomObjectsApi()
self.api_client = client.ApiClient()
self.api_client.user_agent = USER_AGENT
self._namespace = namespace

@retry_k8s_request
Expand Down
2 changes: 2 additions & 0 deletions dlrover/python/tests/test_k8s_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from dlrover.python.common.node import NodeResource
from dlrover.python.scheduler.kubernetes import (
USER_AGENT,
get_main_container,
k8sClient,
k8sServiceFactory,
Expand Down Expand Up @@ -90,3 +91,4 @@ def test_client(self):
client = k8sClient.singleton_instance("default")
succeed = client.cordon_node("test-node-0")
self.assertFalse(succeed)
self.assertEqual(client.api_client.user_agent, USER_AGENT)

0 comments on commit c90eb05

Please sign in to comment.