mainsequence 9.0.40__tar.gz → 9.0.41.dev92__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/PKG-INFO +1 -1
  2. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/application_surfaces/api_surfaces/SKILL.md +1 -1
  3. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/platform_operations/access_control_and_sharing/SKILL.md +12 -9
  4. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/platform_operations/orchestration_and_releases/SKILL.md +37 -0
  5. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/api.py +14 -2
  6. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/cli.py +38 -5
  7. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/models_helpers.py +67 -14
  8. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/PKG-INFO +1 -1
  9. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/pyproject.toml +1 -1
  10. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_job_client.py +110 -0
  11. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/LICENSE +0 -0
  12. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/README.md +0 -0
  13. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/a2a_sdk_execution/SKILL.md +0 -0
  14. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/application_surfaces/release_calls/SKILL.md +0 -0
  15. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/mainsequence-inference/SKILL.md +0 -0
  16. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/maintenance/bug_auditor/SKILL.md +0 -0
  17. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/maintenance/code_repository_maintenance/SKILL.md +0 -0
  18. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/maintenance/metatables_transition/SKILL.md +0 -0
  19. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/agent_scaffold/skills/sdk_code_repository_execution/SKILL.md +0 -0
  20. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/__init__.py +0 -0
  21. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/__main__.py +0 -0
  22. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/_local_callers.py +0 -0
  23. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/_request_deadline.py +0 -0
  24. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/_request_identity.py +0 -0
  25. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/_team_memberships.py +0 -0
  26. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/_transport.py +0 -0
  27. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/bootstrap.py +0 -0
  28. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/__init__.py +0 -0
  29. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/browser_auth.py +0 -0
  30. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/code_repository_status.py +0 -0
  31. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/config.py +0 -0
  32. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/docker_utils.py +0 -0
  33. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/doctor.py +0 -0
  34. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/local_ops.py +0 -0
  35. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/model_filters.py +0 -0
  36. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/pydantic_cli.py +0 -0
  37. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/sdk_utils.py +0 -0
  38. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/ssh_utils.py +0 -0
  39. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/cli/ui.py +0 -0
  40. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/__init__.py +0 -0
  41. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/access_catalog.py +0 -0
  42. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/agent_runtime_models.py +0 -0
  43. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/base.py +0 -0
  44. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/client.py +0 -0
  45. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/compute_validation.py +0 -0
  46. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/exceptions.py +0 -0
  47. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/github_issues.py +0 -0
  48. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/inference.py +0 -0
  49. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/models_foundry.py +0 -0
  50. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/models_user.py +0 -0
  51. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/object_access.py +0 -0
  52. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/observability.py +0 -0
  53. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/release_calls.py +0 -0
  54. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/utils.py +0 -0
  55. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/client/value_sets.py +0 -0
  56. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/code_repository_context.py +0 -0
  57. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/code_repository_skills.py +0 -0
  58. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/defaults.py +0 -0
  59. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/instrumentation/__init__.py +0 -0
  60. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/instrumentation/utils.py +0 -0
  61. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/logconf.py +0 -0
  62. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/repository_identity_security.py +0 -0
  63. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/runtime_credential_exchange.py +0 -0
  64. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/runtime_flags.py +0 -0
  65. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/scaffold_skills.py +0 -0
  66. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/__init__.py +0 -0
  67. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/_mcp_skills_upstream/__init__.py +0 -0
  68. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/_mcp_skills_upstream/server.py +0 -0
  69. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/_mcp_skills_upstream/shared.py +0 -0
  70. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/caller_assertions.py +0 -0
  71. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/fastapi.py +0 -0
  72. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/server/mcp_skills.py +0 -0
  73. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence/workload_identity.py +0 -0
  74. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/SOURCES.txt +0 -0
  75. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/dependency_links.txt +0 -0
  76. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/entry_points.txt +0 -0
  77. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/requires.txt +0 -0
  78. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/mainsequence.egg-info/top_level.txt +0 -0
  79. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/setup.cfg +0 -0
  80. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_access_catalog_client.py +0 -0
  81. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_auth_bootstrap.py +0 -0
  82. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_auth_precedence.py +0 -0
  83. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_caller_assertions.py +0 -0
  84. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_caller_context.py +0 -0
  85. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_canonical_api_route_contract.py +0 -0
  86. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_cli_auth_contract.py +0 -0
  87. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_cli_browser_auth.py +0 -0
  88. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_cli_request_budget.py +0 -0
  89. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_cli_secure_storage.py +0 -0
  90. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_client.py +0 -0
  91. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_code_repository_branch_contract.py +0 -0
  92. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_code_repository_documentation_contract.py +0 -0
  93. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_code_repository_runtime_context.py +0 -0
  94. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_code_repository_skills.py +0 -0
  95. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_credential_repr.py +0 -0
  96. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_dependency_extras.py +0 -0
  97. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_dev_release_version.py +0 -0
  98. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_environment_resource_context.py +0 -0
  99. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_environment_response_contracts.py +0 -0
  100. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_fastapi_mcp.py +0 -0
  101. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_fastapi_request_identity.py +0 -0
  102. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_github_issues_client.py +0 -0
  103. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_http_retry_budget.py +0 -0
  104. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_independent_context.py +0 -0
  105. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_inference_client.py +0 -0
  106. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_instrumentation.py +0 -0
  107. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_local_caller_cache.py +0 -0
  108. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_local_ops.py +0 -0
  109. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_logconf.py +0 -0
  110. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_mcp_skills.py +0 -0
  111. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_models_user_request_bound_auth.py +0 -0
  112. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_notification_uid_contract.py +0 -0
  113. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_object_access_client.py +0 -0
  114. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_observability_client.py +0 -0
  115. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_runtime_credential_exchange.py +0 -0
  116. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_scaffold_skills.py +0 -0
  117. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_secret_client_model.py +0 -0
  118. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_source_ownership.py +0 -0
  119. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_ssh_utils.py +0 -0
  120. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_team_memberships.py +0 -0
  121. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_tolerant_response_reading.py +0 -0
  122. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_tolerant_value_sets.py +0 -0
  123. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_user_application_facts.py +0 -0
  124. {mainsequence-9.0.40 → mainsequence-9.0.41.dev92}/tests/test_workload_identity.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mainsequence
3
- Version: 9.0.40
3
+ Version: 9.0.41.dev92
4
4
  Summary: Main Sequence SDK
5
5
  Author-email: Main Sequence GmbH <dev@main-sequence.io>
6
6
  License-Expression: MIT
@@ -494,7 +494,7 @@ Verify that:
494
494
  - Django resolved and built the exact image for the workflow event
495
495
  - the resulting release kind is `fastapi`
496
496
  - any declared `public_ingress` pair matches a mounted FastAPI handler
497
- - compute and spot settings are intentional
497
+ - compute settings are intentional
498
498
 
499
499
  Enable automatic deployment in the repository workflow when the route paths,
500
500
  resource path, and frontend contracts are stable enough for future repository
@@ -105,8 +105,8 @@ Before changing access or advising on it, collect or infer:
105
105
  `operator`, `editor` or `owner`
106
106
  - for a `ResourceRelease`, which is decided by policies: `viewer`, `user`,
107
107
  `editor` or `owner`
108
- - for a `Job`, which is decided by policies: `viewer`, `runner`, `editor` or
109
- `owner`
108
+ - for a `Job`, which is decided by policies: `viewer`, `runner`,
109
+ `sized_runner`, `editor` or `owner`
110
110
  - for a model-provider credential or a custom model provider, which are
111
111
  decided by policies: `user`, `editor` or `owner`
112
112
  - whether the goal is:
@@ -130,8 +130,8 @@ For every non-trivial access task, decide:
130
130
  `CodeRepository`, a `CodeRepositoryBranch` or an `OrganizationProject`, `reader`, `editor` or
