diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 2d73798b..c2acb4d0 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -2879,7 +2879,8 @@ class AppBase: logging.basicConfig(format="{asctime} - {name} - {levelname}:{message}", style='{') logger = logging.getLogger(f"{cls.__name__}") logger.setLevel(logging.DEBUG) - + + logger.info("[DEBUG] Normal execution.") ############################################## diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index eee9f8fa..7ff6a07c 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -3,7 +3,7 @@ ### DEFAULT NAME=shuffle-app_sdk -VERSION=0.9.31 +VERSION=0.9.32 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 diff --git a/docker-compose.yml b/docker-compose.yml index 2c432599..8a8ba025 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,7 +47,7 @@ services: volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - - SHUFFLE_WORKER_VERSION=0.9.25 + - SHUFFLE_WORKER_VERSION=nightly - ORG_ID=${ORG_ID} - ENVIRONMENT_NAME=${ENVIRONMENT_NAME} - BASE_URL=http://${OUTER_HOSTNAME}:${BACKEND_PORT} diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 9a743250..c10552a9 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -225,13 +225,14 @@ func deployServiceWorkers(image string) { replicas := uint64(2) scaleReplicas := os.Getenv("SHUFFLE_SCALE_REPLICAS") if len(scaleReplicas) > 0 { - log.Printf("[DEBUG] SHUFFLE_SCALE_REPLICAS set to value %#v. Trying to overwrite default (2/node)", scaleReplicas) tmpInt, err := strconv.Atoi(scaleReplicas) if err != nil { log.Printf("[ERROR] %s is not a valid number for replication", scaleReplicas) } else { replicas = uint64(tmpInt) } + + log.Printf("[DEBUG] SHUFFLE_SCALE_REPLICAS set to value %#v. Trying to overwrite default (%d/node)", scaleReplicas, replicas) } innerContainerName := fmt.Sprintf("shuffle-workers") diff --git a/functions/onprem/worker/go.sum b/functions/onprem/worker/go.sum index 10b422b8..1ac1b966 100644 --- a/functions/onprem/worker/go.sum +++ b/functions/onprem/worker/go.sum @@ -570,6 +570,8 @@ github.com/shuffle/shuffle-shared v0.1.31 h1:+7OCH8G2fcg0Emqw3AR4iRZ9aFOEshi83HT github.com/shuffle/shuffle-shared v0.1.31/go.mod h1:0QrK51T12CpCj/be8hXduj/RtDnoeaZ3rfogELZE2IU= github.com/shuffle/shuffle-shared v0.1.32 h1:VzYecAkUbydIe5ufe5z6T+3PaaKWJASVznhUdxoBe3M= github.com/shuffle/shuffle-shared v0.1.32/go.mod h1:0QrK51T12CpCj/be8hXduj/RtDnoeaZ3rfogELZE2IU= +github.com/shuffle/shuffle-shared v0.1.33 h1:1U0yKWNfW7K7EKOj2aqSmd20UIA+nJeIurGEfx29ffU= +github.com/shuffle/shuffle-shared v0.1.33/go.mod h1:0QrK51T12CpCj/be8hXduj/RtDnoeaZ3rfogELZE2IU= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 06d08e80..58ad67b7 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -401,46 +401,48 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] if workflowExecution.ExecutionSource != "default" { log.Printf("[INFO] Handling NON-default execution source %s - NOT waiting or validating!", workflowExecution.ExecutionSource) } else if workflowExecution.ExecutionSource == "default" { - time.Sleep(2 * time.Second) + /* + time.Sleep(2 * time.Second) - stats, err := cli.ContainerInspect(ctx, cont.ID) - if err != nil { - log.Printf("[ERROR] Failed getting container stats for container %s: %s", cont.ID, err) - } else { - //log.Printf("[INFO] Info for container: %#v", stats) - //log.Printf("%#v", stats.Config) - //log.Printf("%#v", stats.ContainerJSONBase.State) - log.Printf("[DEBUG] EXECUTION STATUS: %s", stats.ContainerJSONBase.State.Status) - logOptions := types.ContainerLogsOptions{ - ShowStdout: true, - } - - exit := false - out, err := cli.ContainerLogs(ctx, cont.ID, logOptions) + stats, err := cli.ContainerInspect(ctx, cont.ID) if err != nil { - log.Printf("[INFO] Failed getting logs: %s", err) + log.Printf("[ERROR] Failed getting container stats for container %s: %s", cont.ID, err) } else { - buf := new(strings.Builder) - io.Copy(buf, out) - logs := buf.String() + //log.Printf("[INFO] Info for container: %#v", stats) + //log.Printf("%#v", stats.Config) + //log.Printf("%#v", stats.ContainerJSONBase.State) + log.Printf("[DEBUG] EXECUTION STATUS: %s", stats.ContainerJSONBase.State.Status) + logOptions := types.ContainerLogsOptions{ + ShowStdout: true, + } - // FIXME: Re-add log tracking which can be sent to backend - //allLogs[actionId] = logs + exit := false + out, err := cli.ContainerLogs(ctx, cont.ID, logOptions) + if err != nil { + log.Printf("[INFO] Failed getting logs: %s", err) + } else { + buf := new(strings.Builder) + io.Copy(buf, out) + logs := buf.String() - if stats.ContainerJSONBase.State.Status == "exited" && (!strings.Contains(logs, "Normal execution.") && !strings.Contains(logs, "indicates microservices")) { + // FIXME: Re-add log tracking which can be sent to backend + //allLogs[actionId] = logs - if len(logs) > 10 { - log.Printf("[ERROR] BAD Execution Logs for %s: %s", action.ID, logs) - exit = true + if stats.ContainerJSONBase.State.Status == "exited" && (!strings.Contains(logs, "Normal execution") && !strings.Contains(logs, "indicates microservices") && !strings.Contains(logs, "starting action result")) { + if len(logs) > 10 { + log.Printf("[ERROR] BAD Execution Logs for %s: %s", action.ID, logs) + exit = true + } } } - } - if exit { - log.Printf("[DEBUG] ERROR IN CONTAINER DEPLOYMENT - ITS EXITED!") - return errors.New(fmt.Sprintf(`{"success": false, "reason": "Container %s exited prematurely.","debug": "docker logs -f %s"}`, cont.ID, cont.ID)) + if exit { + log.Printf("[DEBUG] ERROR IN CONTAINER DEPLOYMENT - ITS EXITED!") + return errors.New(fmt.Sprintf(`{"success": false, "reason": "Container %s exited prematurely.","debug": "docker logs -f %s"}`, cont.ID, cont.ID)) + } } - } + */ + log.Printf("[INFO] Handling DEFAULT execution source %s - SKIPPING wait anyway due to exited issues!", workflowExecution.ExecutionSource) } log.Printf("[DEBUG] Deployed container ID %s", cont.ID)