Skip to content

Commit

Permalink
src/scheduler: store k8s context in the job node
Browse files Browse the repository at this point in the history
For the job running in k8s runtime, get k8s cluster
name that ran the job and store it in the node data field
i.e. `data.k8s_context`.

Signed-off-by: Jeny Sadadia <[email protected]>
  • Loading branch information
Jeny Sadadia authored and nuclearcat committed Feb 5, 2024
1 parent 36f8c60 commit d916ba8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,18 @@ def _run_job(self, job_config, runtime, platform, input_node):

job_id = str(runtime.get_job_id(running_job))
node['data']['job_id'] = job_id

if platform.name == "kubernetes":
context = runtime.get_context()
node['data']['k8s_context'] = context

try:
self._api.node.update(node)
except requests.exceptions.HTTPError as err:
err_msg = json.loads(err.response.content).get("detail", [])
self.log.error(err_msg)

self.log.debug(f"job node: {node}")
self.log.info(' '.join([
node['id'],
runtime.config.name,
Expand Down

0 comments on commit d916ba8

Please sign in to comment.