Fixed app sdk startnode failing when branches coming into it

This commit is contained in:
frikky
2022-05-20 01:07:05 +02:00
parent 3a7865df6d
commit 2167be32f5
5 changed files with 19 additions and 10 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ ORBORUS_CONTAINER_NAME= # Used to FIND the containername. cgroup v2: issue 50
SHUFFLE_BASE_IMAGE_NAME=frikky SHUFFLE_BASE_IMAGE_NAME=frikky
SHUFFLE_BASE_IMAGE_REGISTRY=ghcr.io SHUFFLE_BASE_IMAGE_REGISTRY=ghcr.io
SHUFFLE_BASE_IMAGE_TAG_SUFFIX="-0.8.80" SHUFFLE_BASE_IMAGE_TAG_SUFFIX="-1.0.0"
# Used for auto-cleanup of containers. REALLY important at scale. # Used for auto-cleanup of containers. REALLY important at scale.
SHUFFLE_CONTAINER_AUTO_CLEANUP=false SHUFFLE_CONTAINER_AUTO_CLEANUP=false
+10 -4
View File
@@ -380,17 +380,17 @@ class AppBase:
if not finished: if not finished:
# Not sure why this would work tho :) # Not sure why this would work tho :)
action_result["status"] = "FAILURE" action_result["status"] = "FAILURE"
action_result["result"] = f"POST failed to get info!" action_result["result"] = json.dumps({"success": False, "reason": "POST error: Failed connecting to %s over 5 retries" % url})
self.logger.info(f"[DEBUG] Before typeerror stream result - NOT finished") self.logger.info(f"[DEBUG] Before typeerror stream result - NOT finished after 5 requests")
ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=action_result) ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=action_result)
self.logger.info(f"""[DEBUG] Successful request result request: Status= {ret.status_code} & Response= {ret.text}. Action status: {action_result["status"]}""") self.logger.info(f"""[DEBUG] Successful request result request: Status= {ret.status_code} & Response= {ret.text}. Action status: {action_result["status"]}""")
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
self.logger.info(f"[DEBUG] Unexpected ConnectionError happened: {e}") self.logger.info(f"[DEBUG] Unexpected ConnectionError happened: {e}")
except TypeError as e: except TypeError as e:
#self.logger.exception(e)
action_result["status"] = "FAILURE" action_result["status"] = "FAILURE"
action_result["result"] = f"POST error: {e}" action_result["result"] = json.dumps({"success": False, "reason": "Typeerror when sending to backend URL %s" % url})
self.logger.info(f"[DEBUG] Before typeerror stream result: {e}") self.logger.info(f"[DEBUG] Before typeerror stream result: {e}")
ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=action_result) ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=action_result)
#self.logger.info(f"[DEBUG] Result: {ret.status_code}") #self.logger.info(f"[DEBUG] Result: {ret.status_code}")
@@ -2471,6 +2471,12 @@ class AppBase:
except KeyError: except KeyError:
return True, "" return True, ""
# Startnode should always run - no need to check incoming
try:
if action["id"] == fullexecution["start"]:
return True, ""
except Exception as error:
self.logger.info(f"[WARNING] Failed checking startnode: {error}")
available_checks = [ available_checks = [
"=", "=",
+1 -1
View File
@@ -2,7 +2,7 @@
### DEFAULT ### DEFAULT
NAME=shuffle-app_sdk NAME=shuffle-app_sdk
VERSION=1.0.1 VERSION=1.0.2
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly
+2 -2
View File
@@ -2,7 +2,7 @@ module main
go 1.16 go 1.16
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared //replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch //replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -24,7 +24,7 @@ require (
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.2.38 github.com/shuffle/shuffle-shared v0.2.44
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0 google.golang.org/api v0.65.0
+5 -2
View File
@@ -981,7 +981,8 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
} }
org, err := shuffle.GetOrg(ctx, userInfo.ActiveOrg.Id) org, err := shuffle.GetOrg(ctx, userInfo.ActiveOrg.Id)
if err == nil { //if err == nil {
if len(org.Id) > 0 {
userInfo.ActiveOrg = shuffle.OrgMini{ userInfo.ActiveOrg = shuffle.OrgMini{
Id: org.Id, Id: org.Id,
Name: org.Name, Name: org.Name,
@@ -990,6 +991,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
Image: org.Image, Image: org.Image,
} }
} }
//}
userInfo.ActiveOrg.Users = []shuffle.UserMini{} userInfo.ActiveOrg.Users = []shuffle.UserMini{}
userOrgs := []shuffle.OrgMini{} userOrgs := []shuffle.OrgMini{}
@@ -1000,7 +1002,8 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
} }
org, err := shuffle.GetOrg(ctx, item) org, err := shuffle.GetOrg(ctx, item)
if err == nil { _ = err
if len(org.Id) > 0 {
userOrgs = append(userOrgs, shuffle.OrgMini{ userOrgs = append(userOrgs, shuffle.OrgMini{
Id: org.Id, Id: org.Id,
Name: org.Name, Name: org.Name,