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

chore: check task config policies against slots and max_slots #10015

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

kkunapuli
Copy link
Contributor

@kkunapuli kkunapuli commented Oct 3, 2024

Ticket

CM-551

Description

Need to check both resources.max_slots and resources.slots when checking if a NTSC workload requests is within constraints.

Test Plan

Covered by automated tests.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@cla-bot cla-bot bot added the cla-signed label Oct 3, 2024
Copy link

netlify bot commented Oct 3, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 84b8d29
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66feaa8475dc4a00081a6ea8

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.57%. Comparing base (1297899) to head (84b8d29).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
master/internal/api_command.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10015      +/-   ##
==========================================
- Coverage   54.58%   54.57%   -0.02%     
==========================================
  Files        1259     1259              
  Lines      157233   157236       +3     
  Branches     3619     3619              
==========================================
- Hits        85831    85816      -15     
- Misses      71269    71287      +18     
  Partials      133      133              
Flag Coverage Δ
backend 45.34% <90.00%> (-0.04%) ⬇️
harness 72.68% <ø> (ø)
web 54.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
master/internal/configpolicy/task_config_policy.go 84.78% <100.00%> (+1.06%) ⬆️
master/internal/api_command.go 47.88% <0.00%> (ø)

... and 10 files with indirect coverage changes

@@ -153,7 +153,7 @@ func (a *apiServer) getCommandLaunchParams(ctx context.Context, req *protoComman
// Check submitted config against task config policies.
valid, err := configpolicy.CheckNTSCConstraints(ctx, int(cmdSpec.Metadata.WorkspaceID), config, a.m.rm)
if !valid {
return nil, nil, err
return nil, nil, status.Errorf(codes.InvalidArgument, "failed constraint check: %v", err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amandavialva01 I had %w here at first, but the formatting was super weird. I was reminded of the conversation we had about %v vs. %w in fmt.Errorf. Eventually I'll (hopefully) keep it straight! 😆

Copy link
Contributor

Choose a reason for hiding this comment

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

Loll same! 😄 It's definitely a matter of trial and error 😆

@kkunapuli kkunapuli marked this pull request as ready for review October 3, 2024 14:43
@kkunapuli kkunapuli requested a review from a team as a code owner October 3, 2024 14:43
@kkunapuli kkunapuli requested review from maxrussell and amandavialva01 and removed request for maxrussell October 3, 2024 14:43
Comment on lines +125 to +126
config.Resources.Slots = *config.Resources.MaxSlots
config.Resources.MaxSlots = nil // ensure only slots is set
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this setup! Makes the test function explicit

Copy link
Contributor

@amandavialva01 amandavialva01 left a comment

Choose a reason for hiding this comment

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

LGTM! Awesome work

@kkunapuli kkunapuli merged commit 262b4a9 into main Oct 3, 2024
84 of 96 checks passed
@kkunapuli kkunapuli deleted the kunapuli/fix-ntsc-slot-constraints branch October 3, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants