Optimize: Started work on an updated worker
This commit is contained in:
@@ -38,8 +38,10 @@ class AppBase:
|
|||||||
|
|
||||||
# I wonder if this actually works
|
# I wonder if this actually works
|
||||||
self.logger.info("Before last stream result")
|
self.logger.info("Before last stream result")
|
||||||
|
url = "%s%s" % (self.url, stream_path)
|
||||||
|
print("URL: %s" % url)
|
||||||
try:
|
try:
|
||||||
ret = requests.post("%s%s" % (self.url, stream_path), headers=headers, json=action_result)
|
ret = requests.post(url, headers=headers, json=action_result)
|
||||||
self.logger.info("Result: %d" % ret.status_code)
|
self.logger.info("Result: %d" % ret.status_code)
|
||||||
if ret.status_code != 200:
|
if ret.status_code != 200:
|
||||||
self.logger.info(ret.text)
|
self.logger.info(ret.text)
|
||||||
|
|||||||
@@ -1307,10 +1307,10 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
|
|||||||
workflowExecution.LastNode = actionResult.Action.ID
|
workflowExecution.LastNode = actionResult.Action.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
err = increaseStatisticsField(ctx, "workflow_executions_success", workflowExecution.Workflow.ID, 1, workflowExecution.ExecutionOrg)
|
//err = increaseStatisticsField(ctx, "workflow_executions_success", workflowExecution.Workflow.ID, 1, workflowExecution.ExecutionOrg)
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
log.Printf("Failed to increase success execution stats: %s", err)
|
// log.Printf("Failed to increase success execution stats: %s", err)
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Handles extra statistics stuff when it's done
|
// Handles extra statistics stuff when it's done
|
||||||
// Does autocomplete magic with JSON
|
// Does autocomplete magic with JSON
|
||||||
@@ -2776,6 +2776,9 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
|
|
||||||
// This one doesn't really matter.
|
// This one doesn't really matter.
|
||||||
log.Printf("[INFO] Running POST execution with body of length %d", len(string(body)))
|
log.Printf("[INFO] Running POST execution with body of length %d", len(string(body)))
|
||||||
|
if len(string(body)) < 50 {
|
||||||
|
log.Printf("Body: %s", string(body))
|
||||||
|
}
|
||||||
var execution ExecutionRequest
|
var execution ExecutionRequest
|
||||||
err = json.Unmarshal(body, &execution)
|
err = json.Unmarshal(body, &execution)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
environment:
|
environment:
|
||||||
- SHUFFLE_APP_SDK_VERSION=0.8.51
|
- SHUFFLE_APP_SDK_VERSION=0.8.51
|
||||||
- SHUFFLE_WORKER_VERSION=0.8.51
|
- SHUFFLE_WORKER_VERSION=0.8.5
|
||||||
- ORG_ID=${ORG_ID}
|
- ORG_ID=${ORG_ID}
|
||||||
- ENVIRONMENT_NAME=${ENVIRONMENT_NAME}
|
- ENVIRONMENT_NAME=${ENVIRONMENT_NAME}
|
||||||
- BASE_URL=http://${OUTER_HOSTNAME}:${BACKEND_PORT}
|
- BASE_URL=http://${OUTER_HOSTNAME}:${BACKEND_PORT}
|
||||||
|
|||||||
@@ -573,7 +573,9 @@ const AngularWorkflow = (props) => {
|
|||||||
currentnode.addClass('failure-highlight')
|
currentnode.addClass('failure-highlight')
|
||||||
|
|
||||||
if (!visited.includes(item.action.label)) {
|
if (!visited.includes(item.action.label)) {
|
||||||
alert.error("Error for "+item.action.label+" with result "+item.result)
|
if (!item.action.result.includes("failed condition")) {
|
||||||
|
alert.error("Error for "+item.action.label+" with result "+item.result)
|
||||||
|
}
|
||||||
visited.push(item.action.label)
|
visited.push(item.action.label)
|
||||||
setVisited(visited)
|
setVisited(visited)
|
||||||
}
|
}
|
||||||
@@ -6223,38 +6225,26 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const parsedExecutionArgument = () => {
|
const parsedExecutionArgument = () => {
|
||||||
var showResult = executionData.execution_argument.trim()
|
var showResult = executionData.execution_argument.trim()
|
||||||
showResult = showResult.split(" None").join(" \"None\"")
|
const validate = validateJson(showResult)
|
||||||
showResult = showResult.split(" False").join(" false")
|
|
||||||
showResult = showResult.split(" True").join(" true")
|
|
||||||
|
|
||||||
var jsonvalid = true
|
|
||||||
try {
|
if (validate.valid) {
|
||||||
const tmp = String(JSON.parse(showResult))
|
if (typeof(validate.result) === "string") {
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
validate.result = JSON.parse(validate.result)
|
||||||
jsonvalid = false
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
showResult = showResult.split("\'").join("\"")
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tmp = String(JSON.parse(showResult))
|
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonvalid) {
|
|
||||||
return (
|
return (
|
||||||
<ReactJson
|
<ReactJson
|
||||||
src={JSON.parse(showResult)}
|
src={validate.result}
|
||||||
theme="solarized"
|
theme="solarized"
|
||||||
collapsed={true}
|
collapsed={true}
|
||||||
displayDataTypes={false}
|
displayDataTypes={false}
|
||||||
name={"Execution argument"}
|
onSelect={(select) => {
|
||||||
/>
|
HandleJsonCopy(showResult, select, "exec")
|
||||||
|
console.log("SELECTED!: ", select)
|
||||||
|
}}
|
||||||
|
name={"Execution Argument"}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6498,29 +6488,7 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
// FIXME: The latter replace doens't really work if ' is used in a string
|
// FIXME: The latter replace doens't really work if ' is used in a string
|
||||||
var showResult = data.result.trim()
|
var showResult = data.result.trim()
|
||||||
//console.log(showResult)
|
const validate = validateJson(showResult)
|
||||||
showResult = showResult.split(" None").join(" \"None\"")
|
|
||||||
showResult = showResult.split(" False").join(" false")
|
|
||||||
showResult = showResult.split(" True").join(" true")
|
|
||||||
|
|
||||||
var jsonvalid = true
|
|
||||||
try {
|
|
||||||
const tmp = String(JSON.parse(showResult))
|
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
showResult = showResult.split("\'").join("\"")
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tmp = String(JSON.parse(showResult))
|
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
jsonvalid = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const curapp = apps.find(a => a.name === data.action.app_name && a.app_version === data.action.app_version)
|
const curapp = apps.find(a => a.name === data.action.app_name && a.app_version === data.action.app_version)
|
||||||
const imgsize = 50
|
const imgsize = 50
|
||||||
@@ -6540,6 +6508,10 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (validate.valid && typeof(validate.result) === "string") {
|
||||||
|
validate.result = JSON.parse(validate.result)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={index} style={{marginBottom: 40,}}>
|
<div key={index} style={{marginBottom: 40,}}>
|
||||||
<div style={{display: "flex", marginBottom: 15,}}>
|
<div style={{display: "flex", marginBottom: 15,}}>
|
||||||
@@ -6558,8 +6530,8 @@ const AngularWorkflow = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{marginBottom: 5}}><b>Status </b> {data.status}</div>
|
<div style={{marginBottom: 5}}><b>Status </b> {data.status}</div>
|
||||||
{jsonvalid ? <ReactJson
|
{validate.valid ? <span><ReactJson
|
||||||
src={JSON.parse(showResult)}
|
src={validate.result}
|
||||||
theme="solarized"
|
theme="solarized"
|
||||||
collapsed={true}
|
collapsed={true}
|
||||||
displayDataTypes={false}
|
displayDataTypes={false}
|
||||||
@@ -6569,6 +6541,13 @@ const AngularWorkflow = (props) => {
|
|||||||
}}
|
}}
|
||||||
name={"Results for "+data.action.label}
|
name={"Results for "+data.action.label}
|
||||||
/>
|
/>
|
||||||
|
{data.action.app_name === "shuffle-subflow" ?
|
||||||
|
<span>
|
||||||
|
TBD: Load subexecution result for
|
||||||
|
</span>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</span>
|
||||||
:
|
:
|
||||||
<div>
|
<div>
|
||||||
<b>Result</b>
|
<b>Result</b>
|
||||||
@@ -6583,10 +6562,14 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
const curapp = !codeModalOpen ? {} : apps.find(a => a.name === selectedResult.action.app_name && a.app_version === selectedResult.action.app_version)
|
// This sucks :)
|
||||||
|
const curapp = !codeModalOpen ? {} : selectedResult.action.app_name === "shuffle-subflow" ? triggers[1] : selectedResult.action.app_name === "User Input" ? triggers[2] : apps.find(a => a.name === selectedResult.action.app_name && a.app_version === selectedResult.action.app_version)
|
||||||
const imgsize = 50
|
const imgsize = 50
|
||||||
const statusColor = !codeModalOpen ? "red" : selectedResult.status === "FINISHED" || selectedResult.status === "SUCCESS" ? "green" : selectedResult.status === "ABORTED" || selectedResult.status === "FAILURE" ? "red" : "orange"
|
const statusColor = !codeModalOpen ? "red" : selectedResult.status === "FINISHED" || selectedResult.status === "SUCCESS" ? "green" : selectedResult.status === "ABORTED" || selectedResult.status === "FAILURE" ? "red" : "orange"
|
||||||
const validate = !codeModalOpen ? "" : validateJson(selectedResult.result.trim())
|
const validate = !codeModalOpen ? "" : validateJson(selectedResult.result.trim())
|
||||||
|
if (validate.valid && typeof(validate.result) === "string") {
|
||||||
|
validate.result = JSON.parse(validate.result)
|
||||||
|
}
|
||||||
|
|
||||||
const codePopoutModal = !codeModalOpen ? null :
|
const codePopoutModal = !codeModalOpen ? null :
|
||||||
<Draggable
|
<Draggable
|
||||||
@@ -6696,6 +6679,7 @@ const AngularWorkflow = (props) => {
|
|||||||
}}>
|
}}>
|
||||||
<div style={{display: "flex", marginBottom: 15,}}>
|
<div style={{display: "flex", marginBottom: 15,}}>
|
||||||
{curapp === null ? null : <img alt={selectedResult.app_name} src={curapp === undefined ? "" : curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />}
|
{curapp === null ? null : <img alt={selectedResult.app_name} src={curapp === undefined ? "" : curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style={{fontSize: 24, marginTop: "auto", marginBottom: "auto"}}><b>{selectedResult.action.label}</b></div>
|
<div style={{fontSize: 24, marginTop: "auto", marginBottom: "auto"}}><b>{selectedResult.action.label}</b></div>
|
||||||
<div style={{fontSize: 14}}>{selectedResult.action.name}</div>
|
<div style={{fontSize: 14}}>{selectedResult.action.name}</div>
|
||||||
|
|||||||
@@ -67,9 +67,10 @@ export const validateJson = (showResult) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const result = jsonvalid ? JSON.parse(showResult) : showResult
|
||||||
return {
|
return {
|
||||||
"valid": jsonvalid,
|
"valid": jsonvalid,
|
||||||
"result": jsonvalid ? JSON.parse(showResult) : showResult,
|
"result": result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
NAME=shuffle-orborus
|
NAME=shuffle-orborus
|
||||||
VERSION=0.8.51
|
VERSION=0.8.52
|
||||||
|
|
||||||
echo "Running docker build with $NAME:$VERSION"
|
echo "Running docker build with $NAME:$VERSION"
|
||||||
#docker rmi frikky/shuffle:$NAME --force
|
#docker rmi frikky/shuffle:$NAME --force
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ func main() {
|
|||||||
|
|
||||||
allowed := maxConcurrency - executionCount
|
allowed := maxConcurrency - executionCount
|
||||||
if len(executionRequests.Data) > allowed {
|
if len(executionRequests.Data) > allowed {
|
||||||
log.Printf("[WARNING] Throttle - Cutting down requests from %d to %d", len(executionRequests.Data), allowed)
|
log.Printf("[WARNING] Throttle - Cutting down requests from %d to %d (MAX: %d, CUR: %d)", len(executionRequests.Data), allowed, maxConcurrency, executionCount)
|
||||||
executionRequests.Data = executionRequests.Data[0:allowed]
|
executionRequests.Data = executionRequests.Data[0:allowed]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,7 +695,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error {
|
|||||||
log.Printf("[INFO] Should STOP %d containers.", len(stopContainers))
|
log.Printf("[INFO] Should STOP %d containers.", len(stopContainers))
|
||||||
for _, containername := range stopContainers {
|
for _, containername := range stopContainers {
|
||||||
log.Printf("[INFO] Stopping and removing container %s", containerNames[containername])
|
log.Printf("[INFO] Stopping and removing container %s", containerNames[containername])
|
||||||
go dockercli.ContainerStop(ctx, containername, nil)
|
dockercli.ContainerStop(ctx, containername, nil)
|
||||||
removeContainers = append(removeContainers, containername)
|
removeContainers = append(removeContainers, containername)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,7 +706,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error {
|
|||||||
|
|
||||||
log.Printf("[INFO] Should REMOVE %d containers.", len(removeContainers))
|
log.Printf("[INFO] Should REMOVE %d containers.", len(removeContainers))
|
||||||
for _, containername := range removeContainers {
|
for _, containername := range removeContainers {
|
||||||
go dockercli.ContainerRemove(ctx, containername, removeOptions)
|
dockercli.ContainerRemove(ctx, containername, removeOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ WORKDIR /app
|
|||||||
RUN go get -u github.com/docker/docker/api/types
|
RUN go get -u github.com/docker/docker/api/types
|
||||||
RUN go get -u github.com/docker/docker/api/types/container
|
RUN go get -u github.com/docker/docker/api/types/container
|
||||||
RUN go get -u github.com/docker/docker/client
|
RUN go get -u github.com/docker/docker/client
|
||||||
|
RUN go get -u github.com/gorilla/mux
|
||||||
|
RUN go get -u github.com/patrickmn/go-cache
|
||||||
|
|
||||||
COPY worker.go /app/worker.go
|
COPY worker.go /app/worker.go
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker .
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker .
|
||||||
@@ -13,7 +15,7 @@ FROM alpine:3.12
|
|||||||
|
|
||||||
ENV SHUFFLE_BASE_IMAGE_REGISTRY=docker.io
|
ENV SHUFFLE_BASE_IMAGE_REGISTRY=docker.io
|
||||||
ENV SHUFFLE_BASE_IMAGE_NAME=frikky/shuffle
|
ENV SHUFFLE_BASE_IMAGE_NAME=frikky/shuffle
|
||||||
ENV SHUFFLE_BASE_IMAGE_TAG_SUFFIX=0.6.0
|
ENV SHUFFLE_BASE_IMAGE_TAG_SUFFIX=0.8.5
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
COPY --from=builder /app/ /
|
COPY --from=builder /app/ /
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ docker build . -t frikky/shuffle:$NAME -t frikky/shuffle:$NAME_$VERSION -t docke
|
|||||||
#docker push frikky/$NAME:$VERSION
|
#docker push frikky/$NAME:$VERSION
|
||||||
#docker push frikky/shuffle:$NAME_$VERSION
|
#docker push frikky/shuffle:$NAME_$VERSION
|
||||||
#docker push docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION
|
#docker push docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION
|
||||||
|
docker tag frikky/shuffle:0.8.51 ghcr.io/frikky/shuffle-worker:0.8.5
|
||||||
docker push ghcr.io/frikky/$NAME:$VERSION
|
docker push ghcr.io/frikky/$NAME:$VERSION
|
||||||
|
|||||||
+1246
-529
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user