Skip to content

Commit 0ccc5d1

Browse files
committed
Keeping manual fixes of functions during override
1 parent a99f8ce commit 0ccc5d1

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

app_upload/stitcher.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,32 @@ func deployFunction(appname, localization, applocation string, environmentVariab
437437
if err != nil {
438438
log.Println("[WARNING] Failed creating new function. Attempting patch, as it might exist already")
439439

440+
// Get the function
441+
// Then replicate environment variables, maxinstance & memory
442+
getcall := projectsLocationsFunctionsService.Get(fmt.Sprintf("%s/functions/%s", location, appname))
443+
existingFunction, err := getcall.Do()
444+
if err != nil {
445+
log.Printf("[WARNING] Failed getting existing function: %s", err)
446+
} else {
447+
// Timeout
448+
if len(existingFunction.Timeout) > 0 {
449+
cloudFunction.Timeout = existingFunction.Timeout
450+
}
451+
452+
if len(existingFunction.EnvironmentVariables) > 1 {
453+
cloudFunction.EnvironmentVariables = existingFunction.EnvironmentVariables
454+
}
455+
456+
if existingFunction.MaxInstances > 0 {
457+
cloudFunction.MaxInstances = existingFunction.MaxInstances
458+
}
459+
460+
if existingFunction.AvailableMemoryMb > 0 {
461+
cloudFunction.AvailableMemoryMb = existingFunction.AvailableMemoryMb
462+
}
463+
}
464+
465+
440466
patchCall := projectsLocationsFunctionsService.Patch(fmt.Sprintf("%s/functions/%s", location, appname), cloudFunction)
441467
_, err = patchCall.Do()
442468
if err != nil {
@@ -866,8 +892,8 @@ func main() {
866892
bucketName = os.Args[5]
867893
}
868894

869-
appname := "shuffle-tools"
870-
appversion := "1.2.0"
895+
appname := "http"
896+
appversion := "1.4.0"
871897
err := deployConfigToBackend(appfolder, appname, appversion)
872898
if err != nil {
873899
log.Printf("[WARNING] Failed uploading config: %s", err)

codegen.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3721,7 +3721,7 @@ func HandlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
37213721
}
37223722

37233723
func GetAppRequirements() string {
3724-
return "requests==2.32.3\nurllib3==2.3.0\nliquidpy==0.8.2\nMarkupSafe==3.0.2\nflask[async]==3.1.0\npython-dateutil==2.9.0.post0\nPyJWT==2.10.1\nshufflepy==0.0.7\nshuffle-sdk==0.0.13\n"
3724+
return "requests==2.32.3\nurllib3==2.3.0\nliquidpy==0.8.2\nMarkupSafe==3.0.2\nflask[async]==3.1.0\npython-dateutil==2.9.0.post0\nPyJWT==2.10.1\nshufflepy==0.0.7\nshuffle-sdk==0.0.18\n"
37253725
}
37263726

37273727
// Removes JSON values from the input
@@ -3917,6 +3917,7 @@ func DownloadDockerImageBackend(topClient *http.Client, imageName string) error
39173917
}
39183918

39193919
if isCloudDownload {
3920+
log.Printf("[DEBUG] Running GET request for cloud download for URL %s", dockerImgUrl)
39203921
req.Method = "GET"
39213922
req.Body = nil
39223923
}
@@ -3948,6 +3949,8 @@ func DownloadDockerImageBackend(topClient *http.Client, imageName string) error
39483949
return err
39493950
}
39503951

3952+
log.Printf("[DEBUG] Redirected download URL: %s", newresp.Request.URL.String())
3953+
39513954
defer newresp.Body.Close()
39523955
if newresp.StatusCode != 200 {
39533956
log.Printf("[ERROR] Docker download for image %s (backend) StatusCode (1): %d", imageName, newresp.StatusCode)
@@ -3969,8 +3972,8 @@ func DownloadDockerImageBackend(topClient *http.Client, imageName string) error
39693972
log.Printf("[WARNING] Failed response body copying: %s", err)
39703973
return err
39713974
}
3972-
tar.Seek(0, 0)
39733975

3976+
tar.Seek(0, 0)
39743977
dockercli, err := docker.NewEnvClient()
39753978
if err != nil {
39763979
log.Printf("[ERROR] Unable to create docker client (3): %s", err)
@@ -3981,14 +3984,14 @@ func DownloadDockerImageBackend(topClient *http.Client, imageName string) error
39813984

39823985
imageLoadResponse, err := dockercli.ImageLoad(context.Background(), tar, true)
39833986
if err != nil {
3984-
log.Printf("[ERROR] Error loading images: %s", err)
3987+
log.Printf("[ERROR] Failed loading docker images: %s", err)
39853988
return err
39863989
}
39873990

39883991
defer imageLoadResponse.Body.Close()
39893992
body, err := ioutil.ReadAll(imageLoadResponse.Body)
39903993
if err != nil {
3991-
log.Printf("[ERROR] Error reading: %s", err)
3994+
log.Printf("[ERROR] Failed reading docker image: %s", err)
39923995
return err
39933996
}
39943997

db-connector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12813,11 +12813,11 @@ func GetEsConfig(defaultCreds bool) *opensearch.Client {
1281312813

1281412814
log.Printf("[INFO] Added certificate %s elastic client.", certificateLocation)
1281512815
}
12816-
config.Transport = transport
1281712816

12817+
config.Transport = transport
1281812818
es, err := opensearch.NewClient(config)
1281912819
if err != nil {
12820-
log.Fatalf("[DEBUG] Database client for ELASTICSEARCH error during init (fatal): %s", err)
12820+
log.Fatalf("[ERROR] Database client for ELASTICSEARCH error during init (fatal): %s", err)
1282112821
}
1282212822

1282312823
return es

0 commit comments

Comments
 (0)