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

feat: Special launcher for training projects #1133

Closed
wants to merge 27 commits into from
Closed

Conversation

amolenaar
Copy link
Contributor

@amolenaar amolenaar commented Oct 26, 2023

This MR introduces a special launcher for training sessions:

image

This launcher will launch all models in the training project.

TODO:

  • Mount persistent workspace
  • Load models in special folders for the tool/version.
  • slug for tools and versions. Slug should not change when tool/version is renamed

See #1004.

Open questions

  • Should the backend error on misconfigured models, or just skip them? (E.g. models without a primary git model, tooling with no readonly image). Outcome: ignore mis-/incompletely configured models

Out of scope

  • Clicking the launch button currently directs you to the sessions view. It should direct you to the session viewer eventually, but we cannot show that one yet for starting sessions.
  • The new card is only for training projects. General projects still have the current "read-only" card.

@amolenaar amolenaar marked this pull request as draft October 26, 2023 13:36
@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Attention: Patch coverage is 72.72727% with 15 lines in your changes missing coverage. Please review.

Project coverage is 72.86%. Comparing base (02ce4dc) to head (ec9725a).
Report is 763 commits behind head on main.

Files with missing lines Patch % Lines
backend/capellacollab/sessions/routes.py 67.39% 8 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1133      +/-   ##
==========================================
+ Coverage   72.83%   72.86%   +0.02%     
==========================================
  Files         162      162              
  Lines        5345     5391      +46     
  Branches      601      611      +10     
==========================================
+ Hits         3893     3928      +35     
- Misses       1321     1327       +6     
- Partials      131      136       +5     

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

@amolenaar amolenaar force-pushed the training-projects branch 2 times, most recently from 88dd108 to 4007c43 Compare October 26, 2023 15:03
@amolenaar amolenaar force-pushed the launch-training branch 2 times, most recently from 1d0d6ec to f9db517 Compare October 27, 2023 18:19
@amolenaar amolenaar changed the title Show special launcher card for trainings feat: Special launcher for training projects Nov 2, 2023
@amolenaar amolenaar force-pushed the training-projects branch 2 times, most recently from 352aeaf to 336fe63 Compare November 8, 2023 09:48
@amolenaar amolenaar marked this pull request as ready for review November 13, 2023 07:59
@amolenaar amolenaar requested a review from dominik003 November 13, 2023 07:59
Copy link
Contributor

@dominik003 dominik003 left a comment

Choose a reason for hiding this comment

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

Thank you very much for this nice PR. There are a few comments from my side, hopefully all more or less understandable and sensible.
Also, there are a few things in Sonar that should be addressed as well (some of them are somehow included in my suggestions). So it might make sense to go through the comments first and see if there are any outstanding points from Sonar at the end.

Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Base automatically changed from training-projects to main December 15, 2023 14:16
@amolenaar amolenaar requested a review from dominik003 December 15, 2023 15:16
@@ -542,6 +566,149 @@ def create_database_and_guacamole_session(
)


