Minor orborus fix

This commit is contained in:
Frikky
2025-10-05 21:27:37 +02:00
parent 7cbd9456a2
commit 7dfbe3803d
+24 -20
View File
@@ -12,7 +12,6 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"regexp"
"log" "log"
"math" "math"
"net" "net"
@@ -20,6 +19,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
@@ -90,6 +90,7 @@ var debug = os.Getenv("DEBUG") == "true"
// var baseimagename = "shuffle/shuffle" // var baseimagename = "shuffle/shuffle"
var baseimageregistry = os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY") var baseimageregistry = os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")
var baseimagename = os.Getenv("SHUFFLE_BASE_IMAGE_NAME") var baseimagename = os.Getenv("SHUFFLE_BASE_IMAGE_NAME")
//var baseimagetagsuffix = os.Getenv("SHUFFLE_BASE_IMAGE_TAG_SUFFIX") //var baseimagetagsuffix = os.Getenv("SHUFFLE_BASE_IMAGE_TAG_SUFFIX")
// Used for cloud with auth. Onprem in certain cases too. // Used for cloud with auth. Onprem in certain cases too.
@@ -344,7 +345,7 @@ func deployServiceWorkers(image string) {
if len(dockerSwarmBridgeMTU) == 0 { if len(dockerSwarmBridgeMTU) == 0 {
mtu, err = strconv.Atoi(dockerSwarmBridgeMTU) // by default mtu, err = strconv.Atoi(dockerSwarmBridgeMTU) // by default
if err != nil { if err != nil {
if debug { if debug {
log.Printf("[DEBUG] Failed to convert the default MTU to int: %s. Using 1500 instead. Input: %s", err, dockerSwarmBridgeMTU) log.Printf("[DEBUG] Failed to convert the default MTU to int: %s. Using 1500 instead. Input: %s", err, dockerSwarmBridgeMTU)
} }
@@ -531,7 +532,6 @@ func deployServiceWorkers(image string) {
nodeCount = uint64(cnt) nodeCount = uint64(cnt)
} }
appReplicas := os.Getenv("SHUFFLE_APP_REPLICAS") appReplicas := os.Getenv("SHUFFLE_APP_REPLICAS")
appReplicaCnt := 2 appReplicaCnt := 2
if len(appReplicas) > 0 { if len(appReplicas) > 0 {
@@ -2496,6 +2496,8 @@ func main() {
// Looking for specific jobs // Looking for specific jobs
if incRequest.Type == "PIPELINE_CREATE" || incRequest.Type == "PIPELINE_START" || incRequest.Type == "PIPELINE_STOP" || incRequest.Type == "PIPELINE_DELETE" { if incRequest.Type == "PIPELINE_CREATE" || incRequest.Type == "PIPELINE_START" || incRequest.Type == "PIPELINE_STOP" || incRequest.Type == "PIPELINE_DELETE" {
log.Printf("[INFO] Handling pipeline request from backend: '%s' with argument '%s'", incRequest.Type, incRequest.ExecutionArgument)
//os.Setenv("SHUFFLE_SKIP_PIPELINES", "false") //os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
tenzirDisabled = false tenzirDisabled = false
@@ -2640,7 +2642,7 @@ func main() {
executionRequests.Data = executionRequests.Data[0:allowed] executionRequests.Data = executionRequests.Data[0:allowed]
} }
} else if swarmControlMode && (swarmConfig == "run" || swarmConfig == "swarm") { } else if swarmControlMode && (swarmConfig == "run" || swarmConfig == "swarm") {
// any reason it is not maxConcurrency instead of // any reason it is not maxConcurrency instead of
// hardcoded 50? // hardcoded 50?
if len(executionRequests.Data) > 50 { if len(executionRequests.Data) > 50 {
executionRequests.Data = executionRequests.Data[0:50] executionRequests.Data = executionRequests.Data[0:50]
@@ -2842,19 +2844,16 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error {
return err return err
} }
} else if incRequest.Type == "PIPELINE_DELETE" || incRequest.Type == "PIPELINE_STOP" { } else if incRequest.Type == "PIPELINE_DELETE" || incRequest.Type == "PIPELINE_STOP" {
{ pipelineId := incRequest.ExecutionId
log.Printf("[INFO] Should delete pipeline %#v", identifier) log.Printf("[INFO] Should delete pipeline %#v. PipelineID: %s", identifier, pipelineId)
pipelineId, err := searchPipeline(identifier) //pipelineId, err := searchPipeline(identifier)
if err != nil { //if err != nil {
log.Printf("[ERROR] Failed searching for Pipeline with name %s reason:%s ", identifier, err) //}
return err
}
err = deletePipeline(pipelineId) err = deletePipeline(pipelineId)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed Deleting Pipeline %s", err) log.Printf("[ERROR] Failed Deleting Pipeline %s", err)
return err return err
}
} }
/* /*
@@ -2888,6 +2887,7 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error {
log.Printf("[ERROR] Failed searching for Pipeline with name %s reason:%s ", identifier, err) log.Printf("[ERROR] Failed searching for Pipeline with name %s reason:%s ", identifier, err)
return err return err
} }
_, err = updatePipelineState(command, pipelineId, "start") _, err = updatePipelineState(command, pipelineId, "start")
if err != nil { if err != nil {
log.Printf("[ERROR] Failed to start Pipeline: %s reason:%s ", pipelineId, err) log.Printf("[ERROR] Failed to start Pipeline: %s reason:%s ", pipelineId, err)
@@ -3027,7 +3027,9 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
ExposedPorts: nat.PortSet{ ExposedPorts: nat.PortSet{
"5160/tcp": struct{}{}, "5160/tcp": struct{}{},
"514/udp": struct{}{}, "514/udp": struct{}{},
"1514/udp": struct{}{},
"514/tcp": struct{}{}, "514/tcp": struct{}{},
"1514/tcp": struct{}{},
}, },
Entrypoint: []string{containerName}, Entrypoint: []string{containerName},
Env: []string{}, Env: []string{},
@@ -3075,6 +3077,8 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
PortBindings: nat.PortMap{ PortBindings: nat.PortMap{
"514/tcp": []nat.PortBinding{{HostPort: "514"}}, "514/tcp": []nat.PortBinding{{HostPort: "514"}},
"514/udp": []nat.PortBinding{{HostPort: "514"}}, "514/udp": []nat.PortBinding{{HostPort: "514"}},
"1514/tcp": []nat.PortBinding{{HostPort: "1514"}},
"1514/udp": []nat.PortBinding{{HostPort: "1514"}},
"5160/tcp": []nat.PortBinding{{HostPort: "5160"}}, "5160/tcp": []nat.PortBinding{{HostPort: "5160"}},
}, },
Mounts: []mount.Mount{ Mounts: []mount.Mount{
@@ -3286,9 +3290,9 @@ func createPipeline(command, identifier string) (string, error) {
//command = "from file /var/lib/tenzir/sysmon_logs.ndjson read json | import" //command = "from file /var/lib/tenzir/sysmon_logs.ndjson read json | import"
requestBody := map[string]interface{}{ requestBody := map[string]interface{}{
"definition": command, "definition": command,
"name": identifier, "name": identifier,
"hidden": false, "hidden": false,
"retry_delay": "500.0ms", "retry_delay": "500.0ms",
"autostart": map[string]bool{ "autostart": map[string]bool{
//"created": true, //"created": true,
@@ -4072,7 +4076,7 @@ func sendWorkerRequest(workflowExecution shuffle.ExecutionRequest, image string,
// Specific to debugging // Specific to debugging
if len(workerServerUrl) == 0 { if len(workerServerUrl) == 0 {
if debug { if debug {
log.Printf("[INFO] Using default worker server url as previous is invalid: %s. Swapping to shuffle-workers:33333", streamUrl) log.Printf("[INFO] Using default worker server url as previous is invalid: %s. Swapping to shuffle-workers:33333", streamUrl)
} }
} }