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

Add project support in jobs #2955

Merged
merged 11 commits into from
Apr 25, 2023
Merged

Add project support in jobs #2955

merged 11 commits into from
Apr 25, 2023

Conversation

YevheniiSemendiak
Copy link
Contributor

closes #2948

Some assumptions made:

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage: 92.00% and project coverage change: +0.06 🎉

Comparison is base (9db3432) 73.63% compared to head (fe5b9b2) 73.69%.

❗ Current head fe5b9b2 differs from pull request most recent head a92e29f. Consider uploading reports for the commit a92e29f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2955      +/-   ##
==========================================
+ Coverage   73.63%   73.69%   +0.06%     
==========================================
  Files          70       70              
  Lines       12500    12502       +2     
  Branches     2303     2302       -1     
==========================================
+ Hits         9204     9213       +9     
+ Misses       2975     2973       -2     
+ Partials      321      316       -5     
Impacted Files Coverage Δ
neuro-cli/src/neuro_cli/parse_utils.py 89.50% <ø> (ø)
neuro-sdk/src/neuro_sdk/_url_utils.py 86.60% <ø> (ø)
neuro-cli/src/neuro_cli/job.py 43.37% <66.66%> (+0.15%) ⬆️
neuro-cli/src/neuro_cli/click_types.py 75.51% <100.00%> (-0.10%) ⬇️
neuro-cli/src/neuro_cli/formatters/jobs.py 85.09% <100.00%> (+1.01%) ⬆️
neuro-sdk/src/neuro_sdk/_jobs.py 81.25% <100.00%> (+0.43%) ⬆️

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

) -> JobDescription:
url = self._config.api_url / "jobs"
if not project_name:
project_name = self._config.project_name or self._config.username
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not entirely sure about this. we created default projects for existing users just once. any new users will have to create their projects manually. thus the names of the projects may not be equal to user names (there's a chance of conflicts we discussed earlier). so self._config.username might be confusing as it may result in permission errors. additionally, we already handle this on the backend side. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, API wouldn't allow users to create jobs not in their projects or w.o. projects at all, we are safe on the backend side.

As for SDK/CLI, we could either make the project_name parameter of Jobs.run and Jobs.start obligatory, OR rely on self._config.project_name and raise an exception at _job_to_api stating smth around "Project is not specified, make sure you have created one, or reload configuration before running the jobs". I'm more for 2nd approach, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

From a user experience point of view, 2 is preferred. Most users rarely switch projects, and having to constantly retype even though it rarely changes would be a hassle.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is similar in a way to clusters - most users will never access more than one

Copy link
Contributor

@dalazx dalazx Apr 21, 2023

Choose a reason for hiding this comment

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

these all seem valid points. my only concern is us explicitly using self._config.username. by the time this code executes all existing users will have their default project created and even pulled from /config. otherwise asking to create a project seems fine.

Copy link
Contributor Author

@YevheniiSemendiak YevheniiSemendiak Apr 22, 2023

Choose a reason for hiding this comment

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

in 890658a I've added one extra propery of config named project_name_or_raise which raises exception

The current project is not selected. Please create one with 'neuro admin add-project', or switch to the existing one with 'neuro config switch-project'.

So this property to start a job if no project parameter is specified.
I'm not using project_name property directly, since when we add the user to the cluster, it won't have any project yet.
wdyt, @dalazx ?

Copy link
Contributor

@dalazx dalazx left a comment

Choose a reason for hiding this comment

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

👍

@YevheniiSemendiak YevheniiSemendiak merged commit 2209329 into master Apr 25, 2023
@YevheniiSemendiak YevheniiSemendiak deleted the ys/job-project branch April 25, 2023 11:07
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.

Support projects in platform jobs
3 participants