Skip to content

Feat: Add QOS fields: MaxJobsPerUser, MaxSubmitJobsPerUser, MaxJobsPerAccount, MaxSubmitJobsPerAccount #252

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

huerni
Copy link
Collaborator

@huerni huerni commented Mar 14, 2025

Summary by CodeRabbit

  • New Features

    • Added new options to set maximum jobs and submit jobs per account and per user in QoS management commands.
    • Enhanced QoS information display to include new job and submission limits for accounts and users.
  • Bug Fixes

    • Improved error messages for job count limits, providing clearer feedback when user or account limits are reached.
  • Documentation

    • Updated error code descriptions for new and existing job limit constraints.

Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

The changes introduce new QoS-related job and submission limit parameters at both the user and account levels. These limits are added to command-line flags, protobuf definitions, error codes, and output formatting, enabling users to set and view maximum jobs and submissions per account and user within the system.

Changes

Files/Paths Change Summary
internal/cacctmgr/CmdArgParser.go Added new flags to addQosCmd and modifyQosCmd for max-jobs-per-account, max-submit-jobs-per-user, and max-submit-jobs-per-account with short aliases. Updated modification logic to handle these flags.
internal/cacctmgr/cacctmgr.go Updated PrintQosList to include new QoS fields: MaxJobsPerAccount, MaxSubmitJobsPerUser, and MaxSubmitJobsPerAccount in the output table with formatting for unlimited values.
internal/util/err.go Revised error message for user job count limit; added new error codes and messages for account job count limits and user task presence.
protos/PublicDefs.proto Extended protobuf schema by adding new error codes (ERR_MAX_JOB_COUNT_PER_ACCOUNT, ERR_USER_HAS_TASK), renumbering and adding new fields in ModifyField, and adding new fields in QosInfo for account/user job and submission limits.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant CmdArgParser
    participant Server

    User->>CLI: Run addQos/modifyQos command with new flags
    CLI->>CmdArgParser: Parse flags (including new QoS limits)
    CmdArgParser->>Server: Send request with new QoS fields
    Server-->>CmdArgParser: Respond with status
    CmdArgParser-->>CLI: Output result
Loading

Poem

A rabbit hops through fields of code,
New limits set for jobs bestowed.
Accounts and users, rules in place,
With flags and fields, they run the race.
Errors clearer, tables wide—
In every hop, more truth supplied!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e1ebf4 and 818a8fe.