131
131
  `owner`; on an `Agent`, `viewer`, `user`, `operator`, `editor` or `owner`; on a
132
132
  `ResourceRelease`, `viewer`, `user`, `editor` or `owner`; on a `Job`, `viewer`, `runner`,
133
- `editor` or `owner`; on a model-provider credential or a custom model provider, `user`,
134
- `editor` or `owner`?
133
+ `sized_runner`, `editor` or `owner`; on a model-provider credential or a custom model
134
+ provider, `user`, `editor` or `owner`?
135
135
  4. Is this configuration non-sensitive or sensitive?
136
136
  5. Is the task really an access problem, or is it actually an orchestration or implementation problem?
137
137
  6. Is the task creating a `Constant` or `Secret` by name, and does that name already exist?
@@ -303,15 +303,17 @@ A `ResourceRelease` and a `Job` are decided by their policies:
303
303
  configuration, activates static deployments, deletes it and manages what its
304
304
  workload can reach; `owner` also decides who has access;
305
305
  - on a Job, `viewer` sees it, its runs, logs and outputs; `runner` also runs
306
- it and stops its runs; `editor` also changes and deletes it and manages what
307
- its workload can reach; `owner` also decides who has access.
306
+ it and stops its runs; `sized_runner` also chooses each run's CPU, memory
307
+ and GPUs, without changing the Job; `editor` also changes and deletes it and
308
+ manages what its workload can reach; `owner` also decides who has access.
308
309
 
309
310
  A release that backs no Agent and a standalone Job also take the policies of
310
311
  their branch: branch `reader` gives `viewer`, and `editor` and `owner` give
311
312
  `editor`. A release's backing Job follows the release and is changed, run and
312
313
  deleted with it. Give
313
314
  `user` on a release to the people who only call it, and `runner` on a Job to
314
- the people who run it without changing it. Use the access methods on
315
+ the people who run it without changing it, or `sized_runner` when they also
316
+ choose a run's CPU, memory and GPUs. Use the access methods on
315
317
  `ResourceRelease` and `Job`, or `mainsequence code-repository resources access
316
318
  list|grant|revoke|explain` and `mainsequence code-repository jobs access
317
319
  list|grant|revoke|explain`. A repository workflow file's `access` entry for a
@@ -441,7 +443,8 @@ User: give it the policies it needs as you would a person, a reading or using
441
443
  policy unless it must maintain the object. A `Constant` it reads needs
442
444
  `reader`, a `Secret` whose value it reads needs `value_reader`, a `Bucket` it
443
445
  uploads Artifacts into needs `contributor`, an `Artifact` it reads needs
444
- `viewer`, a release it calls needs `user`, a `Job` it runs needs `runner`, an
446
+ `viewer`, a release it calls needs `user`, a `Job` it runs needs `runner`, or
447
+ `sized_runner` when it chooses a run's CPU, memory or GPUs, an
445
448
  `Agent` it gives Tasks to needs `user`, and a model-provider credential or a
446
449
  custom model provider it sends requests through needs `user`. These grants
447
450
  cover every call the application makes for itself.
@@ -577,7 +580,7 @@ Do not claim success until you have checked:
577
580
  - `viewer`, `editor` or `owner` on an `Artifact`
578
581
  - `viewer`, `user`, `operator`, `editor` or `owner` on an `Agent`
579
582
  - `viewer`, `user`, `editor` or `owner` on a `ResourceRelease`
580
- - `viewer`, `runner`, `editor` or `owner` on a `Job`
583
+ - `viewer`, `runner`, `sized_runner`, `editor` or `owner` on a `Job`
581
584
  - `user`, `editor` or `owner` on a model-provider credential or a custom
582
585
  model provider
583
586
  - the task is using `Constant` vs `Secret` correctly
@@ -126,6 +126,8 @@ Use the standard CLI execution loop when execution success matters:
126
126
  manual per-run arguments, including values that start with `-`
