mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-30 23:45:06 +01:00 
			
		
		
		
	Introduce batch scheduler plugins
This commit is contained in:
		
							
								
								
									
										27
									
								
								internal/scheduler/scheduler.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								internal/scheduler/scheduler.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | // Copyright (C) 2023 NHR@FAU, University Erlangen-Nuremberg. | ||||||
|  | // All rights reserved. | ||||||
|  | // Use of this source code is governed by a MIT-style | ||||||
|  | // license that can be found in the LICENSE file. | ||||||
|  | package scheduler | ||||||
|  |  | ||||||
|  | import "encoding/json" | ||||||
|  |  | ||||||
|  | type BatchScheduler interface { | ||||||
|  | 	Init(rawConfig json.RawMessage) error | ||||||
|  |  | ||||||
|  | 	Sync() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | var sd BatchScheduler | ||||||
|  |  | ||||||
|  | func Init(rawConfig json.RawMessage) error { | ||||||
|  |  | ||||||
|  | 	sd = &SlurmNatsScheduler{} | ||||||
|  | 	sd.Init(rawConfig) | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func GetHandle() BatchScheduler { | ||||||
|  | 	return sd | ||||||
|  | } | ||||||
							
								
								
									
										24
									
								
								internal/scheduler/slurmNats.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								internal/scheduler/slurmNats.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | // Copyright (C) 2023 NHR@FAU, University Erlangen-Nuremberg. | ||||||
|  | // All rights reserved. | ||||||
|  | // Use of this source code is governed by a MIT-style | ||||||
|  | // license that can be found in the LICENSE file. | ||||||
|  | package scheduler | ||||||
|  |  | ||||||
|  | import "encoding/json" | ||||||
|  |  | ||||||
|  | type SlurmNatsConfig struct { | ||||||
|  | 	URL string `json:"url"` | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type SlurmNatsScheduler struct { | ||||||
|  | 	url string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (sd *SlurmNatsScheduler) Init(rawConfig json.RawMessage) error { | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (sd *SlurmNatsScheduler) Sync() { | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										24
									
								
								internal/scheduler/slurmRest.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								internal/scheduler/slurmRest.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | // Copyright (C) 2023 NHR@FAU, University Erlangen-Nuremberg. | ||||||
|  | // All rights reserved. | ||||||
|  | // Use of this source code is governed by a MIT-style | ||||||
|  | // license that can be found in the LICENSE file. | ||||||
|  | package scheduler | ||||||
|  |  | ||||||
|  | import "encoding/json" | ||||||
|  |  | ||||||
|  | type SlurmRestSchedulerConfig struct { | ||||||
|  | 	URL string `json:"url"` | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type SlurmRestScheduler struct { | ||||||
|  | 	url string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (sd *SlurmRestScheduler) Init(rawConfig json.RawMessage) error { | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (sd *SlurmRestScheduler) Sync() { | ||||||
|  |  | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user