Skip to content

Commit

Permalink
Merge pull request #35 from converged-computing/bug-cluster-match
Browse files Browse the repository at this point in the history
bug: matches not accounted for with go client
  • Loading branch information
vsoch authored May 16, 2024
2 parents 0069f22 + 68cce10 commit c7ab752
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/examples/memgraph/rainbow-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ scheduler:
name: match
cluster:
name: keebler
secret: 162c041b-db57-444b-917c-a5528bd4e6ff
secret: a38e8008-c5ef-4803-821f-4c930d366a3c
graphdatabase:
name: memgraph
host: 127.0.0.1:50051
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/scheduler/rainbow-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ scheduler:
name: match
cluster:
name: keebler
secret: e8f9ff3b-80be-4d5e-8e71-2564f08602cf
secret: 27933478-5c96-4473-bd47-b829b5d0eaf9
graphdatabase:
name: memory
host: 127.0.0.1:50051
Expand Down
10 changes: 8 additions & 2 deletions pkg/client/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ func (c *RainbowClient) SubmitJob(

// Prepare clusters for submit jobs request
clusters := make([]*pb.SubmitJobRequest_Cluster, len(cfg.Clusters))
for i, cluster := range cfg.Clusters {
clusters[i] = &pb.SubmitJobRequest_Cluster{Token: cluster.Token, Name: cluster.Name}

// Take an intersection of clusters and matches
// A token will not be returned if we do not know about the cluster
for i, match := range matches {
creds := cfg.GetClusterToken(match)
if creds != "" {
clusters[i] = &pb.SubmitJobRequest_Cluster{Token: creds, Name: match}
}
}

// Jobspec gets converted back to string for easier serialization
Expand Down
10 changes: 10 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ func (c *RainbowConfig) ToJson() (string, error) {
return string(out), nil
}

// GetCluster returns a cluster, if it is known to the config
func (c *RainbowConfig) GetClusterToken(clusterName string) string {
for _, c := range c.Clusters {
if c.Name == clusterName {
return c.Token
}
}
return ""
}

// AddCluster adds a cluster on the fly to a config, likely for a one-off submit
func (c *RainbowConfig) AddCluster(clusterName, token string) error {

Expand Down
1 change: 1 addition & 0 deletions plugins/backends/memgraph/memgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func (g Memgraph) Satisfies(
) ([]string, error) {

matches := []string{}
// query, err := matcher.GenerateCypher(jobspec)

// Prepare query that looks for slots
// The slot STARTS at the first resource type and stops right after the slot
Expand Down

0 comments on commit c7ab752

Please sign in to comment.