127
127
  - `mainsequence code-repository jobs run <JOB_UID> -- <ARG>...` for manual
128
128
  passthrough arguments
129
+ - `mainsequence code-repository jobs run <JOB_UID> --cpu-request <VCPU> --memory-request <GIB>`
130
+ to size one manual run without changing the Job
129
131
  - `mainsequence code-repository jobs runs list <JOB_UID>`
130
132
  - `mainsequence code-repository jobs runs logs <JOB_RUN_UID> --max-wait-seconds 900`
131
133
 
@@ -146,6 +148,41 @@ Treat each argument as one opaque argv string. Do not join arguments into a
146
148
  shell command, and do not treat `command_args` as a replacement for the saved
147
149
  Job entrypoint.
148
150
 
151
+ A manual run can name its own compute. It sizes that run only: the Job is not
152
+ changed, and its other runs keep the Job's values.
153
+
154
+ ```python
155
+ run_payload = job.run_job(
156
+ command_args=["--family", "jobs"],
157
+ cpu_request="8",
158
+ memory_request="52",
159
+ )
160
+ run = JobRun.get_by_uid(run_payload["job_run_uid"])
161
+ ```
162
+
163
+ - The fields are `cpu_request`, `memory_request`, `gpu_request` and `gpu_type`;
164
+ on the CLI, `--cpu-request`, `--memory-request`, `--gpu-request` and
165
+ `--gpu-type`. One left out takes the Job's value.
166
+ - `cpu_request` is a decimal number of vCPU with at most two places, from 0.25
167
+ to 30. `memory_request` is a decimal number of GiB, from 0.5 to 110, and from
168
+ 1 to 6.5 times the CPU. CPU and memory go together. `gpu_request` is 1 to 8
169
+ and needs a `gpu_type` the Job's cluster offers.
170
+ - Write plain decimal numbers, not Kubernetes quantities such as `500m` or
171
+ `1Gi`. The platform checks the values; the SDK does not. A refused set raises
172
+ `BadRequestError` with the errors by field and starts no run.
173
+ - Naming any of the four needs the Job's `run_sized` action, which the policies
174
+ `sized_runner`, `editor` and `owner` hold and `runner` does not. Without it
175
+ the call raises `PermissionDeniedError` with code `missing_action`. Do not
176
+ work around it by changing the Job; ask for `sized_runner`.
177
+ - The answer stays `message` and `job_run_uid`. Read the compute the run got
178
+ from the `JobRun`: `cpu_request`, `memory_request`, `gpu_request`,
179
+ `gpu_type`.
180
+ - `timeout` on `run_job()` and `--timeout` on the CLI are the HTTP request
181
+ timeout, not a limit on the run.
182
+
183
+ Spot capacity is not offered: `spot` on a Job and on a release is always
184
+ false, and the platform refuses `spot: true`. Do not set it.
185
+
149
186
  Current support matrix:
150
187
 
151
188
  | Invocation | Argument support |
@@ -3345,13 +3345,18 @@ def run_code_repository_job(
3345
3345
  job_uid: str,
3346
3346
  *,
3347
3347
  command_args: list[str] | None = None,
3348
+ cpu_request: str | None = None,
3349
+ memory_request: str | None = None,
3350
+ gpu_request: str | None = None,
3351
+ gpu_type: str | None = None,
3348
3352
  timeout: int | None = None,
3349
3353
  ) -> dict[str, Any]:
3350
3354
  """
3351
3355
  Run a CodeRepository job via the SDK client model.
3352
3356
 
3353
3357
  Single source of truth:
3354
- - delegates request behavior to `Job.run_job()`
3358
+ - delegates request behavior to `Job.run_job()`, which sends the per-run
3359
+ compute fields only when they are given
3355
3360
  """
3356
3361
  tokens = get_tokens()
3357
3362
  access = (tokens.get("access") or "").strip()
