Added re-execution button

This commit is contained in:
frikky
2021-02-18 11:30:26 +01:00
parent 8fb64da39a
commit 848d4c3adb
3 changed files with 42 additions and 25 deletions
+8 -3
View File
@@ -7,6 +7,7 @@ import json
import logging
import requests
import urllib.parse
import http.client
class AppBase:
__version__ = None
@@ -57,17 +58,18 @@ class AppBase:
# I wonder if this actually works
self.logger.info("Before last stream result")
url = "%s%s" % (self.base_url, stream_path)
print("[INFO] URL (URL): %s" % url)
#print("[INFO] URL (URL): %s" % url)
try:
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)
except requests.exceptions.ConnectionError as e:
self.logger.exception("ConnectionError: %s" % e)
#self.logger.exception("ConnectionError: %s" % e)
self.logger.exception("Expected connectionerror happened")
return
except TypeError as e:
self.logger.exception(e)
#self.logger.exception(e)
action_result["status"] = "FAILURE"
action_result["result"] = "POST error: %s" % e
self.logger.info("Before typeerror stream result")
@@ -75,6 +77,9 @@ class AppBase:
self.logger.info("Result: %d" % ret.status_code)
if ret.status_code != 200:
self.logger.info(ret.text)
except http.client.RemoteDisconnected as e:
self.logger.exception("Expected connectionerror happened")
return
async def cartesian_product(self, L):
if L:
+7 -7
View File
@@ -6904,19 +6904,19 @@ func remoteOrgJobController(org Org, body []byte) error {
ctx := context.Background()
if !responseData.Success {
log.Printf("Should stop org job controller")
log.Printf("Should stop org job controller because no success?")
if strings.Contains(responseData.Reason, "Bad apikey") {
log.Printf("Bad apikey. Stopping sync for org?: %s", responseData.Reason)
if strings.Contains(responseData.Reason, "Bad apikey") || strings.Contains(responseData.Reason, "Error getting the organization") {
log.Printf("[WARNING] Remote error; Bad apikey or org error. Stopping sync for org: %s", responseData.Reason)
if value, exists := scheduledOrgs[org.Id]; exists {
// Looks like this does the trick? Hurr
log.Printf("STOPPING ORG SCHEDULE for: %s", org.Id)
log.Printf("[WARNING] STOPPING ORG SCHEDULE for: %s", org.Id)
value.Lock()
org, err := getOrg(ctx, org.Id)
if err != nil {
log.Printf("Failed finding org %s: %s", org.Id, err)
log.Printf("[WARNING] Failed finding org %s: %s", org.Id, err)
return err
}
@@ -6925,9 +6925,9 @@ func remoteOrgJobController(org Org, body []byte) error {
org.CloudSync = false
err = setOrg(ctx, *org, org.Id)
if err != nil {
log.Printf("Failed setting organization when stopping sync: %s", err)
log.Printf("[WARNING] Failed setting organization when stopping sync: %s", err)
} else {
log.Printf("Successfully updated the org to not sync")
log.Printf("[INFO] Successfully STOPPED org cloud sync for %s", org.Id)
}
return errors.New("Stopped schedule for org locally because of bad apikey.")
+27 -15
View File
@@ -782,7 +782,7 @@ const AngularWorkflow = (props) => {
return true
}
const executeWorkflow = () => {
const executeWorkflow = (executionArgument, startNode) => {
if (!lastSaved) {
//alert.error("You might have forgotten to save before executing.")
console.log("FIXME: Might have forgotten to save before executing.")
@@ -804,13 +804,13 @@ const AngularWorkflow = (props) => {
curelements[i].addClass("not-executing-highlight")
}
if (executionText.length > 0) {
alert.success("Starting execution with an execution argument")
if (executionArgument.length > 0) {
alert.success("Starting execution WITH an execution argument")
} else {
alert.success("Starting execution")
}
const data = {"execution_argument": executionText, "start": workflow.start}
const data = {"execution_argument": executionArgument, "start": startNode}
fetch(globalUrl+"/api/v1/workflows/"+props.match.params.key+"/execute", {
method: 'POST',
headers: {
@@ -1870,8 +1870,8 @@ const AngularWorkflow = (props) => {
const paperAppStyle = {
borderRadius: borderRadius,
minHeight: "100px",
maxHeight: "100px",
minHeight: 100,
maxHeight: 100,
minWidth: "100%",
maxWidth: "100%",
marginTop: "5px",
@@ -2557,7 +2557,7 @@ const AngularWorkflow = (props) => {
<Grid item>
<img alt={newAppname} src={image} style={{borderRadius: borderRadius, height: 80, width: 80,}} />
</Grid>
<Grid style={{display: "flex", flexDirection: "column", marginLeft: "20px", minWidth: 185, maxWidth: 185, overflow: "hidden", maxHeight: 80, }}>
<Grid style={{display: "flex", flexDirection: "column", marginLeft: "20px", minWidth: 185, maxWidth: 185, overflow: "hidden", maxHeight: 77, }}>
<Grid item style={{flex: 1}}>
<h4 style={{marginBottom: 0, marginTop: 5}}>{newAppname}</h4>
</Grid>
@@ -6121,7 +6121,7 @@ const AngularWorkflow = (props) => {
:
<Tooltip color="primary" title="Test execution" placement="top">
<Button disabled={executionRequestStarted || !workflow.isValid} style={{height: boxSize, width: boxSize}} color="primary" variant="contained" onClick={() => {
executeWorkflow()
executeWorkflow(executionText, workflow.start)
}}>
<PlayArrowIcon style={{ fontSize: 60}} />
</Button>
@@ -6502,13 +6502,31 @@ const AngularWorkflow = (props) => {
</span>
</Breadcrumbs>
<Divider style={{backgroundColor: "white", marginTop: 10, marginBottom: 10,}}/>
<h2>Executing Workflow</h2>
<div style={{display: "flex"}}>
<h2>Executing Workflow</h2>
<Tooltip color="primary" title="Rerun workflow" placement="top">
<Button color="primary" style={{float: "right"}} onClick={() => {
console.log("DATA: ", executionData)
executeWorkflow(executionData.execution_argument, executionData.start)
setExecutionModalOpen(false)
//executionText, workflow.start)
}}>
<CachedIcon style={{}}/>
</Button>
</Tooltip>
</div>
{executionData.status !== undefined && executionData.status.length > 0 ?
<div>
<b>Status: </b>{executionData.status}
</div>
: null
}
{executionData.execution_source !== undefined && executionData.execution_source !== null && executionData.execution_source.length > 0 && executionData.execution_source !== "default" ?
<div>
<b>Source: </b>{executionData.execution_source}
</div>
: null
}
{executionData.started_at !== undefined ?
<div>
<b>Started: </b>{new Date(executionData.started_at*1000).toISOString()}
@@ -6521,12 +6539,6 @@ const AngularWorkflow = (props) => {
</div>
: null
}
{executionData.execution_source !== undefined && executionData.execution_source.length > 0 ?
<div>
<b>Source: </b>{executionData.execution_source}
</div>
: null
}
{executionData.execution_argument !== undefined && executionData.execution_argument.length > 0 ?
parsedExecutionArgument()
: null }