-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: we want to be able to select a final cluster based on state Solution: while a cluster will likely send back state when accepting jobs, for the time being we are providing a one off endpoint for a cluster to send state data, and it requires the cluster to authenticate with the name and secret. For now the state date is key value pairs of compatibility metadata, and the values can be anything (interface) as we are expecting the selection algorithms that use them to know the type for a specific key. I will be added selection algorithms after this first stage that I intend to use in scheduler simulation - namely a post filter that serves as additional constraints that can be chosen (max jobs a cluster can accept and a cost value that can be minimized. Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
26 changed files
with
1,030 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package update | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/converged-computing/rainbow/pkg/client" | ||
"github.com/converged-computing/rainbow/pkg/config" | ||
) | ||
|
||
// UpdateState updates state for a cluster | ||
func UpdateState( | ||
host, | ||
clusterName, | ||
stateFile, | ||
cfgFile string, | ||
) error { | ||
|
||
c, err := client.NewClient(host) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// A config file is required here | ||
if cfgFile == "" { | ||
return fmt.Errorf("an existing configuration file is required to update an existing cluster") | ||
} | ||
if stateFile == "" { | ||
return fmt.Errorf("a state file (json with key value pairs) is required to update state") | ||
} | ||
// Read in the config, if provided, command line takes preference | ||
cfg, err := config.NewRainbowClientConfig(cfgFile, "", "", "", "", "") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
log.Printf("updating state for cluster: %s", cfg.Scheduler.Name) | ||
|
||
// Last argument is subsystem name, which we can derive from graph | ||
response, err := c.UpdateState( | ||
context.Background(), | ||
cfg.Cluster.Name, | ||
cfg.Cluster.Secret, | ||
stateFile, | ||
) | ||
// If we get here, success! Dump all the stuff. | ||
log.Printf("%s", response) | ||
return err | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cost-per-node": 12, | ||
"max-jobs": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.