@@ -3399,7 +3404,14 @@ def run_code_repository_job(
3399
3404
  ClientJob.ROOT_URL = root_url
3400
3405
 
3401
3406
  job = ClientJob.get_by_uid(str(job_uid), timeout=timeout)
3402
- payload = job.run_job(timeout=timeout, command_args=command_args)
3407
+ payload = job.run_job(
3408
+ timeout=timeout,
3409
+ command_args=command_args,
3410
+ cpu_request=cpu_request,
3411
+ memory_request=memory_request,
3412
+ gpu_request=gpu_request,
3413
+ gpu_type=gpu_type,
3414
+ )
3403
3415
  effective_tokens: list[str] = []
3404
3416
  execution_path = str(getattr(job, "execution_path", "") or "").strip()
3405
3417
  if execution_path:
@@ -6740,6 +6740,26 @@ def code_repository_jobs_run_cmd(
6740
6740
  "--arg",
6741
6741
  help="Append one per-run arg to the saved job entrypoint. Repeatable. Does not replace the saved execution_path.",
6742
6742
  ),
6743
+ cpu_request: str | None = typer.Option(
6744
+ None,
6745
+ "--cpu-request",
6746
+ help="vCPU for this run only, a decimal from 0.25 to 30 such as 8 or 0.5. Default: the Job's value.",
6747
+ ),
6748
+ memory_request: str | None = typer.Option(
6749
+ None,
6750
+ "--memory-request",
6751
+ help="Memory in GiB for this run only, a decimal from 0.5 to 110 and 1 to 6.5 times the run's CPU. Default: the Job's value.",
6752
+ ),
6753
+ gpu_request: str | None = typer.Option(
6754
+ None,
6755
+ "--gpu-request",
6756
+ help="GPUs for this run only, 1 to 8. Needs a GPU type, from --gpu-type or the Job. Default: the Job's value.",
6757
+ ),
6758
+ gpu_type: str | None = typer.Option(
6759
+ None,
6760
+ "--gpu-type",
6761
+ help="GPU accelerator type for this run only, one the Job's cluster offers. Default: the Job's value.",
6762
+ ),
6743
6763
  timeout: int | None = typer.Option(None, "--timeout", help="Request timeout in seconds"),
6744
6764
  ):
6745
6765
  """
@@ -6748,12 +6768,20 @@ def code_repository_jobs_run_cmd(
6748
6768
  Uses SDK client `Job.run_job()` as the single source of truth.
6749
6769
  Per-run args are appended to the saved job entrypoint; they do not replace it.
6750
6770
 
6771
+ The compute options size this run only and leave the Job unchanged; an
6772
+ option left out takes the Job's value. The platform checks the values and
6773
+ starts no run when it refuses them. Passing one needs the Job's run_sized
6774
+ action, which the policies sized_runner, editor and owner hold and runner
6775
+ does not. The compute a run got is on the run, not in this command's
6776
+ answer.
6777
+
6751
6778
  Examples
6752
6779
  --------
6753
6780
  ```bash
6754
6781
  mainsequence code-repository jobs run <JOB_UID>
6755
6782
  mainsequence code-repository jobs run <JOB_UID> --arg demo-from-cli
6756
6783
  mainsequence code-repository jobs run <JOB_UID> -- --name demo-from-cli
6784
+ mainsequence code-repository jobs run <JOB_UID> --cpu-request 8 --memory-request 52
6757
6785
  mainsequence code-repository jobs run <JOB_UID> --timeout 60
6758
6786
  ```
6759
6787
  """
