BUG: Subflow trigger bugfixes

This commit is contained in:
frikky
2021-01-04 12:46:31 +01:00
parent 6a476660a9
commit bcefdcf873
10 changed files with 98 additions and 59 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-orborus
VERSION=0.8.5
VERSION=0.8.51
echo "Running docker build with $NAME:$VERSION"
#docker rmi frikky/shuffle:$NAME --force
+4 -6
View File
@@ -265,9 +265,7 @@ func initializeImages() {
// check whether they are the same first
images := []string{
//fmt.Sprintf("%s/%s:app_sdk%s", baseimageregistry, baseimagename, baseimagetagsuffix),
//fmt.Sprintf("%s/%s:worker%s", baseimageregistry, baseimagename, baseimagetagsuffix),
fmt.Sprintf("frikky/shuffle:app_sdk"),
fmt.Sprintf("%s/%s/shuffle-app_sdk:%s", baseimageregistry, baseimagename, appSdkVersion),
fmt.Sprintf("%s/%s/shuffle-worker:%s", baseimageregistry, baseimagename, workerVersion),
// fmt.Sprintf("docker.io/%s:app_sdk", baseimagename),
@@ -628,12 +626,12 @@ func getRunningWorkers(ctx context.Context, workerTimeout int) int {
// FIXME - add this to remove exited workers
// Should it check what happened to the execution? idk
func zombiecheck(ctx context.Context, workerTimeout int) error {
log.Println("[INFO] Looking for old containers")
log.Println("[INFO] Looking for old containers (zombies)")
containers, err := dockercli.ContainerList(ctx, types.ContainerListOptions{
All: true,
})
log.Printf("Len: %d", len(containers))
//log.Printf("Len: %d", len(containers))
if err != nil {
log.Printf("[ERROR] Failed creating Containerlist: %s", err)
@@ -676,7 +674,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error {
}
currenttime := time.Now().Unix()
log.Printf("[INFO] (%s) NAME: %s. TIME: %d", container.State, name, currenttime-container.Created)
//log.Printf("[INFO] (%s) NAME: %s. TIME: %d", container.State, name, currenttime-container.Created)
// Need to check time here too because a container can be removed the same instant as its created
if container.State != "running" && currenttime-container.Created > int64(workerTimeout) {
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-worker
VERSION=0.8.5
VERSION=0.8.51
echo "Running docker build with $NAME:$VERSION"
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
+22 -11
View File
@@ -1050,6 +1050,7 @@ func handleExecution(client *http.Client, req *http.Request, workflowExecution W
// source = parent node, dest = child node
// parent can have more children, child can have more parents
extra := 0
triggersHandled := []string{}
for _, branch := range workflowExecution.Workflow.Branches {
// Check what the parent is first. If it's trigger - skip
sourceFound := false
@@ -1065,20 +1066,30 @@ func handleExecution(client *http.Client, req *http.Request, workflowExecution W
}
for _, trigger := range workflowExecution.Workflow.Triggers {
log.Printf("Appname trigger: %s", trigger.AppName)
if !(trigger.AppName == "User Input" || trigger.AppName == "Shuffle Workflow") {
continue
}
if trigger.ID == branch.SourceID {
sourceFound = true
extra += 1
}
log.Printf("Appname trigger (0): %s", trigger.AppName)
if trigger.AppName == "User Input" || trigger.AppName == "Shuffle Workflow" {
log.Printf("%s is a special trigger. Checking where.", trigger.AppName)
if trigger.ID == branch.DestinationID {
destinationFound = true
found := false
for _, check := range triggersHandled {
if check == trigger.ID {
found = true
break
}
}
if !sourceFound {
if !found {
extra += 1
} else {
triggersHandled = append(triggersHandled, trigger.ID)
}
if trigger.ID == branch.SourceID {
log.Printf("Trigger %s is the source!", trigger.AppName)
sourceFound = true
} else if trigger.ID == branch.DestinationID {
log.Printf("Trigger %s is the destination!", trigger.AppName)
destinationFound = true
}
}
}