This is an automated email from the ASF dual-hosted git repository.

DImuthuUpe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/master by this push:
     new 0577532f25 Add Slurm partition option (#752)
0577532f25 is described below

commit 0577532f2572612ced8be2988ed747a7d68ee54a
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Fri Nov 13 14:45:05 2026 -0500

    Add Slurm partition option (#752)
    
    * Add Slurm partition option
    
    * Add partition field to dashboard
    
    * Match partition handling to QOS
    
    * Match partition to the QOS pattern
---
 api/application/dto/application.go                |  7 ++++---
 api/application/model/deployment.go               |  4 ++--
 api/application/service/service.go                |  2 --
 dashboard/src/app/applications/page.tsx           | 19 +++----------------
 dashboard/src/app/processes/new/page.tsx          |  8 ++++++--
 dashboard/src/components/BatchJobConfigFields.tsx |  7 ++++++-
 dashboard/src/lib/types.ts                        |  2 +-
 docs/api.md                                       | 20 ++++++++++----------
 docs/application.md                               |  3 +--
 docs/batch-clusters.md                            |  8 ++++----
 docs/mcp.md                                       |  2 +-
 docs/openapi.yaml                                 |  4 ++--
 internal/db/migrations/0019_slurm_partition.sql   |  9 +++++++++
 internal/mcp/client/client.gen.go                 |  4 ++--
 internal/mcp/estimate/estimate.go                 |  6 ++++--
 internal/mcp/server/server_test.go                |  8 ++++----
 internal/mcp/tools/admin/admin.go                 | 14 +++++---------
 internal/mcp/tools/applications/applications.go   | 16 +++++++---------
 internal/mcp/tools/applications/proposal.go       | 20 +++++++++++---------
 internal/mcp/tools/compute/compute.go             |  6 +++---
 internal/mcp/tools/processes/plan.go              | 17 ++++++++---------
 internal/mcp/tools/processes/processes.go         |  2 +-
 internal/orchestration/tasks/batch/slurm.go       |  2 +-
 internal/orchestration/tasks/batch/slurm_test.go  |  6 +++---
 24 files changed, 98 insertions(+), 98 deletions(-)

diff --git a/api/application/dto/application.go 
b/api/application/dto/application.go
index 10a846f47c..57b4282ac9 100644
--- a/api/application/dto/application.go
+++ b/api/application/dto/application.go
@@ -213,6 +213,7 @@ type BatchJobConfigRequest struct {
        CPUsPerGPU      *string `json:"cpusPerGpu"`
        GPUsPerNode     *int32  `json:"gpusPerNode"`
        Constraints     *string `json:"constraints"`
+       Partition       *string `json:"partition"`
        QOS             *string `json:"qos"`
 }
 
@@ -244,6 +245,7 @@ type BatchJobConfigResponse struct {
        CPUsPerGPU       *string `json:"cpusPerGpu"`
        GPUsPerNode      *int32  `json:"gpusPerNode"`
        Constraints      *string `json:"constraints"`
+       Partition        *string `json:"partition"`
        QOS              *string `json:"qos"`
 }
 
@@ -267,6 +269,7 @@ func ApplyBatchJobConfigRequest(dst *model.BatchJobConfig, 
src *BatchJobConfigRe
        dst.CPUsPerGPU = src.CPUsPerGPU
        dst.GPUsPerNode = src.GPUsPerNode
        dst.Constraints = src.Constraints
+       dst.Partition = src.Partition
        dst.QOS = src.QOS
 }
 
@@ -292,6 +295,7 @@ func ToBatchJobConfigResponse(c *model.BatchJobConfig) 
*BatchJobConfigResponse {
                CPUsPerGPU:       c.CPUsPerGPU,
                GPUsPerNode:      c.GPUsPerNode,
                Constraints:      c.Constraints,
+               Partition:        c.Partition,
                QOS:              c.QOS,
        }
 }
@@ -308,7 +312,6 @@ type BatchDeploymentRequest struct {
        // carries its own copy and may depart from both, so these are defaults 
rather than
        // what any particular job is submitted with.
        DefaultBatchJobConfig *BatchJobConfigRequest 
`json:"defaultBatchJobConfig"`
-       DefaultPartition      *string                `json:"defaultPartition"`
 }
 
 // Validate implements httpx.Validator.
@@ -333,7 +336,6 @@ type BatchDeploymentResponse struct {
        SlurmClusterID        *string                 `json:"slurmClusterId"`
        SlurmRunSection       string                  `json:"slurmRunSection"`
        DefaultBatchJobConfig *BatchJobConfigResponse 
`json:"defaultBatchJobConfig"`
-       DefaultPartition      *string                 `json:"defaultPartition"`
 }
 
 func ToBatchDeploymentResponse(d *model.BatchDeployment) 
BatchDeploymentResponse {
@@ -343,7 +345,6 @@ func ToBatchDeploymentResponse(d *model.BatchDeployment) 
BatchDeploymentResponse
                SlurmClusterID:        d.ClusterID,
                SlurmRunSection:       d.SlurmRunSection,
                DefaultBatchJobConfig: 
ToBatchJobConfigResponse(d.DefaultBatchJobConfig),
-               DefaultPartition:      d.DefaultPartition,
        }
 }
 
diff --git a/api/application/model/deployment.go 
b/api/application/model/deployment.go
index 5d806c8357..5a56d0dc6d 100644
--- a/api/application/model/deployment.go
+++ b/api/application/model/deployment.go
@@ -64,6 +64,8 @@ type BatchJobConfig struct {
        QOS *string `gorm:"column:qos;type:varchar(255)" json:"qos,omitempty"`
 
        Allocation string `gorm:"column:allocation;type:varchar(255);not null" 
json:"allocation"`
+
+       Partition *string `gorm:"column:partition;type:varchar(255)" 
json:"partition,omitempty"`
 }
 
 // TableName returns the table backing BatchJobConfig.
@@ -107,8 +109,6 @@ type BatchDeployment struct {
        // depart from it, which is why the run's snapshot is what a job is 
submitted with.
        DefaultBatchJobConfigID string          
`gorm:"column:default_batch_job_config_id;type:varchar(36);not 
null;uniqueIndex" json:"defaultBatchJobConfigId"`
        DefaultBatchJobConfig   *BatchJobConfig 
`gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" 
json:"defaultBatchJobConfig,omitempty"`
-
-       DefaultPartition *string 
`gorm:"column:default_partition;type:varchar(255)" 
json:"defaultPartition,omitempty"`
 }
 
 // TableName returns the table backing BatchDeployment.