@@ -6779,6 +6807,10 @@ def code_repository_jobs_run_cmd(
6779
6807
  payload = run_code_repository_job(
6780
6808
  job_uid=job_uid,
6781
6809
  command_args=merged_command_args or None,
6810
+ cpu_request=cpu_request,
6811
+ memory_request=memory_request,
6812
+ gpu_request=gpu_request,
6813
+ gpu_type=gpu_type,
6782
6814
  timeout=timeout,
6783
6815
  )
6784
6816
  except ApiError as e:
@@ -6923,11 +6955,12 @@ def code_repository_jobs_access_grant_cmd(
6923
6955
  Give a policy on one Job to a person, a workload identity or a team.
6924
6956
 
6925
6957
  The policies are viewer (sees the Job, its schedule, runs, logs and
6926
- outputs), runner (also runs it and stops its runs), editor (also changes
6927
- and deletes it and manages what its workload can reach) and owner. Pass
6928
- exactly one of --user or --team. It needs the Job's manage_access action,
6929
- which owner holds, and every action of the policy. `mainsequence access
6930
- policies --type jobs` lists the policies.
6958
+ outputs), runner (also runs it and stops its runs), sized_runner (also
6959
+ chooses each run's CPU, memory and GPUs), editor (also changes and deletes
6960
+ it and manages what its workload can reach) and owner. Pass exactly one of
6961
+ --user or --team. It needs the Job's manage_access action, which owner
6962
+ holds, and every action of the policy. `mainsequence access policies
6963
+ --type jobs` lists the policies.
6931
6964
 
6932
6965
  Examples
6933
6966
  --------
@@ -164,13 +164,14 @@ class Job(
164
164
 
165
165
  Who may use a Job is decided by its policies: `viewer` sees the Job, its
166
166
  schedule, runs, logs and outputs, including the Artifacts its runs
167
- published; `runner` also runs it and stops its runs; `editor` also changes
168
- it (name, description, resources, schedule, arguments, image), reports a
169
- run's status and outputs by hand, deletes it, manages what its workload can
170
- reach and sees who has access; `owner` also decides who has access. The
171
- Job's creator holds `owner`, except the Organization's automation identity,
172
- which creates the Jobs of repository workflows, and Organization admins hold
173
- every action.
167
+ published; `runner` also runs it and stops its runs; `sized_runner` also
168
+ chooses each run's CPU, memory and GPUs, without changing the Job; `editor`
169
+ also changes it (name, description, resources, schedule, arguments, image),
170
+ reports a run's status and outputs by hand, deletes it, manages what its
171
+ workload can reach and sees who has access; `owner` also decides who has
172
+ access. The Job's creator holds `owner`, except the Organization's
173
+ automation identity, which creates the Jobs of repository workflows, and
174
+ Organization admins hold every action.
174
175
 
175
176
  A Job also takes the policies held above it. A standalone Job takes its
176
177
  branch's: `reader` on the branch gives `viewer`, and `editor` or `owner`
@@ -328,8 +329,11 @@ class Job(
328
329
 
329
330
  spot: bool = Field(
330
331
  default=False,
331
- description="Whether the job should prefer spot or preemptible capacity.",
332
- examples=[False, True],
332
+ description=(
333
+ "Always false. Spot capacity is not offered, and the API refuses "
334
+ "`spot: true`."
335
+ ),
336
+ examples=[False],
333
337
  )
334
338
 
335
339
  max_runtime_seconds: int | None = Field(
@@ -391,11 +395,46 @@ class Job(
391
395
  *,
392
396
  timeout: int | None = None,
393
397
  command_args: list[str] | None = None,
398
+ cpu_request: str | int | float | None = None,
399
+ memory_request: str | int | float | None = None,
400
+ gpu_request: str | int | None = None,
401
+ gpu_type: str | None = None,
394
402
  ) -> dict[str, Any]:
395
- """Start a manual run with optional opaque argv entries.
403
+ """Start a manual run, with optional argv entries and compute for this run.
396
404
 
397
405
  ``command_args`` applies only to this run. It does not configure
398
406
  arguments for scheduler-created runs.
407
+
408
+ ``cpu_request``, ``memory_request``, ``gpu_request`` and ``gpu_type``
409
+ size this run only; the Job is not changed. A field left out, or
410
+ ``None``, takes the Job's value. The API checks the resulting set:
411
+
412
+ - ``cpu_request`` is a decimal number of vCPU with at most two places,
413
+ from 0.25 to 30, for example ``"8"`` or ``0.5``;
414
+ - ``memory_request`` is a decimal number of GiB, from 0.5 to 110, and
415
+ from 1 to 6.5 times the CPU;
416
+ - CPU and memory go together: a run has both or neither;
417
+ - ``gpu_request`` is a whole number from 1 to 8 and needs a
418
+ ``gpu_type`` the Job's cluster offers.
419
+
420
+ The values are sent as given and the SDK does not check them. A set the
421
+ API refuses raises ``BadRequestError``, whose ``payload`` holds the
422
+ errors by field, and no run starts.
423
+
424
+ Running a Job needs its ``runner`` policy or more. A call that passes
425
+ one of the four compute fields also needs the Job's ``run_sized``
426
+ action, which the policies ``sized_runner``, ``editor`` and ``owner``
427
+ hold and ``runner`` does not; without it the call raises
428
+ ``PermissionDeniedError``, whose ``payload`` carries the code
429
+ ``missing_action``, and no run starts.
430
+
431
+ ``timeout`` is the timeout of this HTTP request in seconds, not a limit
432
+ on the run.
433
+
434
+ Returns the API's answer, with ``message`` and ``job_run_uid``. The
435
+ compute the run got is on the run: read ``cpu_request``,
436
+ ``memory_request``, ``gpu_request`` and ``gpu_type`` from
437
+ ``JobRun.get_by_uid(job_run_uid)``.
399
438
  """
400
439
  job_uid = self._public_detail_reference()
401
440
  if command_args is not None:
@@ -407,9 +446,20 @@ class Job(
407
446
  url = f"{self.get_object_url()}/{job_uid}/run-job/"
408
447
  s = self.build_session()
409
448
 
410
- payload: dict[str, Any] = {}
449
+ body: dict[str, Any] = {}
411
450
  if command_args is not None:
412
- payload["json"] = {"command_args": list(command_args)}
451
+ body["command_args"] = list(command_args)
452
+ run_compute = {
453
+ "cpu_request": cpu_request,
454
+ "memory_request": memory_request,
455
+ "gpu_request": gpu_request,
456
+ "gpu_type": gpu_type,
457
+ }
458
+ body.update({field: value for field, value in run_compute.items() if value is not None})
459
+
460
+ payload: dict[str, Any] = {}
461
+ if body:
462
+ payload["json"] = body
413
463
 
414
464
  r = make_request(
415
465
  s=s,
@@ -1271,8 +1321,11 @@ class ResourceRelease(
1271
1321
  spot: bool = Field(
1272
1322
  default=False,
1273
1323
  title="Spot",
1274
- description="Whether the release should prefer spot or preemptible capacity.",
1275
- examples=[False, True],
1324
+ description=(
1325
+ "Always false. Spot capacity is not offered, and the API refuses "
1326
+ "`spot: true`."
1327
+ ),
1328
+ examples=[False],
1276
1329
  )
1277
1330
  automatic_deployment: bool = Field(
1278
1331
  default=False,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mainsequence
3
- Version: 9.0.40
3
+ Version: 9.0.41.dev92
4
4
  Summary: Main Sequence SDK
5
5
  Author-email: Main Sequence GmbH <dev@main-sequence.io>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mainsequence"
7
- version = "9.0.40"
7
+ version = "9.0.41.dev92"
8
8
  description = "Main Sequence SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -124,6 +124,116 @@ def test_job_run_job_posts_to_canonical_action(monkeypatch):
124
124
  }
125
125
 
126
126
 
127
+ def _run_job_and_capture_payload(monkeypatch, **run_job_kwargs):
128
+ models_helpers = _load_models_helpers_module()
129
+ Job = models_helpers.Job
130
+ captured = {}
131
+
132
+ class FakeResponse:
133
+ status_code = 202
134
+
135
+ @staticmethod
136
+ def json():
137
+ return {
138
+ "message": "Job run requested.",
139
+ "job_run_uid": "4c1d77c8-8a42-42b8-a9c1-06be9a336e5d",
140
+ }
141
+
142
+ monkeypatch.setattr(Job, "build_session", classmethod(lambda cls: object()))
143
+ monkeypatch.setattr(
144
+ Job,
145
+ "get_object_url",
146
+ classmethod(lambda cls: "https://backend.test/api/v1/jobs"),
147
+ )
148
+
149
+ def _fake_make_request(*, s, loaders, r_type, url, payload, time_out=None):
150
+ captured.update(payload=payload)
151
+ return FakeResponse()
152
+
153
+ monkeypatch.setattr(models_helpers, "make_request", _fake_make_request)
154
+
155
+ job = Job(
156
+ uid="7d0ab07c-d1c0-4b7f-9c69-3c1a41c0a4da",
157
+ name="Simulated Prices",
158
+ code_repository_branch_uid="5a28020a-0f1b-47ee-aab8-334286234bea",
159
+ execution_path="scripts/simulated_prices_launcher.py",
160
+ cpu_request="2",
161
+ memory_request="8",
162
+ related_image_uid="f3cb8477-df47-49cb-a151-80b746fb1243",
163
+ image_status="ready",
164
+ )
165
+ job.run_job(**run_job_kwargs)
166
+ return captured["payload"]
167
+
168
+
169
+ def test_job_run_job_sends_the_compute_given_for_the_run(monkeypatch):
170
+ payload = _run_job_and_capture_payload(
171
+ monkeypatch,
172
+ command_args=["--family", "jobs"],
173
+ cpu_request="8",
174
+ memory_request="52",
175
+ )
176
+
177
+ assert payload == {
178
+ "json": {
179
+ "command_args": ["--family", "jobs"],
180
+ "cpu_request": "8",
181
+ "memory_request": "52",
182
+ }
183
+ }
184
+
185
+
186
+ def test_job_run_job_sends_compute_without_command_args(monkeypatch):
187
+ payload = _run_job_and_capture_payload(
188
+ monkeypatch,
189
+ cpu_request=0.5,
190
+ memory_request=2,
191
+ gpu_request=1,
192
+ gpu_type="nvidia-l4",
193
+ )
194
+
195
+ assert payload == {
196
+ "json": {
197
+ "cpu_request": 0.5,
198
+ "memory_request": 2,
199
+ "gpu_request": 1,
200
+ "gpu_type": "nvidia-l4",
201
+ }
202
+ }
203
+
204
+
205
+ def test_job_run_job_does_not_check_the_compute_it_sends(monkeypatch):
206
+ payload = _run_job_and_capture_payload(monkeypatch, cpu_request="500m", gpu_request="9")
207
+
208
+ assert payload == {"json": {"cpu_request": "500m", "gpu_request": "9"}}
209
+
210
+
211
+ @pytest.mark.parametrize(
212
+ ("run_job_kwargs", "expected_payload"),
213
+ [
214
+ ({}, {}),
215
+ ({"command_args": ["--name", "demo"]}, {"json": {"command_args": ["--name", "demo"]}}),
216
+ ({"command_args": []}, {"json": {"command_args": []}}),
217
+ (
218
+ {
219
+ "command_args": ["--name", "demo"],
220
+ "cpu_request": None,
221
+ "memory_request": None,
222
+ "gpu_request": None,
223
+ "gpu_type": None,
224
+ },
225
+ {"json": {"command_args": ["--name", "demo"]}},
226
+ ),
227
+ ],
228
+ )
229
+ def test_job_run_job_sends_no_compute_when_none_is_given(
230
+ monkeypatch, run_job_kwargs, expected_payload
231
+ ):
232
+ payload = _run_job_and_capture_payload(monkeypatch, **run_job_kwargs)
233
+
234
+ assert payload == expected_payload
235
+
236
+
127
237
  @pytest.mark.parametrize(
128
238
  "command_args",
129
239
  ["--name demo", ("--name", "demo"), ["--name", 1]],