@project_router.post(
Copy link
Member

@MoritzWeber0 MoritzWeber0 Dec 15, 2023

Choose a reason for hiding this comment

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

The new endpoint is good, however, we should merge it with the read-only endpoint. They have many lines in common and we should reduce code duplication as best as possible.

As described in #1004, pre-provisioned sessions shall replace read-only sessions. pre-provisioned sessions have the same logic like read-only sessions. The only difference is that no persistent volume is passed.

This doesn't apply to the backend route. Also, the frontend components shall be merged.

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 like to keep them separate endpoints for now. This PR focuses on spawning training sessions. Doing a rewrite of read-only sessions will blow up the scope of this PR.

Copy link
Member

@MoritzWeber0 MoritzWeber0 Jan 22, 2024

Choose a reason for hiding this comment

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

I don't like the two endpoints due to the code duplication, which we try to avoid. The duplication increases future code maintainability and the effort to merge those is not too high. The provision endpoint is very similar to the read-only endpoint. The provision endpoint shall take a list of models instead of the project name anyway as decided in #1004.

Given this, there is only one flag to add: persistent, which is a boolean that can be set to true or false. With this flag, we get rid of the code duplication and have one merged endpoint.

Since this PR implements #1004, which explicitly mentions that we want to merge both endpoints, I don't see it out of scope.

Copy link
Contributor

@dominik003 dominik003 left a comment

Choose a reason for hiding this comment

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

Some last comments from my side and also saw one open comment from @MoritzWeber0
Unfortunately, I am currently getting an error when building the backend image. Rebasing on main should resolve this. So after the rebase I will try out the functionality and when everything works fine, I'll approve it.

backend/capellacollab/tools/models.py Outdated Show resolved Hide resolved
backend/capellacollab/tools/models.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to my below comments I have two other more general comments/questions:

  1. Currently, this component is only shown in case projectType === 'training'. By the components name I suspect that we do want to either use this component somewhere else or also for general projects in the future?
  2. Currently the button text is fixed to Start this training. In case we do want to also use the component for non training projects, we should make this text conditional on whether we have a training or general project.

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 do not want to make to many assumptions on what we're going to do with this component. It supports starting training sessions.

@amolenaar amolenaar force-pushed the launch-training branch 3 times, most recently from bdb75f3 to 5a9d6d9 Compare January 22, 2024 13:00
amolenaar and others added 22 commits January 26, 2024 09:18
So the flow of the provision route is more clear.
So we do not spin up a lot of sessions.
Co-authored-by: dominik003 <[email protected]>
Copy link

The pull request does not conform to the conventional commit specification. Please ensure that your commit messages follow the spec: https://www.conventionalcommits.org/.
We also strongly recommend that you set up your development environment with pre-commit, as described in our Developer documentation. This will run all the important checks right before you commit your changes, and avoids lengthy CI wait time and round trips.

This is the commit validation log:

⧗   input: fix: clean up provision workspace component
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: Remove unneeded ids

Co-authored-by: dominik003 <[email protected]>
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: Remove redundant nullable column mapper

Co-authored-by: dominik003 <[email protected]>
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: Remove redundant nullable column mapper

Co-authored-by: dominik003 <[email protected]>
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: Remove fieldset around Persistent workspace toggle

Co-authored-by: dominik003 <[email protected]>
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: remove fieldset around Start training button

Co-authored-by: dominik003 <[email protected]>
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: disable start button once pressed

So we do not spin up a lot of sessions.
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: move validation to a separate function

So the flow of the provision route is more clear.
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: clean up duplicate code
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: refactor session launching
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: model selection for provisioned sessions
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: remove ununsed model
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: remove unused css file for provision-workspace component
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: clean up dependent fields in provision endpoint
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: remove unused exception
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: make tool slug column unique
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: set warnings
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: use project in frontend directly from service

Co-authored-by: dominik003 <[email protected]>
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: remove print statement

Co-authored-by: dominik003 <[email protected]>
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: fix: no need for model config in post request

Co-authored-by: dominik003 <[email protected]>
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: feat: use slugs for workspace folders
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

⧗   input: feat: show special launcher card for trainings
✖   subject must be sentence-case [subject-case]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Here are some examples of valid commit messages:

build: Bump frontend versions
docs(user): Add model creation workflow
feat: Add a monitoring dashboard

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@MoritzWeber0 MoritzWeber0 marked this pull request as draft March 5, 2024 14:23
@MoritzWeber0
Copy link
Member

We'll wait for the web-based tool support, which has merged the persistent and read-only routes, but also prepared the interface for pre-provisioned workspaces. After #1355 is merged, we can rebase this PR.

@MoritzWeber0
Copy link
Member

Due to the number of conflicts and the status of the PR, I will close the PR. It can still be used as inspiration for an implementation in the future.

@MoritzWeber0 MoritzWeber0 deleted the launch-training branch September 2, 2024 14:48
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.

3 participants