Optimize: Started work on an updated worker
This commit is contained in:
@@ -38,8 +38,10 @@ class AppBase:
|
||||
|
||||
# I wonder if this actually works
|
||||
self.logger.info("Before last stream result")
|
||||
url = "%s%s" % (self.url, stream_path)
|
||||
print("URL: %s" % url)
|
||||
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)
|
||||
if ret.status_code != 200:
|
||||
self.logger.info(ret.text)
|
||||
|
||||
@@ -1307,10 +1307,10 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
|
||||
workflowExecution.LastNode = actionResult.Action.ID
|
||||
}
|
||||
|
||||
err = increaseStatisticsField(ctx, "workflow_executions_success", workflowExecution.Workflow.ID, 1, workflowExecution.ExecutionOrg)
|
||||
if err != nil {
|
||||
log.Printf("Failed to increase success execution stats: %s", err)
|
||||
}
|
||||
//err = increaseStatisticsField(ctx, "workflow_executions_success", workflowExecution.Workflow.ID, 1, workflowExecution.ExecutionOrg)
|
||||
//if err != nil {
|
||||
// log.Printf("Failed to increase success execution stats: %s", err)
|
||||
//}
|
||||
|
||||
// Handles extra statistics stuff when it's done
|
||||
// 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.
|
||||
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
|
||||
err = json.Unmarshal(body, &execution)
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ services:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- SHUFFLE_APP_SDK_VERSION=0.8.51
|
||||
- SHUFFLE_WORKER_VERSION=0.8.51
|
||||
- SHUFFLE_WORKER_VERSION=0.8.5
|
||||
- ORG_ID=${ORG_ID}
|
||||
- ENVIRONMENT_NAME=${ENVIRONMENT_NAME}
|
||||
- BASE_URL=http://${OUTER_HOSTNAME}:${BACKEND_PORT}
|
||||
|
||||
@@ -573,7 +573,9 @@ const AngularWorkflow = (props) => {
|
||||
currentnode.addClass('failure-highlight')
|
||||
|
||||
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)
|
||||
setVisited(visited)
|
||||
}
|
||||
@@ -6223,38 +6225,26 @@ const AngularWorkflow = (props) => {
|
||||
|
||||
const parsedExecutionArgument = () => {
|
||||
var showResult = executionData.execution_argument.trim()
|
||||
showResult = showResult.split(" None").join(" \"None\"")
|
||||
showResult = showResult.split(" False").join(" false")
|
||||
showResult = showResult.split(" True").join(" true")
|
||||
const validate = validateJson(showResult)
|
||||
|
||||
var jsonvalid = true
|
||||
try {
|
||||
const tmp = String(JSON.parse(showResult))
|
||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
||||
jsonvalid = false
|
||||
|
||||
if (validate.valid) {
|
||||
if (typeof(validate.result) === "string") {
|
||||
validate.result = JSON.parse(validate.result)
|
||||
}
|
||||
} 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 (
|
||||
<ReactJson
|
||||
src={JSON.parse(showResult)}
|
||||
theme="solarized"
|
||||
collapsed={true}
|
||||
displayDataTypes={false}
|
||||
name={"Execution argument"}
|
||||
/>
|
||||
src={validate.result}
|
||||
theme="solarized"
|
||||
collapsed={true}
|
||||
displayDataTypes={false}
|
||||
onSelect={(select) => {
|
||||
HandleJsonCopy(showResult, select, "exec")
|
||||
console.log("SELECTED!: ", select)
|
||||
}}
|
||||
name={"Execution Argument"}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6498,30 +6488,8 @@ const AngularWorkflow = (props) => {
|
||||
|
||||
// FIXME: The latter replace doens't really work if ' is used in a string
|
||||
var showResult = data.result.trim()
|
||||
//console.log(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 validate = validateJson(showResult)
|
||||
|
||||
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"
|
||||
@@ -6540,6 +6508,10 @@ const AngularWorkflow = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (validate.valid && typeof(validate.result) === "string") {
|
||||
validate.result = JSON.parse(validate.result)
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={index} style={{marginBottom: 40,}}>
|
||||
<div style={{display: "flex", marginBottom: 15,}}>
|
||||
@@ -6558,8 +6530,8 @@ const AngularWorkflow = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
<div style={{marginBottom: 5}}><b>Status </b> {data.status}</div>
|
||||
{jsonvalid ? <ReactJson
|
||||
src={JSON.parse(showResult)}
|
||||
{validate.valid ? <span><ReactJson
|
||||
src={validate.result}
|
||||
theme="solarized"
|
||||
collapsed={true}
|
||||
displayDataTypes={false}
|
||||
@@ -6569,6 +6541,13 @@ const AngularWorkflow = (props) => {
|
||||
}}
|
||||
name={"Results for "+data.action.label}
|
||||
/>
|
||||
{data.action.app_name === "shuffle-subflow" ?
|
||||
<span>
|
||||
TBD: Load subexecution result for
|
||||
</span>
|
||||
: null
|
||||
}
|
||||
</span>
|
||||
:
|
||||
<div>
|
||||
<b>Result</b>
|
||||
@@ -6583,10 +6562,14 @@ const AngularWorkflow = (props) => {
|
||||
}
|
||||
</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 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())
|
||||
if (validate.valid && typeof(validate.result) === "string") {
|
||||
validate.result = JSON.parse(validate.result)
|
||||
}
|
||||
|
||||
const codePopoutModal = !codeModalOpen ? null :
|
||||
<Draggable
|
||||
@@ -6696,6 +6679,7 @@ const AngularWorkflow = (props) => {
|
||||
}}>
|
||||
<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}`}} />}
|
||||
|
||||
<div>
|
||||
<div style={{fontSize: 24, marginTop: "auto", marginBottom: "auto"}}><b>{selectedResult.action.label}</b></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 {
|
||||
"valid": jsonvalid,
|
||||
"result": jsonvalid ? JSON.parse(showResult) : showResult,
|
||||
"result": result,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
NAME=shuffle-orborus
|
||||
VERSION=0.8.51
|
||||
VERSION=0.8.52
|
||||
|
||||
echo "Running docker build with $NAME:$VERSION"
|
||||
#docker rmi frikky/shuffle:$NAME --force
|
||||
|
||||
@@ -472,7 +472,7 @@ func main() {
|
||||
|
||||
allowed := maxConcurrency - executionCount
|
||||
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]
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error {
|
||||
log.Printf("[INFO] Should STOP %d containers.", len(stopContainers))
|
||||
for _, containername := range stopContainers {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -706,7 +706,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error {
|
||||
|
||||
log.Printf("[INFO] Should REMOVE %d containers.", len(removeContainers))
|
||||
for _, containername := range removeContainers {
|
||||
go dockercli.ContainerRemove(ctx, containername, removeOptions)
|
||||
dockercli.ContainerRemove(ctx, containername, removeOptions)
|
||||
}
|
||||
|
||||
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/container
|
||||
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
|
||||
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_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
|
||||
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/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
|
||||
|
||||
+1246
-529
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user