Skip to content

Commit d400b6d

Browse files
committed
fix: large executions not working in non-main regions
1 parent 1778de5 commit d400b6d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

db-connector.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,9 @@ func GetExecutionVariables(ctx context.Context, executionId string) (string, int
15831583
}
15841584

15851585
func getExecutionFileValue(ctx context.Context, workflowExecution WorkflowExecution, action ActionResult) (string, error) {
1586+
projectName := os.Getenv("SHUFFLE_GCEPROJECT")
1587+
bucketName := project.BucketName
1588+
15861589
fullParsedPath := fmt.Sprintf("large_executions/%s/%s_%s", workflowExecution.ExecutionOrg, workflowExecution.ExecutionId, action.Action.ID)
15871590

15881591
cacheKey := fmt.Sprintf("%s_%s_action_replace", workflowExecution.ExecutionId, action.Action.ID)
@@ -1594,10 +1597,24 @@ func getExecutionFileValue(ctx context.Context, workflowExecution WorkflowExecut
15941597
}
15951598
}
15961599

1597-
bucket := project.StorageClient.Bucket(project.BucketName)
1600+
bucket := project.StorageClient.Bucket(bucketName)
15981601
obj := bucket.Object(fullParsedPath)
15991602
fileReader, err := obj.NewReader(ctx)
16001603
if err != nil {
1604+
log.Printf("[ERROR] Failed reading file from bucket %s: %s. Will try with alternative solution.", bucketName, err)
1605+
1606+
// try reading instead from other bucket
1607+
if projectName != "shuffler" {
1608+
bucketName = fmt.Sprintf("%s.appspot.com", projectName)
1609+
}
1610+
1611+
bucket = project.StorageClient.Bucket(bucketName)
1612+
obj = bucket.Object(fullParsedPath)
1613+
fileReader, err = obj.NewReader(ctx)
1614+
if err != nil {
1615+
log.Printf("[ERROR] Failed reading file again from bucket %s: %s", bucketName, err)
1616+
}
1617+
16011618
return "", err
16021619
}
16031620

0 commit comments

Comments
 (0)