@@ -60,6 +60,7 @@ func NewGKEOrchestrator() *GKEOrchestrator {
6060 machineCapCache : make (map [string ]MachineTypeCap ),
6161 topologyCache : make (map [string ]string ),
6262 dynamicSlicingCache : make (map [string ]bool ),
63+ staticSlicingCache : make (map [string ]bool ),
6364 }
6465}
6566
@@ -102,7 +103,7 @@ func (g *GKEOrchestrator) SubmitJob(job orchestrator.JobDefinition) error {
102103 return err
103104 }
104105
105- profile , isDynamicSlicing , err := g .resolveHardwareRequirements (& job )
106+ profile , isDynamicSlicing , isStaticSlicing , err := g .resolveHardwareRequirements (& job )
106107 if err != nil {
107108 return err
108109 }
@@ -115,7 +116,7 @@ func (g *GKEOrchestrator) SubmitJob(job orchestrator.JobDefinition) error {
115116 return err
116117 }
117118
118- if err := g .generateAndSubmitManifests (job , fullImageName , profile , isDynamicSlicing ); err != nil {
119+ if err := g .generateAndSubmitManifests (job , fullImageName , profile , isDynamicSlicing , isStaticSlicing ); err != nil {
119120 return err
120121 }
121122
@@ -250,16 +251,16 @@ func (g *GKEOrchestrator) GetJobLogs(name string, opts orchestrator.LogsOptions)
250251 return res .Stdout , nil
251252}
252253
253- func (g * GKEOrchestrator ) generateAndSubmitManifests (job orchestrator.JobDefinition , fullImageName string , profile JobProfile , isDynamicSlicing bool ) error {
254+ func (g * GKEOrchestrator ) generateAndSubmitManifests (job orchestrator.JobDefinition , fullImageName string , profile JobProfile , isDynamicSlicing bool , isStaticSlicing bool ) error {
254255 if job .IsPathwaysJob {
255- manifestContent , err := g .GeneratePathwaysManifest (job , fullImageName , profile , isDynamicSlicing )
256+ manifestContent , err := g .GeneratePathwaysManifest (job , fullImageName , profile , isDynamicSlicing , isStaticSlicing )
256257 if err != nil {
257258 return err
258259 }
259260 return g .ApplyManifest (manifestContent , job .DryRunManifest , job .WorkloadName )
260261 }
261262
262- manifestOpts , err := g .PrepareManifestOptions (job , fullImageName , profile , isDynamicSlicing )
263+ manifestOpts , err := g .PrepareManifestOptions (job , fullImageName , profile , isDynamicSlicing , isStaticSlicing )
263264 if err != nil {
264265 return err
265266 }
@@ -302,7 +303,7 @@ func (g *GKEOrchestrator) validateJobConflicts(workloadName string, clusterName
302303 return nil
303304}
304305
305- func (g * GKEOrchestrator ) GeneratePathwaysManifest (job orchestrator.JobDefinition , fullImageName string , profile JobProfile , isDynamicSlicing bool ) (string , error ) {
306+ func (g * GKEOrchestrator ) GeneratePathwaysManifest (job orchestrator.JobDefinition , fullImageName string , profile JobProfile , isDynamicSlicing bool , isStaticSlicing bool ) (string , error ) {
306307 // Set default values for Pathways-specific fields if not provided
307308 if job .Pathways .ProxyServerImage == "" {
308309 job .Pathways .ProxyServerImage = defaultPathwaysProxyImage
@@ -320,7 +321,7 @@ func (g *GKEOrchestrator) GeneratePathwaysManifest(job orchestrator.JobDefinitio
320321 return "" , fmt .Errorf ("failed to parse pathways jobset template: %w" , err )
321322 }
322323
323- opts , err := g .PrepareManifestOptions (job , fullImageName , profile , isDynamicSlicing )
324+ opts , err := g .PrepareManifestOptions (job , fullImageName , profile , isDynamicSlicing , isStaticSlicing )
324325 if err != nil {
325326 return "" , err
326327 }
@@ -1797,12 +1798,12 @@ func (g *GKEOrchestrator) addAcceleratorLabel(nodeSelector map[string]string, ac
17971798 }
17981799}
17991800
1800- func (g * GKEOrchestrator ) addTopologyLabel (nodeSelector map [string ]string , schedOpts SchedulingOptions , isGPU bool , isCPUMachine bool , isDynamicSlicing bool ) error {
1801+ func (g * GKEOrchestrator ) addTopologyLabel (nodeSelector map [string ]string , schedOpts SchedulingOptions , isGPU bool , isCPUMachine bool ) error {
18011802 if schedOpts .Topology != "" {
18021803 if isGPU || isCPUMachine {
18031804 return fmt .Errorf ("topology is not allowed for GPU and CPU jobs" )
18041805 }
1805- if ! isDynamicSlicing {
1806+ if ! schedOpts . IsDynamicSlicing && ! schedOpts . IsStaticSlicing {
18061807 _ , hasFallback := schedOpts .NodeAffinityLabels [tpuTopologyLabel ]
18071808 if ! hasFallback {
18081809 nodeSelector [tpuTopologyLabel ] = schedOpts .Topology
@@ -1812,7 +1813,7 @@ func (g *GKEOrchestrator) addTopologyLabel(nodeSelector map[string]string, sched
18121813 return nil
18131814}
18141815
1815- func (g * GKEOrchestrator ) buildNodeSelector (schedOpts SchedulingOptions , job orchestrator.JobDefinition , isDynamicSlicing bool , isCPUMachine bool ) (string , error ) {
1816+ func (g * GKEOrchestrator ) buildNodeSelector (schedOpts SchedulingOptions , job orchestrator.JobDefinition , isCPUMachine bool ) (string , error ) {
18161817 nodeSelector := GetNodeSelector (schedOpts )
18171818 if nodeSelector == nil {
18181819 nodeSelector = make (map [string ]string )
@@ -1831,7 +1832,7 @@ func (g *GKEOrchestrator) buildNodeSelector(schedOpts SchedulingOptions, job orc
18311832
18321833 g .addAcceleratorLabel (nodeSelector , accelLabel , isCPUMachine , job .MachineType )
18331834
1834- if err := g .addTopologyLabel (nodeSelector , schedOpts , isGPU , isCPUMachine , isDynamicSlicing ); err != nil {
1835+ if err := g .addTopologyLabel (nodeSelector , schedOpts , isGPU , isCPUMachine ); err != nil {
18351836 return "" , err
18361837 }
18371838
@@ -1860,10 +1861,10 @@ func (g *GKEOrchestrator) buildAffinity(schedOpts SchedulingOptions) (string, er
18601861 return "" , nil
18611862}
18621863
1863- func (g * GKEOrchestrator ) buildTopologyAnnotation (topology string , numSlices int , isDynamicSlicing bool ) string {
1864+ func (g * GKEOrchestrator ) buildTopologyAnnotation (topology string , machineType string , numSlices int , nodesPerSlice int , isSubSlicing bool ) string {
18641865 var topologyAnnotation map [string ]string
1865- if isDynamicSlicing {
1866- topologyAnnotation = GetTopologyAnnotation (topology , numSlices )
1866+ if isSubSlicing {
1867+ topologyAnnotation = GetTopologyAnnotation (topology , machineType , numSlices , nodesPerSlice )
18671868 } else if topology != "" {
18681869 topologyAnnotation = map [string ]string {
18691870 "cloud.google.com/gke-tpu-slice-topology" : topology ,
0 commit comments