Skip to content

Commit

Permalink
Add mlrun/owner label to runs k8s resources (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedingber committed Oct 15, 2020
1 parent b1697b6 commit d52bb47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mlrun/runtimes/utils.py
Expand Up @@ -316,11 +316,12 @@ def apply_kfp(modify, cop, runtime):


def get_resource_labels(function, run=None, scrape_metrics=False):
run_uid, run_name, run_project = None, None, None
run_uid, run_name, run_project, run_owner = None, None, None, None
if run:
run_uid = run.metadata.uid
run_name = run.metadata.name
run_project = run.metadata.project
run_owner = run.metadata.labels.get("owner")
labels = deepcopy(function.metadata.labels)
labels[mlrun_key + "class"] = function.kind
labels[mlrun_key + "project"] = run_project or function.metadata.project
Expand All @@ -334,6 +335,9 @@ def get_resource_labels(function, run=None, scrape_metrics=False):
if run_name:
labels[mlrun_key + "name"] = run_name

if run_owner:
labels[mlrun_key + "owner"] = run_owner

return labels


Expand Down

0 comments on commit d52bb47

Please sign in to comment.