Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: matches not accounted for with go client #35

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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