Minor fixes for queue management onprem

This commit is contained in:
Frikky
2024-01-23 01:30:11 +01:00
parent 990ba015fd
commit c220d9c4a5
3 changed files with 91 additions and 57 deletions
+5 -1
View File
@@ -421,7 +421,11 @@ const AppStats = (defaultprops) => {
}>
<Paper style={paperStyle}>
<Typography variant="h4">
${apprunCost}
{selectedOrganization.lead_info.customer === false && selectedOrganization.lead_info.pov === false ?
0
:
apprunCost
}
</Typography>
<Typography variant="h6">
Period Cost
+61 -44
View File
@@ -1011,62 +1011,62 @@ If you're interested, please let me know a time that works for you, or set up a
responseJson.sync_features = {};
}
if (responseJson.lead_info !== undefined && responseJson.lead_info !== null) {
var leads = []
if (responseJson.lead_info.contacted) {
leads.push("contacted")
}
if (responseJson.lead_info !== undefined && responseJson.lead_info !== null) {
var leads = []
if (responseJson.lead_info.contacted) {
leads.push("contacted")
}
if (responseJson.lead_info.customer) {
leads.push("customer")
}
if (responseJson.lead_info.customer) {
leads.push("customer")
}
if (responseJson.lead_info.old_customer) {
leads.push("old customer")
}
if (responseJson.lead_info.old_customer) {
leads.push("old customer")
}
if (responseJson.lead_info.old_lead) {
leads.push("old lead")
}
if (responseJson.lead_info.old_lead) {
leads.push("old lead")
}
if (responseJson.lead_info.tech_partner) {
leads.push("tech partner")
}
if (responseJson.lead_info.tech_partner) {
leads.push("tech partner")
}
if (responseJson.lead_info.creator) {
leads.push("creator")
}
if (responseJson.lead_info.creator) {
leads.push("creator")
}
if (responseJson.lead_info.opensource) {
leads.push("open source")
}
if (responseJson.lead_info.opensource) {
leads.push("open source")
}
if (responseJson.lead_info.demo_done) {
leads.push("demo done")
}
if (responseJson.lead_info.demo_done) {
leads.push("demo done")
}
if (responseJson.lead_info.pov) {
leads.push("pov")
}
if (responseJson.lead_info.pov) {
leads.push("pov")
}
if (responseJson.lead_info.lead) {
leads.push("lead")
}
if (responseJson.lead_info.lead) {
leads.push("lead")
}
if (responseJson.lead_info.student) {
leads.push("student")
}
if (responseJson.lead_info.student) {
leads.push("student")
}
if (responseJson.lead_info.internal) {
leads.push("internal")
}
if (responseJson.lead_info.internal) {
leads.push("internal")
}
if (responseJson.lead_info.sub_org) {
leads.push("sub_org")
}
if (responseJson.lead_info.sub_org) {
leads.push("sub_org")
}
setSelectedStatus(leads)
}
setSelectedStatus(leads)
}
setSelectedOrganization(responseJson)
var lists = {
@@ -1503,6 +1503,19 @@ If you're interested, please let me know a time that works for you, or set up a
})
.then((responseJson) => {
setEnvironments(responseJson);
// Helper info for users in case they have a large queue and don't know about queue flushing
if (responseJson !== undefined && responseJson !== null && responseJson.length > 0) {
for (var i = 0; i < responseJson.length; i++) {
const env = responseJson[i];
// Check if queuesize is too large
if (env.queue !== undefined && env.queue !== null && env.queue > 100) {
toast("Queue size for " + env.name + " is very large. We recommend you to reduce it by flushing the queue before continuing.");
break
}
}
}
})
.catch((error) => {
toast(error.toString());
@@ -2405,6 +2418,10 @@ If you're interested, please let me know a time that works for you, or set up a
<span
style={{cursor: "pointer", marginTop: 5, }}
onClick={(e) => {
if (!isCloud || userdata.support !== true) {
return
}
e.preventDefault();
e.stopPropagation();
@@ -4269,7 +4286,7 @@ If you're interested, please let me know a time that works for you, or set up a
//console.log("Show CPU alert: ", showCPUAlert)
const queueSize = environment.queue !== undefined && environment.queue !== null ? environment.queue < 0 ? 0 : environment.queue > 99 ? ">99" : environment.queue : 0
const queueSize = environment.queue !== undefined && environment.queue !== null ? environment.queue < 0 ? 0 : environment.queue > 1000 ? ">1000" : environment.queue : 0
return (
<span key={index}>
+25 -12
View File
@@ -396,16 +396,16 @@ func deployServiceWorkers(image string) {
}
innerContainerName := fmt.Sprintf("shuffle-workers")
cnt, _ := findActiveSwarmNodes()
cnt, err := findActiveSwarmNodes()
if err != nil {
log.Printf("[ERROR] Failed to find active swarm nodes: %s. Defaulting to 1", err)
}
nodeCount := uint64(1)
if cnt > 0 {
nodeCount = uint64(cnt)
}
if cnt == 0 {
cnt = 1
}
appReplicas := os.Getenv("SHUFFLE_APP_REPLICAS")
appReplicaCnt := 1
if len(appReplicas) > 0 {
@@ -477,6 +477,7 @@ func deployServiceWorkers(image string) {
fmt.Sprintf("SHUFFLE_LOGS_DISABLED=%s", os.Getenv("SHUFFLE_LOGS_DISABLED")),
fmt.Sprintf("DEBUG_MEMORY=%s", os.Getenv("DEBUG_MEMORY")),
fmt.Sprintf("SHUFFLE_APP_SDK_TIMEOUT=%s", os.Getenv("SHUFFLE_APP_SDK_TIMEOUT")),
fmt.Sprintf("SHUFFLE_MAX_SWARM_NODES=%d", os.Getenv("SHUFFLE_MAX_SWARM_NODES")),
},
//Hosts: []string{
// innerContainerName,
@@ -927,7 +928,7 @@ func findActiveSwarmNodes() (int64, error) {
ctx := context.Background()
nodes, err := dockercli.NodeList(ctx, types.NodeListOptions{})
if err != nil {
return 0, err
return 1, err
}
nodeCount := int64(0)
@@ -938,13 +939,21 @@ func findActiveSwarmNodes() (int64, error) {
}
}
return nodeCount, nil
// Check for SHUFFLE_MAX_NODES
// Make it into a number and check if it's lower than nodeCount
maxNodesString := os.Getenv("SHUFFLE_MAX_SWARM_NODES")
if len(maxNodesString) > 0 {
maxNodes, err := strconv.ParseInt(maxNodesString, 10, 64)
if err != nil {
return nodeCount, err
}
/*
containers, err := dockercli.ContainerList(ctx, types.ContainerListOptions{
All: true,
})
*/
if nodeCount > maxNodes {
nodeCount = maxNodes
}
}
return nodeCount, nil
}
// Get IP
@@ -1634,6 +1643,10 @@ func main() {
env = append(env, fmt.Sprintf("SHUFFLE_INTERNAL_HTTPS_PROXY=%s", overrideHttpsProxy))
}
if len(os.Getenv("SHUFFLE_MAX_SWARM_NODES")) > 0 {
env = append(env, fmt.Sprintf("SHUFFLE_MAX_SWARM_NODES=%s", os.Getenv("SHUFFLE_MAX_SWARM_NODES")))
}
err = deployWorker(workerImage, containerName, env, execution)
zombiecounter += 1
if err == nil {