Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrontendSpec] Add internal_labels to frontend_spec #5542

Merged
merged 32 commits into from
May 26, 2024

Conversation

roei3000b
Copy link
Member

@roei3000b roei3000b commented May 9, 2024

Add internal_labels to frontend_spec so the ui can know which labels are internal and should not be editable

After merging this pr we need to keep in mind adding any new internal labels to the MlrunInternalLabels class and use it in the code.

https://iguazio.atlassian.net/browse/ML-5939

mlrun/config.py Outdated Show resolved Hide resolved
@roei3000b roei3000b requested a review from liranbg May 16, 2024 07:30
Comment on lines 24 to 51
MLRUN_INTERNAL_LABELS = [
"dask.org/cluster-name",
"dask.org/component",
"host",
"job-type",
"kind",
"mlrun-auth-keynuclio.io/project-name",
"mlrun/class",
"mlrun/client_python_version",
"mlrun/client_version",
"mlrun/function",
"mlrun/job",
"mlrun/name",
"mlrun/owner",
"mlrun/owner_domain",
"mlrun/project",
"mlrun/runner-pod",
"mlrun/schedule-name",
"mlrun/scrape-metrics",
"mlrun/tag",
"mlrun/uid",
"mlrun/username",
"mlrun/username_domain",
"owner",
"resource_name",
"v3io_user",
"workflow",
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not helpful to understand each label usage and does not link to its usages - thus, prone to errors (such as label changes, etc).

What I do suggest is

  • make it a class, where each subclass is the resource name (e.g. "functions", "runs", "artifacts", ...)
  • values would be named so it could be reused - DRY

e.g.

class InternalLabels:
class Runs:
hostname = "hostname"

and so on.

also. note that this code should be used from mlrun server mostly. because mlrun client should not use/enforce internal labels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the subclasses, I think we can do it in the following PR

@roei3000b roei3000b marked this pull request as draft May 22, 2024 06:51
@roei3000b roei3000b requested a review from liranbg May 22, 2024 13:08
@roei3000b roei3000b marked this pull request as ready for review May 22, 2024 13:09
mlrun/common/constants.py Outdated Show resolved Hide resolved
mlrun/common/constants.py Outdated Show resolved Hide resolved
mlrun/common/constants.py Outdated Show resolved Hide resolved
mlrun/datastore/targets.py Outdated Show resolved Hide resolved
mlrun/common/runtimes/constants.py Outdated Show resolved Hide resolved
tests/api/runtime_handlers/test_sparkjob.py Show resolved Hide resolved
tests/api/runtime_handlers/test_sparkjob.py Show resolved Hide resolved
tests/api/runtimes/test_mpijob.py Outdated Show resolved Hide resolved
tests/api/runtimes/test_mpijob.py Outdated Show resolved Hide resolved
tests/system/examples/jobs/test_jobs.py Show resolved Hide resolved
@roei3000b roei3000b requested a review from quaark May 23, 2024 07:19
mlrun/common/constants.py Outdated Show resolved Hide resolved
Copy link
Member

@quaark quaark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there was a mis-communication regarding my 1.9.0 deprecation comment left some clarifications.
Otherwise great job!

mlrun/common/runtimes/constants.py Outdated Show resolved Hide resolved
mlrun/runtimes/utils.py Show resolved Hide resolved
@roei3000b roei3000b requested a review from quaark May 23, 2024 08:38
Copy link
Member

@liranbg liranbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more changes are required and some pieces you have missed

mlrun/datastore/targets.py Outdated Show resolved Hide resolved
mlrun/frameworks/tf_keras/__init__.py Outdated Show resolved Hide resolved
mlrun/projects/operations.py Outdated Show resolved Hide resolved
server/api/runtime_handlers/daskjob.py Outdated Show resolved Hide resolved
mlrun/common/constants.py Outdated Show resolved Hide resolved
MlrunInternalLabels.project: self.project,
MlrunInternalLabels.scrape_metrics: "True",
MlrunInternalLabels.tag: "latest",
MlrunInternalLabels.uid: self.run_uid,
"mpi-job-name": "trainer-1b019005",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

MlrunInternalLabels.project: self.project,
MlrunInternalLabels.schedule_name: "True",
MlrunInternalLabels.tag: "latest",
MlrunInternalLabels.uid: self.run_uid,
"mpi-job-name": "trainer-1b019005",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

Comment on lines 68 to 70
"spark-app-selector": "spark-12f88a73cb544ce298deba34947226a4",
"spark-exec-id": "1",
"spark-role": "executor",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

Comment on lines 92 to 94
"spark-app-selector": "spark-12f88a73cb544ce298deba34947226a4",
"spark-role": "driver",
"sparkoperator.k8s.io/app-name": "my-spark-jdbc-2ea432f1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

"kind": "job",
MlrunInternalLabels.v3io_user: self._test_env["V3IO_USERNAME"],
MlrunInternalLabels.owner: self._test_env["V3IO_USERNAME"],
MlrunInternalLabels.kind: "job",
"category": "tests",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

@roei3000b roei3000b requested a review from liranbg May 26, 2024 07:30
@roei3000b
Copy link
Member Author

@liranbg , Pay attention that the over labels you asked me to add are only sets in tests and are not mlrun internal labels.
Because of that I didn't add them to the MLRunInternalLabels class.

@liranbg liranbg merged commit 48485ec into mlrun:development May 26, 2024
11 checks passed
rokatyy pushed a commit to rokatyy/mlrun that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants