Fixed more issues with worker grabbing logs
This commit is contained in:
@@ -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.")
|
||||
|
||||
##############################################
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user