Per-job memory and CPU limits

Open
#137 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
40/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
django, docker, python

Research direction

Start with secondshift/jobs/limits.py and the RunLimitOverrides model, where the existing limits and their _CEILING caps are defined. Then follow how the execution plan is built and where the runner turns it into --memory, --memory-swap and --cpus. Done when the fallback order (job, workspace, server default) and the ceiling checks pass in tests, and a repository .secondshift.yaml cannot change these flags.

Written by the indexing model from the issue text.

Description

area: runner

Problem

Every run gets the same memory and CPU (RUNNER_MEMORY, RUNNER_CPUS). A heavy job can't get more, and a light job can't be held to less.

Proposal

  • Add memory_mb and cpu_millis to RunLimitOverrides. Workspaces and jobs inherit them like the other limits.
  • Fallback order: job, then workspace, then server default. The server default stays RUNNER_MEMORY and RUNNER_CPUS.
  • Add server maximums, RUNNER_MEMORY_CEILING and RUNNER_CPUS_CEILING, following the _CEILING naming of the other limits, that cap every value, as secondshift/jobs/limits.py does for the other limits.
  • Resolve the values into the execution plan. The runner uses them for --memory, --memory-swap and --cpus.
  • Editing follows Action.CHANGE_RUN_LIMITS, the same as other run limits.
  • Show the effective values on the job's limits screen.

Out of scope

Disk, process count, GPU.

Acceptance criteria

  • A job value overrides the workspace value, which overrides the server default.
  • Values above the server maximum are rejected when saving and capped at run time.
  • The runner command gets the resolved values.
  • .secondshift.yaml cannot set these values.
  • Tests show repository input cannot change memory or CPU flags.

🤖 Generated with Claude Code

Dominant language
Python
Stars
1
Forks
1
Avg merge
1h 9m
Merged PRs (30d)
322

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from piotrekno1/second-shift

All issues in piotrekno1/second-shift

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.