Reduced execution bytesize
This commit is contained in:
@@ -3535,7 +3535,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
for _, item := range hook.Workflows {
|
||||
log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start)
|
||||
//log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start)
|
||||
workflow := Workflow{
|
||||
ID: "",
|
||||
}
|
||||
|
||||
@@ -1727,6 +1727,7 @@ func setNewWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
action.IsValid = true
|
||||
}
|
||||
|
||||
action.LargeImage = ""
|
||||
newActions = append(newActions, action)
|
||||
}
|
||||
|
||||
@@ -2797,7 +2798,18 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
||||
|
||||
if len(workflow.Actions) == 0 {
|
||||
workflow.Actions = []Action{}
|
||||
} else {
|
||||
newactions := []Action{}
|
||||
for _, action := range workflow.Actions {
|
||||
action.LargeImage = ""
|
||||
action.SmallImage = ""
|
||||
newactions = append(newactions, action)
|
||||
log.Printf("ACTION: %#v", action)
|
||||
}
|
||||
|
||||
workflow.Actions = newactions
|
||||
}
|
||||
|
||||
if len(workflow.Branches) == 0 {
|
||||
workflow.Branches = []Branch{}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
frontend:
|
||||
build: ./frontend
|
||||
image: ghcr.io/frikky/shuffle-frontend:0.8.52
|
||||
#build: ./frontend
|
||||
image: ghcr.io/frikky/shuffle-frontend:0.8.51
|
||||
container_name: shuffle-frontend
|
||||
hostname: shuffle-frontend
|
||||
ports:
|
||||
|
||||
@@ -4479,10 +4479,14 @@ const AngularWorkflow = (props) => {
|
||||
setDestinationValue({})
|
||||
}}
|
||||
>
|
||||
<span style={{position: "absolute", bottom: 10, left: 10, color: "rgba(255,255,255,0.6)",}}>
|
||||
Conditions can't be used for loops [ .# ] <a target="_blank" href="https://shuffler.io/docs/workflows#conditions" style={{textDecoration: "none", color: "#f85a3e"}}>Learn more</a>
|
||||
</span>
|
||||
<FormControl>
|
||||
<DialogTitle><span style={{color:"white"}}>Condition</span>
|
||||
</DialogTitle>
|
||||
<DialogContent style={{}}>
|
||||
|
||||
<div style={{display: "flex"}}>
|
||||
<Tooltip color="primary" title={conditionValue.configuration ? "Negated" : "Default"} placement="top">
|
||||
<Button color="primary" variant={conditionValue.configuration ? "contained" : "outlined"} style={{margin: "auto", height: 50, marginBottom: "auto", marginTop: "auto", marginRight: 5}} onClick={(e) => {
|
||||
@@ -4567,9 +4571,6 @@ const AngularWorkflow = (props) => {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<span style={{marginTop: 15}}>
|
||||
Conditions can't be used for loops [ .# ]. <a target="_blank" href="https://shuffler.io/docs/conditions" style={{textDecoration: "none", color: "#f85a3e"}}>Learn more</a>
|
||||
</span>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
@@ -6246,7 +6247,12 @@ const AngularWorkflow = (props) => {
|
||||
|
||||
if (validate.valid) {
|
||||
if (typeof(validate.result) === "string") {
|
||||
validate.result = JSON.parse(validate.result)
|
||||
try {
|
||||
validate.result = JSON.parse(validate.result)
|
||||
} catch(e) {
|
||||
console.log("Error: ", e)
|
||||
validate.valid = false
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -6514,10 +6520,19 @@ const AngularWorkflow = (props) => {
|
||||
const curapp = apps.find(a => a.name === data.action.app_name && a.app_version === data.action.app_version)
|
||||
const imgsize = 50
|
||||
const statusColor = data.status === "FINISHED" || data.status === "SUCCESS" ? "green" : data.status === "ABORTED" || data.status === "FAILURE" ? "red" : "orange"
|
||||
|
||||
var imgSrc = curapp === undefined ? "" : curapp.large_image
|
||||
if (imgSrc.length === 0) {
|
||||
// Look for the node in the workflow
|
||||
const action = workflow.actions.find(action => action.id === data.action.id)
|
||||
if (action !== undefined && action !== null) {
|
||||
imgSrc = action.large_image
|
||||
}
|
||||
}
|
||||
|
||||
var actionimg = curapp === null ?
|
||||
null :
|
||||
<img alt={data.action.app_name} src={curapp === undefined ? "" : curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />
|
||||
<img alt={data.action.app_name} src={imgSrc} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />
|
||||
|
||||
if (triggers.length > 2) {
|
||||
if (data.action.app_name === "shuffle-subflow") {
|
||||
@@ -7047,8 +7062,8 @@ const AngularWorkflow = (props) => {
|
||||
console.log("FIELDS: ", newFields)
|
||||
newAuthOption.fields = newFields
|
||||
setNewAppAuth(newAuthOption)
|
||||
appAuthentication.push(newAuthOption)
|
||||
setAppAuthentication(appAuthentication)
|
||||
//appAuthentication.push(newAuthOption)
|
||||
//setAppAuthentication(appAuthentication)
|
||||
getAppAuthentication()
|
||||
setUpdate(authenticationOption.id)
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ export const validateJson = (showResult) => {
|
||||
}
|
||||
|
||||
const result = jsonvalid ? JSON.parse(showResult) : showResult
|
||||
//console.log("VALID: ", jsonvalid, result)
|
||||
return {
|
||||
"valid": jsonvalid,
|
||||
"result": result,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
GOOS=linux go build main.go
|
||||
zip function.zip main
|
||||
|
||||
aws lambda update-function-code \
|
||||
--function-name shuffler-forwarder \
|
||||
--runtime go1.* \
|
||||
--zip-file fileb://function.zip \
|
||||
--handler main \
|
||||
--role arn:aws:iam::123456789012:role/execution_role
|
||||
@@ -25,6 +25,8 @@ import (
|
||||
"github.com/satori/go.uuid"
|
||||
//network "github.com/docker/docker/api/types/network"
|
||||
//natting "github.com/docker/go-connections/nat"
|
||||
"github.com/mackerelio/go-osstat/cpu"
|
||||
"github.com/mackerelio/go-osstat/memory"
|
||||
)
|
||||
|
||||
// Starts jobs in bulk, so this could be increased
|
||||
@@ -297,6 +299,41 @@ func initializeImages() {
|
||||
}
|
||||
}
|
||||
|
||||
// Will be used for checking if there's enough to deploy based on a threshold
|
||||
// E.g. having maximum CPU and maxmimum RAM
|
||||
// Does this work containerized?
|
||||
func getStats() {
|
||||
fmt.Printf("\n")
|
||||
|
||||
memory, err := memory.Get()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("[INFO] memory total: %d bytes\n", memory.Total)
|
||||
fmt.Printf("[INFO] memory used: %d bytes\n", memory.Used)
|
||||
|
||||
before, err := cpu.Get()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Duration(500) * time.Millisecond)
|
||||
after, err := cpu.Get()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
return
|
||||
}
|
||||
total := float64(after.Total - before.Total)
|
||||
|
||||
fmt.Printf("[INFO] cpu used : %f%%\n", float64(after.User-before.User)/total*100)
|
||||
fmt.Printf("[INFO] cpu system: %f%%\n", float64(after.System-before.System)/total*100)
|
||||
fmt.Printf("[INFO] cpu idle : %f%%\n", float64(after.Idle-before.Idle)/total*100)
|
||||
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
|
||||
// Initial loop etc
|
||||
func main() {
|
||||
log.Println("[INFO] Setting up execution environment")
|
||||
@@ -371,6 +408,8 @@ func main() {
|
||||
},
|
||||
}
|
||||
|
||||
getStats()
|
||||
|
||||
if (len(httpProxy) > 0 || len(httpsProxy) > 0) && baseUrl != "http://shuffle-backend:5001" {
|
||||
client = &http.Client{}
|
||||
} else {
|
||||
|
||||
@@ -839,9 +839,10 @@ func shutdown(executionId, workflowId string) {
|
||||
log.Printf("[INFO] Failed abort request: %s", err)
|
||||
}
|
||||
|
||||
log.Printf("[INFO] Finished shutdown (after 15 seconds).")
|
||||
sleepDuration := 0
|
||||
log.Printf("[INFO] Finished shutdown (after %d seconds).", sleepDuration)
|
||||
// Allows everything to finish in subprocesses
|
||||
time.Sleep(time.Duration(15) * time.Second)
|
||||
time.Sleep(time.Duration(sleepDuration) * time.Second)
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
@@ -862,9 +863,10 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
log.Printf("[WARNING] Empty self container id, continue without NetworkMode")
|
||||
}
|
||||
|
||||
if cleanupEnv == "true" {
|
||||
hostConfig.AutoRemove = true
|
||||
}
|
||||
// Removing because log extraction should happen first
|
||||
//if cleanupEnv == "true" {
|
||||
// hostConfig.AutoRemove = true
|
||||
//}
|
||||
|
||||
config := &container.Config{
|
||||
Image: image,
|
||||
@@ -892,7 +894,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[INFO] Container %s is created for %s", cont.ID, identifier)
|
||||
log.Printf("[INFO] Container %s was created for %s", cont.ID, identifier)
|
||||
containerIds = append(containerIds, cont.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user