Skip to content

Add container.cpus and container.memory system properties#1266

Merged
realrajaryan merged 3 commits intoapple:mainfrom
realrajaryan:users/realrajaryan/container-resource-properties
Mar 4, 2026
Merged

Add container.cpus and container.memory system properties#1266
realrajaryan merged 3 commits intoapple:mainfrom
realrajaryan:users/realrajaryan/container-resource-properties

Conversation

@realrajaryan
Copy link
Copy Markdown
Contributor

@realrajaryan realrajaryan commented Feb 25, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

This PR adds container.cpus and container.memory system properties as user-configurable defaults for container resource allocation when --cpus or --memory flags are not specified.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@github-actions github-actions bot added the cli label Feb 25, 2026
@realrajaryan realrajaryan force-pushed the users/realrajaryan/container-resource-properties branch from 1de01b3 to 99be8ed Compare February 25, 2026 22:28
if let memory {
resource.memoryInBytes = try Parser.memoryString(memory).mib()
} else if let memStr = DefaultsStore.getOptional(key: .defaultContainerMemory) {
resource.memoryInBytes = try Parser.memoryString(memStr).mib()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@realrajaryan could you rename memoryString to memoryStringAsMiB for this PR?

Understanding this line is currently difficult as there's know way to know what units are used for the return value.

@realrajaryan realrajaryan force-pushed the users/realrajaryan/container-resource-properties branch from 358875d to a981a29 Compare March 3, 2026 18:47
@realrajaryan realrajaryan requested a review from jglogan March 3, 2026 18:48
@realrajaryan realrajaryan force-pushed the users/realrajaryan/container-resource-properties branch from a981a29 to 2dc824a Compare March 3, 2026 20:00
@realrajaryan realrajaryan merged commit 17503ac into apple:main Mar 4, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Default resource (cpus, memory) properties for regular containers.

3 participants