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

Kubernetes step parsing and command line options #298

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

hylje
Copy link
Contributor

@hylje hylje commented Nov 29, 2023

Included in this PR:

  1. Parse Kubernetes resource structure from YAML when using vh execution run, if provided.
  2. Parse Kubernetes resource claims directly as vh execution run command line arguments

vh pipeline run does not have execution runtime option override support for now.

@hylje hylje force-pushed the leo-kubernetes-options branch 2 times, most recently from 558a8a2 to 5f89570 Compare November 29, 2023 14:56
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (371f352) 86.67% compared to head (2bd0153) 86.74%.

Files Patch % Lines
...hai_cli/commands/execution/run/frontend_command.py 90.90% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #298      +/-   ##
==========================================
+ Coverage   86.67%   86.74%   +0.06%     
==========================================
  Files         126      126              
  Lines        4308     4359      +51     
  Branches      894      907      +13     
==========================================
+ Hits         3734     3781      +47     
- Misses        393      395       +2     
- Partials      181      183       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hylje hylje force-pushed the leo-kubernetes-options branch 2 times, most recently from 0134aa9 to f6e7b1a Compare December 1, 2023 12:20
@hylje hylje force-pushed the leo-kubernetes-options branch from f6e7b1a to 37e691d Compare December 19, 2023 11:11
@hylje hylje force-pushed the leo-kubernetes-options branch from 37e691d to 2bd0153 Compare December 19, 2023 11:31
@hylje hylje marked this pull request as ready for review December 19, 2023 11:35
@hylje hylje requested review from akx and ruksi December 19, 2023 11:36
Copy link
Member

@ruksi ruksi left a comment

Choose a reason for hiding this comment

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

lgtm, but a question

Comment on lines +275 to +276
"kubernetes": {
'containers': {
Copy link
Member

Choose a reason for hiding this comment

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

mixing of the " and ' hurts my souls a bit but doesn't really matter 👻

Comment on lines +301 to +313
assert run_test_setup.run_api_mock.last_create_execution_payload["runtime_config"] == {
"kubernetes": {
'containers': {
'workload': {
'resources': {
'requests': {
'cpu': 1.0,
}
}
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

the rest are not sent in the payload as we except that the API fills them from the YAML 👍

Comment on lines +375 to +393
assert run_test_setup_kube.run_api_mock.last_create_execution_payload["runtime_config"] == {
"kubernetes": {
'containers': {
'workload': {
'resources': {
'requests': {
'cpu': 1.0,
'memory': 3,
},
'limits': {
'cpu': 2.0,
'memory': 4,
'devices': {}
}
}
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

not sure I understand this, why are the non-gpu resources sent in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resources from YAML are parsed and sent if available (see the run_test_setup_kube fixture), and command line arguments can override them further. --k8s-device-none overrides just the devices dict into an explicit empty dict, while other resources are not overridden.

In the above partial case, the YAML doesn't define any resources so we won't send them either

Copy link
Member

Choose a reason for hiding this comment

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

but if we send YAML defined resources, wouldn't that mix up e.g. future copying? (we don't know know which of the passed parameters are API overrides vs. YAML overrides)

assuming that API doesn't compare passed resources to the YAML it knows 🤔

Copy link
Member

@ruksi ruksi Dec 20, 2023

Choose a reason for hiding this comment

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

but I guess it's fine if it work like the web UI, could double check it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think executions keep track of where the resulting configuration comes from, it's all put together and saved for later use. Copying doesn't refresh changes from yaml Steps, whether or not they were also supplied through the API or not.

I think the principle that front-end resolves the YAML itself and submits from it is alright, we already do it in CLI for parameters, inputs and environment variables.

I'm not against just leaving it for the API backend to work out, but I think that's its own project.

Copy link
Member

Choose a reason for hiding this comment

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

I think the principle that front-end resolves the YAML itself and submits from it is alright

yeah, I also feel that it's all-OK 👍

I'm not against just leaving it for the API backend to work out, but I think that's its own project

yeah, definitely a separate thing if we feel that it's needed

@hylje hylje requested a review from ruksi December 20, 2023 15:06
Copy link
Member

@ruksi ruksi left a comment

Choose a reason for hiding this comment

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

is good

@ruksi ruksi merged commit a680983 into master Dec 21, 2023
8 checks passed
@ruksi ruksi deleted the leo-kubernetes-options branch December 21, 2023 08:29
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.

2 participants