diff --git a/api/application/service/service.go 
b/api/application/service/service.go
index 00fd2c3605..4354eefe61 100644
--- a/api/application/service/service.go
+++ b/api/application/service/service.go
@@ -259,7 +259,6 @@ func (s *BatchDeploymentService) Create(ctx 
context.Context, req *dto.BatchDeplo
                        SlurmRunSection:         req.SlurmRunSection,
                        DefaultBatchJobConfigID: config.ID,
                        DefaultBatchJobConfig:   config,
-                       DefaultPartition:        req.DefaultPartition,
                }
                if err := deployments.Save(ctx, deployment); err != nil {
                        return err
@@ -307,7 +306,6 @@ func (s *BatchDeploymentService) Update(ctx 
context.Context, id string, req *dto
                deployment.SlurmRunSection = req.SlurmRunSection
                deployment.DefaultBatchJobConfigID = config.ID
                deployment.DefaultBatchJobConfig = config
-               deployment.DefaultPartition = req.DefaultPartition
 
                if err := deployments.Save(ctx, deployment); err != nil {
                        return err
diff --git a/dashboard/src/app/applications/page.tsx 
b/dashboard/src/app/applications/page.tsx
index 3c146ec7fd..158035a668 100644
--- a/dashboard/src/app/applications/page.tsx
+++ b/dashboard/src/app/applications/page.tsx
@@ -377,7 +377,7 @@ function Deployments() {
             },
             { header: "ID", cell: (d) => <Id value={d.deploymentId} /> },
             { header: "Cluster", cell: (d) => clusterName(d.slurmClusterId) },
-            { header: "Partition", cell: (d) => d.defaultPartition ?? "—" },
+            { header: "Partition", cell: (d) => 
d.defaultBatchJobConfig?.partition ?? "—" },
             {
               header: "Defaults",
               cell: (d) =>
@@ -435,8 +435,6 @@ function Deployments() {
               </dd>
               <dt>Cluster</dt>
               <dd>{clusterName(viewing.slurmClusterId)}</dd>
-              <dt>Default partition</dt>
-              <dd>{viewing.defaultPartition ?? "—"}</dd>
             </dl>
             <h3>Slurm run section</h3>
             <pre className="block">{viewing.slurmRunSection}</pre>
@@ -464,12 +462,10 @@ function DeploymentEditor({
 }) {
   const [templateId, setTemplateId] = useState(deployment?.templateId ?? "");
   const [clusterId, setClusterId] = useState(deployment?.slurmClusterId ?? "");
-  const [partition, setPartition] = useState(deployment?.defaultPartition ?? 
"");
   const [runSection, setRunSection] = useState(deployment?.slurmRunSection ?? 
"");
   const [config, setConfig] = useState<BatchJobConfigDraft>(() =>
     draftFrom(deployment?.defaultBatchJobConfig ?? { wallTimeMinutes: 60, 
allocation: "" }),
   );
-  const partitions = clusters.find((c) => c.slurmClusterId === 
clusterId)?.partitions ?? [];
   const template = templates.find((t) => t.templateId === templateId);
 
   // Allocations are discovered under one of the caller's logins on the chosen 
cluster;
@@ -491,7 +487,6 @@ function DeploymentEditor({
       templateId,
       slurmClusterId: strOrNull(clusterId),
       slurmRunSection: runSection,
-      defaultPartition: strOrNull(partition),
       defaultBatchJobConfig: toBatchJobConfig(config),
     };
     if (deployment) await 
api.put(`/api/v1/slurm-deployments/${deployment.deploymentId}`, body);
@@ -530,7 +525,7 @@ function DeploymentEditor({
               value={clusterId}
               onChange={(e) => {
                 setClusterId(e.target.value);
-                setPartition("");
+                setConfig((c) => ({ ...c, partition: "" }));
               }}
             >
               <option value="">Select…</option>
@@ -541,14 +536,6 @@ function DeploymentEditor({
               ))}
             </select>
           </Field>
-          <Field label="Default partition" hint="optional">
-            <select value={partition} onChange={(e) => 
setPartition(e.target.value)} disabled={!partitions.length}>
-              <option value="">None</option>
-              {partitions.map((p) => (
-                <option key={p.partitionId ?? p.name}>{p.name}</option>
-              ))}
-            </select>
-          </Field>
         </div>
         <Field
           label="Slurm run section"
@@ -583,9 +570,9 @@ function DeploymentEditor({
             <BatchJobConfigFields
               value={config}
               onChange={setConfig}
+              partitions={clusters.find((c) => c.slurmClusterId === 
clusterId)?.partitions.map((p) => p.name)}
               discover={{
                 configId: discoverWith,
-                partition: strOrNull(partition),
                 hint: !clusterId
                   ? "Choose a cluster to discover its allocations."
                   : clusterLogins.length === 0
diff --git a/dashboard/src/app/processes/new/page.tsx 
b/dashboard/src/app/processes/new/page.tsx
index c7ddd341bd..a2b06b2003 100644
--- a/dashboard/src/app/processes/new/page.tsx
+++ b/dashboard/src/app/processes/new/page.tsx
@@ -20,6 +20,7 @@ import {
   type InputType,
   type Process,
   type SCPDataStorage,
+  type SlurmCluster,
   type SlurmClusterConfig,
   type TemplateInput,
   type TemplateOutput,
@@ -62,6 +63,9 @@ export default function NewProcessPage() {
     return [...mine, ...shared];
   });
 
+  const clusters = useResource(() => 
api.get<SlurmCluster[]>("/api/v1/slurm-clusters"));
+  const cluster = (d?: BatchDeployment) => clusters.data?.find((c) => 
c.slurmClusterId === d?.slurmClusterId);
+
   const [deploymentId, setDeploymentId] = useState("");
   const [configId, setConfigId] = useState("");
   const [baseWorkDir, setBaseWorkDir] = useState("");
@@ -210,7 +214,7 @@ export default function NewProcessPage() {
               {deployments.data?.map((d) => (
                 <option key={d.deploymentId} value={d.deploymentId}>
                   {names.appName(d.deploymentId) ?? d.deploymentId}
-                  {d.defaultPartition ? ` (${d.defaultPartition})` : ""}
+                  {cluster(d)?.clusterName ? ` — ${cluster(d)?.clusterName}` : 
""}
                 </option>
               ))}
             </select>
@@ -265,9 +269,9 @@ export default function NewProcessPage() {
             <BatchJobConfigFields
               value={jobConfig}
               onChange={setJobConfig}
+              partitions={cluster(deployment)?.partitions.map((p) => p.name)}
               discover={{
                 configId: configId || null,
-                partition: deployment?.defaultPartition,
                 hint: "Choose a cluster config above to discover the 
allocations it may charge.",
               }}
             />
diff --git a/dashboard/src/components/BatchJobConfigFields.tsx 
b/dashboard/src/components/BatchJobConfigFields.tsx
index cab65ade2b..fb9a0c077f 100644
--- a/dashboard/src/components/BatchJobConfigFields.tsx
+++ b/dashboard/src/components/BatchJobConfigFields.tsx
@@ -13,6 +13,7 @@ const NUMERIC = new Set(["wallTimeMinutes", "cpus", 
"ntasksPerNode", "cpusPerTas
 
 const FIELDS: { key: keyof BatchJobConfigDraft; label: string; placeholder?: 
string }[] = [
   { key: "allocation", label: "Allocation (account)" },
+  { key: "partition", label: "Partition", placeholder: "default" },
   { key: "wallTimeMinutes", label: "Wall time (minutes)" },
   { key: "nodes", label: "Nodes" },
   { key: "ntasks", label: "Tasks" },
@@ -63,10 +64,12 @@ export function BatchJobConfigFields({
   value,
   onChange,
   discover,
+  partitions,
 }: {
   value: BatchJobConfigDraft;
   onChange: (v: BatchJobConfigDraft) => void;
   discover?: AllocationDiscovery;
+  partitions?: string[];
 }) {
   return (
     <div className="form-grid">
@@ -74,7 +77,7 @@ export function BatchJobConfigFields({
         <AllocationField
           value={value.allocation}
           onChange={(allocation) => onChange({ ...value, allocation })}
-          discover={discover}
+          discover={{ ...discover, partition: value.partition }}
         />
       )}
       {FIELDS.filter((f) => !(discover && f.key === "allocation")).map((f) => (
@@ -83,10 +86,12 @@ export function BatchJobConfigFields({
             type={NUMERIC.has(f.key) ? "number" : "text"}
             value={value[f.key]}
             placeholder={f.placeholder}
+            list={f.key === "partition" ? "job-partitions" : undefined}
             onChange={(e) => onChange({ ...value, [f.key]: e.target.value })}
           />
         </Field>
       ))}
+      <datalist id="job-partitions">{partitions?.map((p) => <option key={p} 
value={p} />)}</datalist>
     </div>
   );
 }
diff --git a/dashboard/src/lib/types.ts b/dashboard/src/lib/types.ts
index 1f0e3c4f7f..0c38a967d5 100644
--- a/dashboard/src/lib/types.ts
+++ b/dashboard/src/lib/types.ts
@@ -277,6 +277,7 @@ export interface BatchJobConfig {
   cpusPerGpu?: string | null;
   gpusPerNode?: number | null;
   constraints?: string | null;
+  partition?: string | null;
   qos?: string | null;
 }
 
@@ -286,7 +287,6 @@ export interface BatchDeployment {
   slurmClusterId: string | null;
   slurmRunSection: string;
   defaultBatchJobConfig: BatchJobConfig | null;
-  defaultPartition: string | null;
 }
 
 // Data
diff --git a/docs/api.md b/docs/api.md
index f65f7cdd77..dabdf6299e 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -1244,9 +1244,9 @@ DEPLOYMENT_ID=$(curl -s -X POST 
localhost:9095/api/v1/slurm-deployments \
       "nodes": 1,
       "ntasks": 1,
       "gres": "gpu:1",
-      "gpus": 1
-    },
-    "defaultPartition": "gpu"
+      "gpus": 1,
+      "partition": "gpu"
+    }
   }' | jq -r '.deploymentId')
 ```
 
@@ -1273,8 +1273,8 @@ DEPLOYMENT_ID=$(curl -s -X POST 
localhost:9095/api/v1/slurm-deployments \
 | `defaultBatchJobConfig.cpusPerGpu` | string \| null | optional |
 | `defaultBatchJobConfig.gpusPerNode` | integer \| null | optional |
 | `defaultBatchJobConfig.constraints` | string \| null | optional |
+| `defaultBatchJobConfig.partition` | string \| null | optional |
 | `defaultBatchJobConfig.qos` | string \| null | optional |
-| `defaultPartition` | string \| null | optional |
 
 ```json
 {
@@ -1289,9 +1289,9 @@ DEPLOYMENT_ID=$(curl -s -X POST 
localhost:9095/api/v1/slurm-deployments \
     "nodes": 1,
     "ntasks": 1,
     "gres": "gpu:1",
-    "gpus": 1
-  },
-  "defaultPartition": "gpu"
+    "gpus": 1,
+    "partition": "gpu"
+  }
 }
 ```
 
@@ -1321,9 +1321,9 @@ DEPLOYMENT_ID=$(curl -s -X POST 
localhost:9095/api/v1/slurm-deployments \
     "memPerGpu": null,
     "cpusPerGpu": null,
     "gpusPerNode": null,
-    "constraints": null
-  },
-  "defaultPartition": "gpu"
+    "constraints": null,
+    "partition": "gpu"
+  }
 }
 ```
 
diff --git a/docs/application.md b/docs/application.md
index 6c48296127..af5fcecd97 100644
--- a/docs/application.md
+++ b/docs/application.md
@@ -117,8 +117,7 @@ A deployment makes a template runnable on one compute 
resource. For the Slurm ba
 | `templateId` | The template being deployed. |
 | `slurmClusterId` | The cluster it runs on. This names only the machine. The 
account and SSH key a run submits under come from a [cluster 
config](api.md#slurm-cluster-configs) that the run chooses. |
 | `slurmRunSection` | The commands that run the application: module loads, the 
program invocation and any cleanup. It is a Jinja template 
([pongo2](https://github.com/flosch/pongo2)). |
-| `defaultBatchJobConfig` | The resource request a run starts from: wall time, 
allocation, nodes, CPUs, memory, GPUs, constraints and QOS. A run copies it and 
may change any of it. |
-| `defaultPartition` | The Slurm partition to submit to. |
+| `defaultBatchJobConfig` | The resource request a run starts from: wall time, 
allocation, partition, nodes, CPUs, memory, GPUs, constraints and QOS. A run 
copies it and may change any of it. |
 
 ### The run section
 
diff --git a/docs/batch-clusters.md b/docs/batch-clusters.md
index 6fd5a0ed74..d19eadc016 100644
--- a/docs/batch-clusters.md
+++ b/docs/batch-clusters.md
@@ -42,7 +42,7 @@ A partition records one Slurm partition's limits and 
defaults. Clients use them
 
 | Field | Unit | Meaning |
 |---|---|---|
-| `name` | | The Slurm partition name, e.g. `gpu`. Required. A deployment's 
`defaultPartition` refers to a partition by this name. |
+| `name` | | The Slurm partition name, e.g. `gpu`. Required. A job config's 
`partition` refers to a partition by this name. |
 | `description` | | Free text. |
 | `maxRunTime` | minutes | The longest wall time a job may request. |
 | `defaultWalltime` | minutes | The wall time a job gets if it asks for none. |
@@ -130,7 +130,7 @@ The account a job is charged to (`allocation`, the Slurm 
account) is also detect
 - `sacctmgr -nP show associations where user=<loginUser> 
format=Account,Partition,QOS`
 - `sshare -h -P -U -u <loginUser> -o Account` if `sacctmgr` is closed to 
ordinary users. This lists the same accounts without their limits.
 
-Each account the login may charge appears as a button you can click to choose 
it. Hovering shows its description, the partitions it is limited to and its 
QOS. If an account is limited to partitions other than the deployment's 
partition, it is marked **other partitions** and a warning appears when you 
select it. If only one account is found and the field is empty, it is filled in 
automatically.
+Each account the login may charge appears as a button you can click to choose 
it. Hovering shows its description, the partitions it is limited to and its 
QOS. If an account is limited to partitions other than the requested partition, 
it is marked **other partitions** and a warning appears when you select it. If 
only one account is found and the field is empty, it is filled in automatically.
 
 On the deployment form, **Discover allocations as** picks which of your logins 
on the cluster to ask.
 
@@ -191,7 +191,7 @@ DELETE 
/api/v1/slurm-clusters/{clusterId}/partitions/{partitionId}    # remove o
 
 To refresh a cluster's layout after the site changes it, run 
**discover-partitions** again and compare the result with the stored 
partitions. Then add, update or remove partitions one at a time.
 
-Deployments refer to a partition by **name**, not by id. Deleting or renaming 
a partition is not checked against the deployments that use it, so update those 
deployments' `defaultPartition` as well.
+Deployments refer to a partition by **name**, not by id. Deleting or renaming 
a partition is not checked against the deployments that use it, so update those 
deployments' `defaultBatchJobConfig.partition` as well.
 
 ### Deleting
 
@@ -213,4 +213,4 @@ Deployments refer to a partition by **name**, not by id. 
Deleting or renaming a
 
 ## How runs use this
 
-When a run is launched, Airavata logs in to the cluster's head node under the 
run's **cluster config**. It creates the work directory under the config's work 
root, stages the run's data into it, writes the batch script and submits it 
with `sbatch` to the deployment's partition. The `#SBATCH` header is built from 
the run's resource request, including its allocation. See 
[application.md](application.md) for how deployments and runs are put together.
+When a run is launched, Airavata logs in to the cluster's head node under the 
run's **cluster config**. It creates the work directory under the config's work 
root, stages the run's data into it, writes the batch script and submits it 
with `sbatch` to the run's partition. The `#SBATCH` header is built from the 
run's resource request, including its allocation. See 
[application.md](application.md) for how deployments and runs are put together.
diff --git a/docs/mcp.md b/docs/mcp.md
index de9af15005..c99653352f 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -135,6 +135,6 @@ It shows each pending login and reads secret answers 
without echo.
 ## Not available yet
 
 These need changes to `airavata-server` (Part B of the plan): registering 
applications as a non-admin, listing
-your earlier runs, cancelling a run, reading job logs, choosing a partition 
per run, keeping sbatch options the
+your earlier runs, cancelling a run, reading job logs, keeping sbatch options 
the
 API has no field for, workflows (predefined recipes such as sweeps and chains, 
which job arrays and dependency
 chains will map to, and Nextflow pipelines), searching data by metadata, and 
browsing a storage.
diff --git a/docs/openapi.yaml b/docs/openapi.yaml
index 75b9354196..905c455aca 100644
--- a/docs/openapi.yaml
+++ b/docs/openapi.yaml
@@ -3906,6 +3906,7 @@ components:
         cpusPerGpu: { type: [string, "null"] }
         gpusPerNode: { type: [integer, "null"], format: int32 }
         constraints: { type: [string, "null"] }
+        partition: { type: [string, "null"] }
         qos: { type: [string, "null"], description: "Slurm quality of service 
(`--qos`)." }
       required: [wallTimeMinutes, allocation]
 
@@ -3928,6 +3929,7 @@ components:
         cpusPerGpu: { type: [string, "null"] }
         gpusPerNode: { type: [integer, "null"], format: int32 }
         constraints: { type: [string, "null"] }
+        partition: { type: [string, "null"] }
         qos: { type: [string, "null"], description: "Slurm quality of service 
(`--qos`)." }
       required: [batchJobConfigId, wallTimeMinutes, allocation]
 
@@ -3944,7 +3946,6 @@ components:
           description: |
             The resource request a run of this deployment starts from. A run 
carries
             its own copy and may depart from it.
-        defaultPartition: { type: [string, "null"] }
       required: [templateId, slurmRunSection, defaultBatchJobConfig]
 
     BatchDeploymentResponse:
@@ -3958,7 +3959,6 @@ components:
           oneOf:
             - { $ref: "#/components/schemas/BatchJobConfigResponse" }
             - { type: "null" }
-        defaultPartition: { type: [string, "null"] }
       required: [deploymentId, slurmRunSection]
 
     # ----------------------------------------------------------- Data
diff --git a/internal/db/migrations/0019_slurm_partition.sql 
b/internal/db/migrations/0019_slurm_partition.sql
new file mode 100644
index 0000000000..1eb4b55bad
--- /dev/null
+++ b/internal/db/migrations/0019_slurm_partition.sql
@@ -0,0 +1,9 @@
+-- Move the partition from the deployment into the job config, so a run can 
choose it.
+
+ALTER TABLE "batch_job_configs" ADD COLUMN "partition" varchar(255);
+
+UPDATE "batch_job_configs" c SET "partition" = d."default_partition"
+FROM "batch_application_deployments" d LEFT JOIN "batch_processes" p ON 
p."deployment_id" = d."deployment_id"
+WHERE c."batch_job_config_id" IN (d."default_batch_job_config_id", 
p."batch_job_config_id");
+
+ALTER TABLE "batch_application_deployments" DROP COLUMN "default_partition";
diff --git a/internal/mcp/client/client.gen.go 
b/internal/mcp/client/client.gen.go
index 58278b53e4..db9a0aeeac 100644
--- a/internal/mcp/client/client.gen.go
+++ b/internal/mcp/client/client.gen.go
@@ -634,7 +634,6 @@ type BatchDeploymentRequest struct {
        // DefaultBatchJobConfig The resource request a run of this deployment 
starts from. A run carries
        // its own copy and may depart from it.
        DefaultBatchJobConfig BatchJobConfigRequest 
`json:"defaultBatchJobConfig"`
-       DefaultPartition      *string               
`json:"defaultPartition,omitempty"`
        SlurmClusterId        *openapi_types.UUID   
`json:"slurmClusterId,omitempty"`
 
        // SlurmRunSection The run script section a job of this deployment 
executes.
@@ -645,7 +644,6 @@ type BatchDeploymentRequest struct {
 // BatchDeploymentResponse defines model for BatchDeploymentResponse.
 type BatchDeploymentResponse struct {
        DefaultBatchJobConfig *BatchJobConfigResponse 
`json:"defaultBatchJobConfig,omitempty"`
-       DefaultPartition      *string                 
`json:"defaultPartition,omitempty"`
        DeploymentId          openapi_types.UUID      `json:"deploymentId"`
        SlurmClusterId        *openapi_types.UUID     
`json:"slurmClusterId,omitempty"`
        SlurmRunSection       string                  `json:"slurmRunSection"`
@@ -668,6 +666,7 @@ type BatchJobConfigRequest struct {
        Nodes         *int32  `json:"nodes,omitempty"`
        Ntasks        *int32  `json:"ntasks,omitempty"`
        NtasksPerNode *int32  `json:"ntasksPerNode,omitempty"`
+       Partition     *string `json:"partition,omitempty"`
 
        // Qos Slurm quality of service (`--qos`).
        Qos             *string `json:"qos,omitempty"`
@@ -691,6 +690,7 @@ type BatchJobConfigResponse struct {
        Nodes            *int32             `json:"nodes,omitempty"`
        Ntasks           *int32             `json:"ntasks,omitempty"`
        NtasksPerNode    *int32             `json:"ntasksPerNode,omitempty"`
+       Partition        *string            `json:"partition,omitempty"`
 
        // Qos Slurm quality of service (`--qos`).
        Qos             *string `json:"qos,omitempty"`
diff --git a/internal/mcp/estimate/estimate.go 
b/internal/mcp/estimate/estimate.go
index edb2d5f74c..9eb2b058a9 100644
--- a/internal/mcp/estimate/estimate.go
+++ b/internal/mcp/estimate/estimate.go
@@ -46,6 +46,7 @@ type Request struct {
        CpusPerGpu      *string `json:"cpus_per_gpu,omitempty"`
        Gres            *string `json:"gres,omitempty"`
        Constraints     *string `json:"constraints,omitempty"`
+       Partition       *string `json:"partition,omitempty"`
        Qos             *string `json:"qos,omitempty"`
 }
 
@@ -57,7 +58,7 @@ func FromResponse(c *client.BatchJobConfigResponse) Request {
        return Request{WallTimeMinutes: c.WallTimeMinutes, Allocation: 
c.Allocation, Nodes: c.Nodes, Ntasks: c.Ntasks,
                NtasksPerNode: c.NtasksPerNode, Cpus: c.Cpus, CpusPerTask: 
c.CpusPerTask, Mem: c.Mem, MemPerCpu: c.MemPerCpu,
                Gpus: c.Gpus, GpusPerNode: c.GpusPerNode, MemPerGpu: 
c.MemPerGpu, CpusPerGpu: c.CpusPerGpu, Gres: c.Gres,
-               Constraints: c.Constraints, Qos: c.Qos}
+               Constraints: c.Constraints, Partition: c.Partition, Qos: c.Qos}
 }
 
 // API converts to the request body airavata-server takes.
@@ -65,7 +66,7 @@ func (r Request) API() client.BatchJobConfigRequest {
        return client.BatchJobConfigRequest{WallTimeMinutes: r.WallTimeMinutes, 
Allocation: r.Allocation, Nodes: r.Nodes,
                Ntasks: r.Ntasks, NtasksPerNode: r.NtasksPerNode, Cpus: r.Cpus, 
CpusPerTask: r.CpusPerTask, Mem: r.Mem,
                MemPerCpu: r.MemPerCpu, Gpus: r.Gpus, GpusPerNode: 
r.GpusPerNode, MemPerGpu: r.MemPerGpu,
-               CpusPerGpu: r.CpusPerGpu, Gres: r.Gres, Constraints: 
r.Constraints, Qos: r.Qos}
+               CpusPerGpu: r.CpusPerGpu, Gres: r.Gres, Constraints: 
r.Constraints, Partition: r.Partition, Qos: r.Qos}
 }
 
 // Overlay returns r with every field set in o replacing r's.
@@ -99,6 +100,7 @@ func (r Request) Overlay(o Request) Request {
        pickS(&r.CpusPerGpu, o.CpusPerGpu)
        pickS(&r.Gres, o.Gres)
        pickS(&r.Constraints, o.Constraints)
+       pickS(&r.Partition, o.Partition)
        pickS(&r.Qos, o.Qos)
        return r
 }
diff --git a/internal/mcp/server/server_test.go 
b/internal/mcp/server/server_test.go
index 97e794d4e9..554c129024 100644
--- a/internal/mcp/server/server_test.go
+++ b/internal/mcp/server/server_test.go
@@ -72,8 +72,8 @@ func (f *fakeAPI) handler() http.Handler {
                "inputs":  []any{map[string]any{"inputId": inputID, 
"inputName": "steps", "inputType": "INTEGER", "required": true}},
                "outputs": []any{}}
        deployment := map[string]any{"deploymentId": deploymentID, 
"templateId": templateID, "slurmClusterId": clusterID,
-               "slurmRunSection": "gmx mdrun -nsteps {{ inputs.steps[0] }}", 
"defaultPartition": "gpu",
-               "defaultBatchJobConfig": map[string]any{"batchJobConfigId": 
batchID, "wallTimeMinutes": 60, "allocation": "abc123", "nodes": 1, "cpus": 8, 
"gpus": 1}}
+               "slurmRunSection":       "gmx mdrun -nsteps {{ inputs.steps[0] 
}}",
+               "defaultBatchJobConfig": map[string]any{"batchJobConfigId": 
batchID, "wallTimeMinutes": 60, "allocation": "abc123", "nodes": 1, "cpus": 8, 
"gpus": 1, "partition": "gpu"}}
        config := map[string]any{"slurmClusterConfigId": configID, 
"slurmClusterId": clusterID, "loginUser": "alice", "workRoot": "/scratch/alice",
                "sshCredentialId": credID, "sshCredential": 
map[string]any{"sshCredentialId": credID, "sshCredentialName": "laptop", 
"publicKey": "ssh-ed25519 AAAA", "fullInteractive": false, "ownerId": 
"cilogon:alice"}}
 
@@ -268,8 +268,8 @@ func plan(t *testing.T, h *harness) string {
                t.Fatalf("plan_run returned no handle: %v", out)
        }
        p := out["plan"].(map[string]any)
-       if p["partition"] != "gpu" || p["cluster"] != "expanse" {
-               t.Errorf("plan targets %v/%v", p["cluster"], p["partition"])
+       if partition := p["resources"].(map[string]any)["partition"]; partition 
!= "gpu" || p["cluster"] != "expanse" {
+               t.Errorf("plan targets %v/%v", p["cluster"], partition)
        }
        hours := p["hours"].(map[string]any)
        if hours["requested_core_hours"] != 8.0 || hours["requested_gpu_hours"] 
!= 1.0 {
diff --git a/internal/mcp/tools/admin/admin.go 
b/internal/mcp/tools/admin/admin.go
index a7fce44d8d..760fbd7bc1 100644
--- a/internal/mcp/tools/admin/admin.go
+++ b/internal/mcp/tools/admin/admin.go
@@ -48,7 +48,7 @@ func Register(s *mcp.Server, d *tk.Deps) {
                Description: "Create an application template and its 
deployments from a proposal_handle returned by draft_application or 
convert_sbatch_script (admins only). Asks the user to confirm. Each handle 
registers at most once."},
                prepareApplication(d))
        tk.Write(s, d, tk.Def{Name: "update_deployment", Title: "Update a 
deployment",
-               Description: "Change a deployment's run section, partition or 
default resources (admins only). Only the fields given change. Asks the user to 
confirm, showing old and new values."},
+               Description: "Change a deployment's run section or default 
resources (admins only). Only the fields given change. Asks the user to 
confirm, showing old and new values."},
                prepareDeployment(d))
 }
 
@@ -299,7 +299,6 @@ func registerApplication(ctx context.Context, d *tk.Deps, 
principal, handle stri
 type updateDeploymentIn struct {
        DeploymentID string            `json:"deployment_id"`
        RunSection   *string           `json:"run_section,omitempty"`
-       Partition    *string           `json:"partition,omitempty"`
        Resources    *estimate.Request `json:"default_resources,omitempty" 
jsonschema:"fields given here replace the deployment's defaults"`
 }
 
@@ -312,22 +311,19 @@ func prepareDeployment(d *tk.Deps) 
tk.Prepare[updateDeploymentIn, createdOut] {
                if cur.TemplateId == nil || cur.SlurmClusterId == nil {
                        return nil, errors.New("the deployment names no 
template or cluster")
                }
-               draft := applications.DeploymentDraft{ClusterID: 
cur.SlurmClusterId.String(), Partition: tk.Str(cur.DefaultPartition),
+               draft := applications.DeploymentDraft{ClusterID: 
cur.SlurmClusterId.String(),
                        RunSection: cur.SlurmRunSection, Job: 
estimate.FromResponse(cur.DefaultBatchJobConfig)}
                var changes []string
                if in.RunSection != nil && *in.RunSection != draft.RunSection {
                        changes = append(changes, "run section:\n--- 
old\n"+draft.RunSection+"\n+++ new\n"+*in.RunSection)
                        draft.RunSection = *in.RunSection
                }
-               if in.Partition != nil && *in.Partition != draft.Partition {
-                       changes = append(changes, fmt.Sprintf("partition: %s -> 
%s", draft.Partition, *in.Partition))
-                       draft.Partition = *in.Partition
-               }
                if in.Resources != nil {
                        before := draft.Job
                        draft.Job = draft.Job.Overlay(*in.Resources)
-                       changes = append(changes, fmt.Sprintf("default 
resources: walltime %d -> %d min, cores %d -> %d, GPUs %d -> %d, allocation %s 
-> %s",
-                               before.WallTimeMinutes, 
draft.Job.WallTimeMinutes, before.Cores(), draft.Job.Cores(), before.GPUs(), 
draft.Job.GPUs(), before.Allocation, draft.Job.Allocation))
+                       changes = append(changes, fmt.Sprintf("default 
resources: walltime %d -> %d min, cores %d -> %d, GPUs %d -> %d, allocation %s 
-> %s, partition %s -> %s",
+                               before.WallTimeMinutes, 
draft.Job.WallTimeMinutes, before.Cores(), draft.Job.Cores(), before.GPUs(), 
draft.Job.GPUs(), before.Allocation, draft.Job.Allocation,
+                               tk.Str(before.Partition), 
tk.Str(draft.Job.Partition)))
                }
                if len(changes) == 0 {
                        return nil, errors.New("no fields to change were given")
diff --git a/internal/mcp/tools/applications/applications.go 
b/internal/mcp/tools/applications/applications.go
index 2ed2acb69e..afd22e2dda 100644
--- a/internal/mcp/tools/applications/applications.go
+++ b/internal/mcp/tools/applications/applications.go
@@ -113,7 +113,7 @@ func summarize(t client.TemplateResponse, deps 
[]client.BatchDeploymentResponse,
                if dep.TemplateId == nil || *dep.TemplateId != t.TemplateId {
                        continue
                }
-               o := deploymentOut{DeploymentID: dep.DeploymentId.String(), 
Partition: tk.Str(dep.DefaultPartition)}
+               o := deploymentOut{DeploymentID: dep.DeploymentId.String(), 
Partition: tk.Str(estimate.FromResponse(dep.DefaultBatchJobConfig).Partition)}
                if dep.SlurmClusterId != nil {
                        o.ClusterID = dep.SlurmClusterId.String()
                        o.ClusterName = names[o.ClusterID]
@@ -200,7 +200,6 @@ type convertOut struct {
        Mapped         []optionOut                     `json:"mapped_options"`
        Replaced       []optionOut                     
`json:"replaced_by_airavata"`
        Unsupported    []optionOut                     
`json:"unsupported_options"`
-       Partition      string                          
`json:"partition,omitempty"`
        Resources      estimate.Request                
`json:"default_resources"`
        RunSection     string                          `json:"run_section"`
        Inputs         []slurmconv.AppliedInput        `json:"inputs"`
@@ -251,9 +250,12 @@ func convert(ctx context.Context, d *tk.Deps, in 
convertIn) (*mcp.CallToolResult
                name = "converted_script"
        }
        out := convertOut{Mapped: options(conv.Mapped), Replaced: 
options(conv.Replaced), Unsupported: options(conv.Unsupported),
-               Partition: conv.Partition, Resources: 
FromJobConfig(conv.JobConfig), RunSection: conv.RunSection, Inputs: applied,
+               Resources: FromJobConfig(conv.JobConfig), RunSection: 
conv.RunSection, Inputs: applied,
                Software: conv.Software, Containers: conv.Containers, Diff: 
slurmconv.Diff(in.Script, slurmconv.Render(conv)),
                Registrable: conv.Registrable, Problems: conv.Problems, Notes: 
conv.Notes}
+       if conv.Partition != "" {
+               out.Resources.Partition = &conv.Partition
+       }
        if conv.Array != nil || len(conv.Dependencies) > 0 {
                out.Notes = append(out.Notes, "Job arrays and dependency chains 
cannot be registered yet; they will map to Airavata's sweep and chain workflow 
recipes.")
        }
@@ -266,16 +268,13 @@ func convert(ctx context.Context, d *tk.Deps, in 
convertIn) (*mcp.CallToolResult
                return nil, out, nil
        }
        p := &AppProposal{Name: name, Description: in.Description, Source: 
"sbatch", Outputs: in.Outputs, Inputs: []InputDraft{},
-               Deployments: []DeploymentDraft{{ClusterID: in.ClusterID, 
Partition: conv.Partition, RunSection: conv.RunSection, Job: out.Resources}}}
+               Deployments: []DeploymentDraft{{ClusterID: in.ClusterID, 
RunSection: conv.RunSection, Job: out.Resources}}}
        if p.Outputs == nil {
                p.Outputs = []OutputDraft{}
        }
        for _, a := range applied {
                p.Inputs = append(p.Inputs, InputDraft{Name: a.Name, Type: 
a.Type, Description: a.Description, Default: a.Default})
        }
-       if conv.Partition == "" {
-               p.Problems = append(p.Problems, "the script names no 
--partition; draft_application can set one")
-       }
        out.Proposal = p
        out.ProposalHandle, out.Next, err = finish(ctx, d, p)
        return nil, out, err
@@ -300,7 +299,6 @@ func finish(ctx context.Context, d *tk.Deps, p 
*AppProposal) (handle, next strin
 
 type draftDeployment struct {
        ClusterID  string           `json:"cluster_id"`
-       Partition  string           `json:"partition"`
        RunSection string           `json:"run_section,omitempty" 
jsonschema:"the job body; reference inputs as {{ inputs.NAME[0] }}. Optional 
with container_image + command"`
        Resources  estimate.Request `json:"default_resources"`
 }
@@ -347,7 +345,7 @@ func draft(ctx context.Context, d *tk.Deps, in draftIn) 
(*mcp.CallToolResult, dr
                if run == "" {
                        run = containerRun
                }
-               p.Deployments = append(p.Deployments, 
DeploymentDraft{ClusterID: dd.ClusterID, Partition: dd.Partition, RunSection: 
run, Job: job})
+               p.Deployments = append(p.Deployments, 
DeploymentDraft{ClusterID: dd.ClusterID, RunSection: run, Job: job})
        }
        out := draftOut{Proposal: p}
        var err error
diff --git a/internal/mcp/tools/applications/proposal.go 
b/internal/mcp/tools/applications/proposal.go
index 730175f70b..7b6c3ce5ef 100644
--- a/internal/mcp/tools/applications/proposal.go
+++ b/internal/mcp/tools/applications/proposal.go
@@ -59,7 +59,6 @@ type OutputDraft struct {
 type DeploymentDraft struct {
        ClusterID   string           `json:"cluster_id"`
        ClusterName string           `json:"cluster,omitempty"`
-       Partition   string           `json:"partition"`
        RunSection  string           `json:"run_section"`
        Job         estimate.Request `json:"default_resources"`
        Fit         *estimate.Fit    `json:"fit,omitempty"`
@@ -111,7 +110,7 @@ func (p *AppProposal) Validate(ctx context.Context, d 
*tk.Deps) {
                }
        }
        if len(p.Deployments) == 0 {
-               p.Problems = append(p.Problems, "give at least one deployment 
(cluster_id, partition, run_section, resources)")
+               p.Problems = append(p.Problems, "give at least one deployment 
(cluster_id, run_section, resources)")
        }
        clusters := map[string]*client.SlurmClusterResponse{}
        for i := range p.Deployments {
@@ -140,7 +139,8 @@ func (p *AppProposal) Validate(ctx context.Context, d 
*tk.Deps) {
                if strings.TrimSpace(dep.Job.Allocation) == "" {
                        p.Problems = append(p.Problems, label+": 
default_resources.allocation (the Slurm account) is required")
                }
-               if strings.ContainsAny(dep.Partition, "\r\n,") {
+               name := tk.Str(dep.Job.Partition)
+               if strings.ContainsAny(name, "\r\n,") {
                        p.Problems = append(p.Problems, label+": partition must 
be a single partition name")
                }
                c, ok := clusters[dep.ClusterID]
@@ -156,15 +156,18 @@ func (p *AppProposal) Validate(ctx context.Context, d 
*tk.Deps) {
                        continue
                }
                dep.ClusterName = c.ClusterName
-               part := tk.Partition(c, dep.Partition)
+               if name == "" {
+                       continue
+               }
+               part := tk.Partition(c, name)
                if part == nil {
-                       p.Problems = append(p.Problems, fmt.Sprintf("%s: %s has 
no partition %q", label, c.ClusterName, dep.Partition))
+                       p.Problems = append(p.Problems, fmt.Sprintf("%s: %s has 
no partition %q", label, c.ClusterName, name))
                        continue
                }
                fit := estimate.Check(dep.Job, part)
                dep.Fit = &fit
                for _, v := range fit.Violations {
-                       p.Problems = append(p.Problems, fmt.Sprintf("%s 
(%s/%s): %s", label, c.ClusterName, dep.Partition, v))
+                       p.Problems = append(p.Problems, fmt.Sprintf("%s 
(%s/%s): %s", label, c.ClusterName, name, v))
                }
        }
 }
@@ -194,7 +197,7 @@ func (p *AppProposal) Describe() string {
        for _, dep := range p.Deployments {
                j := dep.Job
                fmt.Fprintf(&b, "Deployment on %s, partition %s: walltime %d 
min, %d node(s), %d core(s), %d GPU(s), allocation %s\n",
-                       dep.ClusterName, dep.Partition, j.WallTimeMinutes, 
j.NodeCount(), j.Cores(), j.GPUs(), j.Allocation)
+                       dep.ClusterName, tk.Str(j.Partition), 
j.WallTimeMinutes, j.NodeCount(), j.Cores(), j.GPUs(), j.Allocation)
                run := dep.RunSection
                if len(run) > 1500 {
                        run = run[:1500] + "\n..."
@@ -241,9 +244,8 @@ func DeploymentRequest(templateID client.TemplateId, dep 
DeploymentDraft) (clien
        if err != nil {
                return client.BatchDeploymentRequest{}, err
        }
-       part := dep.Partition
        return client.BatchDeploymentRequest{TemplateId: templateID, 
SlurmClusterId: &cid, SlurmRunSection: dep.RunSection,
-               DefaultBatchJobConfig: dep.Job.API(), DefaultPartition: &part}, 
nil
+               DefaultBatchJobConfig: dep.Job.API()}, nil
 }
 
 // FromJobConfig converts a converter job config into a resource request.
diff --git a/internal/mcp/tools/compute/compute.go 
b/internal/mcp/tools/compute/compute.go
index 05d809985b..670de8b5b3 100644
--- a/internal/mcp/tools/compute/compute.go
+++ b/internal/mcp/tools/compute/compute.go
@@ -69,7 +69,7 @@ func Register(s *mcp.Server, d *tk.Deps) {
                        return listAuthPrompts(ctx, d)
                })
        tk.Read(s, d, tk.Def{Name: "recommend_partition", Title: "Recommend a 
partition",
-               Description: "Rank partitions for a resource request by fit 
against their recorded limits, with requested core-hours and GPU-hours. Give 
template_id to rank the partitions of that application's deployments (a run 
cannot choose its own partition; it uses its deployment's), or cluster_id to 
rank every partition on a cluster for a new deployment."},
+               Description: "Rank partitions for a resource request by fit 
against their recorded limits, with requested core-hours and GPU-hours. Give 
template_id to rank the partitions of that application's deployments, or 
cluster_id to rank every partition on a cluster for a new deployment."},
                func(ctx context.Context, _ *mcp.CallToolRequest, in 
recommendIn) (*mcp.CallToolResult, recommendOut, error) {
                        return recommend(ctx, d, in)
                })
@@ -328,7 +328,7 @@ func recommend(ctx context.Context, d *tk.Deps, in 
recommendIn) (*mcp.CallToolRe
                                clusters[cid] = c
                        }
                        c := clusters[cid]
-                       name := tk.Str(dep.DefaultPartition)
+                       name := 
tk.Str(estimate.FromResponse(dep.DefaultBatchJobConfig).Partition)
                        cand := candidate{ClusterID: cid, ClusterName: 
c.ClusterName, Partition: name, DeploymentID: dep.DeploymentId.String()}
                        if p := tk.Partition(c, name); p != nil {
                                cand.Fit, cand.Limits = 
estimate.Check(in.Request, p), tk.SummarizePartition(*p)
@@ -337,7 +337,7 @@ func recommend(ctx context.Context, d *tk.Deps, in 
recommendIn) (*mcp.CallToolRe
                        }
                        cands = append(cands, cand)
                }
-               out.Notes = append(out.Notes, "A run uses its deployment's 
partition; choosing a partition per run is not supported by airavata-server 
yet.")
+               out.Notes = append(out.Notes, "A run uses its deployment's 
default partition unless plan_run's resources.partition names another.")
        }
        sort.SliceStable(cands, func(i, j int) bool {
                if cands[i].Fits != cands[j].Fits {
diff --git a/internal/mcp/tools/processes/plan.go 
b/internal/mcp/tools/processes/plan.go
index a10936d002..3825151ab3 100644
--- a/internal/mcp/tools/processes/plan.go
+++ b/internal/mcp/tools/processes/plan.go
@@ -48,7 +48,6 @@ type RunPlan struct {
        DeploymentID    string           `json:"deployment_id"`
        ClusterID       string           `json:"cluster_id"`
        ClusterName     string           `json:"cluster"`
-       Partition       string           `json:"partition"`
        ClusterConfigID string           `json:"cluster_config_id"`
        LoginUser       string           `json:"login_user"`
        Interactive     bool             
`json:"needs_interactive_ssh_auth,omitempty"`
@@ -79,7 +78,7 @@ type planRunIn struct {
        ClusterConfigID string            `json:"cluster_config_id,omitempty" 
jsonschema:"login config from list_cluster_configs; inferred when only one 
fits"`
        Inputs          map[string]string `json:"inputs,omitempty" 
jsonschema:"input name -> value. FILE inputs take a data product id from 
list_data_products"`
        Outputs         map[string]string `json:"outputs,omitempty" 
jsonschema:"FILE output name -> data product id to stage the result to"`
-       Resources       estimate.Request  `json:"resources,omitempty" 
jsonschema:"overrides of the deployment's default job config (walltime, nodes, 
cpus, memory, GPUs, allocation)"`
+       Resources       estimate.Request  `json:"resources,omitempty" 
jsonschema:"overrides of the deployment's default job config (walltime, nodes, 
cpus, memory, GPUs, allocation, partition)"`
        BaseWorkDir     string            `json:"base_work_dir,omitempty" 
jsonschema:"parent directory on the cluster; defaults to the config's work 
root"`
 
        reuse *client.BatchProcessResponse
@@ -172,7 +171,7 @@ func resolveTargets(ctx context.Context, d *tk.Deps, req 
*mcp.CallToolRequest, p
        var options []option
        for _, dep := range candidates {
                for _, c := range configsFor(dep) {
-                       label := fmt.Sprintf("%s / %s as %s (%s)", 
names[uuidStr(dep.SlurmClusterId)], tk.Str(dep.DefaultPartition), c.LoginUser,
+                       label := fmt.Sprintf("%s / %s as %s (%s)", 
names[uuidStr(dep.SlurmClusterId)], 
tk.Str(estimate.FromResponse(dep.DefaultBatchJobConfig).Partition), c.LoginUser,
                                firstNonEmpty(tk.Str(c.Name), 
c.SlurmClusterConfigId.String()[:8]))
                        options = append(options, option{label, dep, c})
                }
@@ -255,7 +254,7 @@ func buildPlan(ctx context.Context, d *tk.Deps, dep 
*client.BatchDeploymentRespo
                return nil, err
        }
        plan := &RunPlan{TemplateID: tmpl.TemplateId.String(), TemplateName: 
tk.Str(tmpl.TemplateName), DeploymentID: dep.DeploymentId.String(),
-               ClusterID: cluster.SlurmClusterId.String(), ClusterName: 
cluster.ClusterName, Partition: tk.Str(dep.DefaultPartition),
+               ClusterID: cluster.SlurmClusterId.String(), ClusterName: 
cluster.ClusterName,
                ClusterConfigID: cfg.SlurmClusterConfigId.String(), LoginUser: 
cfg.LoginUser, BaseWorkDir: in.BaseWorkDir,
                Inputs: []PlannedValue{}, Outputs: []PlannedValue{}}
        if cfg.SshCredential != nil && cfg.SshCredential.FullInteractive {
@@ -278,14 +277,14 @@ func buildPlan(ctx context.Context, d *tk.Deps, dep 
*client.BatchDeploymentRespo
        if strings.TrimSpace(plan.Job.Allocation) == "" {
                problems = append(problems, "no allocation (Slurm account): 
pass resources.allocation")
        }
-       for _, s := range []*string{plan.Job.Mem, plan.Job.Gres, 
plan.Job.Constraints, plan.Job.Qos, plan.Job.MemPerCpu, plan.Job.MemPerGpu, 
plan.Job.CpusPerGpu} {
+       for _, s := range []*string{plan.Job.Partition, plan.Job.Mem, 
plan.Job.Gres, plan.Job.Constraints, plan.Job.Qos, plan.Job.MemPerCpu, 
plan.Job.MemPerGpu, plan.Job.CpusPerGpu} {
                if s != nil && strings.ContainsAny(*s, "\r\n") {
                        problems = append(problems, "resource values must be on 
one line")
                }
        }
-       plan.partition = tk.Partition(cluster, plan.Partition)
-       if plan.partition == nil {
-               plan.Warnings = append(plan.Warnings, fmt.Sprintf("partition %q 
is not recorded on %s, so its limits could not be checked", plan.Partition, 
cluster.ClusterName))
+       plan.partition = tk.Partition(cluster, tk.Str(plan.Job.Partition))
+       if plan.partition == nil && tk.Str(plan.Job.Partition) != "" {
+               plan.Warnings = append(plan.Warnings, fmt.Sprintf("partition %q 
is not recorded on %s, so its limits could not be checked", 
tk.Str(plan.Job.Partition), cluster.ClusterName))
        }
        problems = append(problems, checkJob(d.Policy, plan)...)
        if len(problems) > 0 {
@@ -461,7 +460,7 @@ func reuseMappings(tmpl *client.TemplateResponse, bp 
*client.BatchProcessRespons
 // Describe is the confirmation text for a launch.
 func (p *RunPlan) Describe() string {
        var b strings.Builder
-       fmt.Fprintf(&b, "Launch %s on %s, partition %s, as %s.\n", 
p.TemplateName, p.ClusterName, p.Partition, p.LoginUser)
+       fmt.Fprintf(&b, "Launch %s on %s, partition %s, as %s.\n", 
p.TemplateName, p.ClusterName, tk.Str(p.Job.Partition), p.LoginUser)
        j := p.Job
        fmt.Fprintf(&b, "Resources: walltime %d min, %d node(s), %d core(s), %d 
GPU(s)", j.WallTimeMinutes, j.NodeCount(), j.Cores(), j.GPUs())
        if j.Mem != nil {
diff --git a/internal/mcp/tools/processes/processes.go 
b/internal/mcp/tools/processes/processes.go
index 3d1b500bc9..d54f198f14 100644
--- a/internal/mcp/tools/processes/processes.go
+++ b/internal/mcp/tools/processes/processes.go
@@ -353,7 +353,7 @@ func correctedPlan(ctx context.Context, d *tk.Deps, st 
statusOut, walltime int64
        }
        note := ""
        if cluster, err := d.Cluster(ctx, uuidStr(dep.SlurmClusterId)); err == 
nil {
-               if p := tk.Partition(cluster, tk.Str(dep.DefaultPartition)); p 
!= nil && p.MaxRunTime != nil && *p.MaxRunTime > 0 && walltime > 
int64(*p.MaxRunTime) {
+               if p := tk.Partition(cluster, 
tk.Str(estimate.FromResponse(bp.BatchJobConfig).Partition)); p != nil && 
p.MaxRunTime != nil && *p.MaxRunTime > 0 && walltime > int64(*p.MaxRunTime) {
                        walltime = int64(*p.MaxRunTime)
                        note = fmt.Sprintf("Capped at the partition's max run 
time of %d minutes; if that is not enough the job needs a deployment on a 
partition with a longer limit, or checkpointing.", walltime)
                }
diff --git a/internal/orchestration/tasks/batch/slurm.go 
b/internal/orchestration/tasks/batch/slurm.go
index 63bcaf9133..bc63e3c587 100644
--- a/internal/orchestration/tasks/batch/slurm.go
+++ b/internal/orchestration/tasks/batch/slurm.go
@@ -152,7 +152,7 @@ func buildSlurmScript(
                "stderr_file":     path.Join(workDir, "stderr.txt"),
                "wall_time":       slurmWallTime(jobConfig.WallTimeMinutes),
                "account":         strings.TrimSpace(jobConfig.Allocation),
-               "partition":       optional(deployment.DefaultPartition),
+               "partition":       optional(jobConfig.Partition),
                "mail_user":       globalJobConfigs.MailUser,
 
                "nodes":           optional(jobConfig.Nodes),
diff --git a/internal/orchestration/tasks/batch/slurm_test.go 
b/internal/orchestration/tasks/batch/slurm_test.go
index 067e49d945..f7c8d87d67 100644
--- a/internal/orchestration/tasks/batch/slurm_test.go
+++ b/internal/orchestration/tasks/batch/slurm_test.go
@@ -50,9 +50,8 @@ func scriptFixture() (*model.Process, 
*appmodel.BatchDeployment, *appmodel.Templ
        }
 
        deployment := &appmodel.BatchDeployment{
-               ID:               "dep-1",
-               TemplateID:       ptr("tpl-1"),
-               DefaultPartition: ptr("gpu"),
+               ID:         "dep-1",
+               TemplateID: ptr("tpl-1"),
                SlurmRunSection: "module load alphafold\n" +
                        "run_fold --in {{ inputs.protein[0] }} --iterations {{ 
inputs.iterations[0] }} " +
                        "--files {{ inputs.files[0] }} {{ inputs.files[1] }} {{ 
inputs.files[2] }} " +
@@ -76,6 +75,7 @@ func scriptFixture() (*model.Process, 
*appmodel.BatchDeployment, *appmodel.Templ
                                GPUs:            ptr(int32(4)),
                                WallTimeMinutes: 1500,
                                Allocation:      "alloc-123",
+                               Partition:       ptr("gpu"),
                        },
                        InputMappings: []*model.TemplateInputMapping{
                                {TemplateInputID: ptr("in-file"), Value: 
ptr("data-product-9")},

Reply via email to