Optimize: Made Workflow workers self-destruct at times

This commit is contained in:
frikky
2021-01-14 17:01:11 +01:00
parent 34097f971e
commit 3b6501c56c
12 changed files with 162 additions and 158 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class AppBase:
# apikey is for the user / org
# authorization is for the specific workflow
self.url = os.getenv("CALLBACK_URL", "https://shuffler.io")
self.base_url = os.getenv("BASE_URL", "https://shuffler.io")
self.base_url = os.getenv("BASE_URL", "")
self.action = os.getenv("ACTION", "")
self.authorization = os.getenv("AUTHORIZATION", "")
self.current_execution_id = os.getenv("EXECUTIONID", "")
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
NAME=shuffle-app_sdk
VERSION=0.8.52
VERSION=0.8.53
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
+5 -6
View File
@@ -397,12 +397,11 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
verifyAddin,
)
/*
if strings.Contains(functionname, "search") {
log.Println(data)
log.Printf("Queries: %s", queryString)
}
*/
//log.Printf("FUNCTION: %s", data)
//if strings.Contains(functionname, "search") {
// log.Println(data)
// log.Printf("Queries: %s", queryString)
//}
//log.Printf(data)
return functionname, data
+9 -6
View File
@@ -917,12 +917,13 @@ func validateNewWorkerExecution(body []byte) error {
return errors.New("Bad authorization when validating execution")
}
// used to validate if it's actually the right marshal
if len(baseExecution.Workflow.Actions) != len(execution.Workflow.Actions) {
return errors.New(fmt.Sprintf("Bad length of actions: %d", len(execution.Workflow.Actions)))
return errors.New(fmt.Sprintf("Bad length of actions (probably normal app): %d", len(execution.Workflow.Actions)))
}
if len(baseExecution.Workflow.Triggers) != len(execution.Workflow.Triggers) {
return errors.New(fmt.Sprintf("Bad length of trigger: %d", len(execution.Workflow.Triggers)))
return errors.New(fmt.Sprintf("Bad length of trigger: %d (probably normal app)", len(execution.Workflow.Triggers)))
}
// FIXME: Add extra here
@@ -933,8 +934,11 @@ func validateNewWorkerExecution(body []byte) error {
//log.Printf("\n\nSHOULD SET BACKEND DATA FOR EXEC \n\n")
err = setWorkflowExecution(ctx, execution, true)
if err != nil {
log.Printf("Successfully set the execution to wait.")
if err == nil {
log.Printf("[INFO] Set workflowexecution based on new worker (>0.8.53) for execution %s", baseExecution.ExecutionId)
//log.Printf("[INFO] Successfully set the execution to wait.")
} else {
log.Printf("[WARNING] Failed to set the execution to wait.")
}
return nil
@@ -957,12 +961,11 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
//log.Printf("Actionresult unmarshal: %s", string(body))
err = validateNewWorkerExecution(body)
if err == nil {
log.Printf("[INFO] Set workflowexecution based on new worker")
resp.WriteHeader(200)
resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "Success"}`)))
return
} else {
log.Printf("[WARNING] Failed to handle new execution variant: %s", err)
//log.Printf("[WARNING] Failed to handle new execution variant: %s", err)
}
var actionResult ActionResult