📒 Files selected for processing (4)
  • internal/cacctmgr/CmdArgParser.go (3 hunks)
  • internal/cacctmgr/cacctmgr.go (2 hunks)
  • internal/util/err.go (1 hunks)
  • protos/PublicDefs.proto (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • internal/util/err.go
  • internal/cacctmgr/cacctmgr.go
  • protos/PublicDefs.proto
  • internal/cacctmgr/CmdArgParser.go
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@huerni huerni changed the title Dev/qos limit Feat: Add QOS fields: MaxJobsPerUser, MaxSubmitJobsPerUser, MaxJobsPerAccount, MaxSubmitJobsPerAccount May 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
protos/PublicDefs.proto (1)

560-560: Docstring for nonexistent_jobs
The new field repeated uint32 nonexistent_jobs = 6; in CranedRemoteMeta would benefit from a brief comment explaining when and why these job IDs appear in the array.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 82a1f14 and edd1402.

📒 Files selected for processing (3)
  • internal/cacctmgr/CmdArgParser.go (3 hunks)
  • internal/util/err.go (1 hunks)
  • protos/PublicDefs.proto (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/util/err.go
  • internal/cacctmgr/CmdArgParser.go
🔇 Additional comments (2)
protos/PublicDefs.proto (2)

538-540: Confirm QosInfo schema migration and codegen
The addition of:

uint32 max_jobs_per_account         = 7;
uint32 max_submit_jobs_per_user     = 8;
uint32 max_submit_jobs_per_account  = 9;

is consistent and preserves field ordering. Please regenerate your gRPC stubs and update API documentation or client examples to include the new QoS fields.


473-484:

✅ Verification successful

Verify ModifyField enum alignment with CLI parser
The new modifiable fields (MaxJobsPerUser, MaxSubmitJobsPerUser, MaxSubmitJobsPerAccount, etc.) have been appended to ModifyField. Ensure that the command‐line flag parser (internal/cacctmgr/CmdArgParser.go) and any switch/case handling these enums use the correct numeric values.

You can run:


🏁 Script executed:

#!/bin/bash
# Verify ModifyField values in the CLI parser
rg -n "ModifyField_" -A2 internal/cacctmgr/CmdArgParser.go

Length of output: 4863


ModifyField enums properly referenced in CLI parser
I verified that all newly added ModifyField enum values (MaxJobsPerUser, MaxSubmitJobsPerUser, MaxSubmitJobsPerAccount, MaxCpusPerUser, MaxTimeLimitPerTask, MaxJobsPerAccount, etc.) are explicitly referenced by name in internal/cacctmgr/CmdArgParser.go. Since the parser uses the generated protos.ModifyField_* constants rather than hard-coded integers, the numeric alignment is guaranteed by the Protocol Buffer code generator. No further changes are required.

Comment on lines 444 to 481
ERR_LIB_EVENT = 63 [deprecated = true];
ERR_NO_AVAIL_NODE = 64;

ERR_MAX_JOB_COUNT_PER_USER = 65;
ERR_USER_NO_PRIVILEGE = 66;
ERR_NOT_IN_ALLOWED_LIST = 67; // The current account is not in the allowed account list for the partition.
ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition.
ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition.
ERR_EBPF = 69;
ERR_SUPERVISOR = 70;
ERR_MAX_JOB_COUNT_PER_ACCOUNT = 71;
ERR_USER_HAS_TASK = 72;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

ErrCode deprecation and missing submit-limit error codes
You've correctly deprecated ERR_LIB_EVENT = 63, but please ensure all references (in code and docs) are updated/replaced accordingly.
Additionally, you added limits fields for submissions per user/account (MaxSubmitJobsPerUser, MaxSubmitJobsPerAccount), but there are no corresponding ErrCode entries when those limits are exceeded. To fully support error handling for submission limits, consider adding two new codes after ERR_USER_HAS_TASK = 72:

 enum ErrCode {
   ...
   ERR_USER_HAS_TASK = 72;
+  ERR_MAX_SUBMIT_JOB_COUNT_PER_USER    = 73; // Exceeded max submit jobs per user
+  ERR_MAX_SUBMIT_JOB_COUNT_PER_ACCOUNT = 74; // Exceeded max submit jobs per account
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ERR_LIB_EVENT = 63 [deprecated = true];
ERR_NO_AVAIL_NODE = 64;
ERR_MAX_JOB_COUNT_PER_USER = 65;
ERR_USER_NO_PRIVILEGE = 66;
ERR_NOT_IN_ALLOWED_LIST = 67; // The current account is not in the allowed account list for the partition.
ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition.
ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition.
ERR_EBPF = 69;
ERR_SUPERVISOR = 70;
ERR_MAX_JOB_COUNT_PER_ACCOUNT = 71;
ERR_USER_HAS_TASK = 72;
ERR_LIB_EVENT = 63 [deprecated = true];
ERR_NO_AVAIL_NODE = 64;
ERR_MAX_JOB_COUNT_PER_USER = 65;
ERR_USER_NO_PRIVILEGE = 66;
ERR_NOT_IN_ALLOWED_LIST = 67; // The current account is not in the allowed account list for the partition.
ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition.
ERR_EBPF = 69;
ERR_SUPERVISOR = 70;
ERR_MAX_JOB_COUNT_PER_ACCOUNT = 71;
ERR_USER_HAS_TASK = 72;
ERR_MAX_SUBMIT_JOB_COUNT_PER_USER = 73; // Exceeded max submit jobs per user
ERR_MAX_SUBMIT_JOB_COUNT_PER_ACCOUNT = 74; // Exceeded max submit jobs per account
🤖 Prompt for AI Agents
In protos/PublicDefs.proto around lines 444 to 454, you have deprecated
ERR_LIB_EVENT but need to update all code and documentation references to this
deprecated code. Also, add two new error codes after ERR_USER_HAS_TASK = 72 to
represent submission limit exceed errors for user and account, ensuring proper
error handling for MaxSubmitJobsPerUser and MaxSubmitJobsPerAccount limits.

@huerni huerni force-pushed the dev/qos_limit branch 2 times, most recently from 5a949b1 to 3584b2a Compare May 26, 2025 01:41
@huerni huerni force-pushed the dev/qos_limit branch 3 times, most recently from 0078c17 to 8e1ebf4 Compare June 30, 2025 05:38
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.

1 participant