Added re-execution button
This commit is contained in:
@@ -7,6 +7,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import http.client
|
||||||
|
|
||||||
class AppBase:
|
class AppBase:
|
||||||
__version__ = None
|
__version__ = None
|
||||||
@@ -57,17 +58,18 @@ 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.base_url, stream_path)
|
url = "%s%s" % (self.base_url, stream_path)
|
||||||
print("[INFO] URL (URL): %s" % url)
|
#print("[INFO] URL (URL): %s" % url)
|
||||||
try:
|
try:
|
||||||
ret = requests.post(url, 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)
|
||||||
except requests.exceptions.ConnectionError as e:
|
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
|
return
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
self.logger.exception(e)
|
#self.logger.exception(e)
|
||||||
action_result["status"] = "FAILURE"
|
action_result["status"] = "FAILURE"
|
||||||
action_result["result"] = "POST error: %s" % e
|
action_result["result"] = "POST error: %s" % e
|
||||||
self.logger.info("Before typeerror stream result")
|
self.logger.info("Before typeerror stream result")
|
||||||
@@ -75,6 +77,9 @@ class AppBase:
|
|||||||
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)
|
||||||
|
except http.client.RemoteDisconnected as e:
|
||||||
|
self.logger.exception("Expected connectionerror happened")
|
||||||
|
return
|
||||||
|
|
||||||
async def cartesian_product(self, L):
|
async def cartesian_product(self, L):
|
||||||
if L:
|
if L:
|
||||||
|
|||||||
@@ -6904,19 +6904,19 @@ func remoteOrgJobController(org Org, body []byte) error {
|
|||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
if !responseData.Success {
|
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") {
|
if strings.Contains(responseData.Reason, "Bad apikey") || strings.Contains(responseData.Reason, "Error getting the organization") {
|
||||||
log.Printf("Bad apikey. Stopping sync for org?: %s", responseData.Reason)
|
log.Printf("[WARNING] Remote error; Bad apikey or org error. Stopping sync for org: %s", responseData.Reason)
|
||||||
|
|
||||||
if value, exists := scheduledOrgs[org.Id]; exists {
|
if value, exists := scheduledOrgs[org.Id]; exists {
|
||||||
// Looks like this does the trick? Hurr
|
// 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()
|
value.Lock()
|
||||||
org, err := getOrg(ctx, org.Id)
|
org, err := getOrg(ctx, org.Id)
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6925,9 +6925,9 @@ func remoteOrgJobController(org Org, body []byte) error {
|
|||||||
org.CloudSync = false
|
org.CloudSync = false
|
||||||
err = setOrg(ctx, *org, org.Id)
|
err = setOrg(ctx, *org, org.Id)
|
||||||
if err != nil {
|
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 {
|
} 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.")
|
return errors.New("Stopped schedule for org locally because of bad apikey.")
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ const AngularWorkflow = (props) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const executeWorkflow = () => {
|
const executeWorkflow = (executionArgument, startNode) => {
|
||||||
if (!lastSaved) {
|
if (!lastSaved) {
|
||||||
//alert.error("You might have forgotten to save before executing.")
|
//alert.error("You might have forgotten to save before executing.")
|
||||||
console.log("FIXME: 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")
|
curelements[i].addClass("not-executing-highlight")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (executionText.length > 0) {
|
if (executionArgument.length > 0) {
|
||||||
alert.success("Starting execution with an execution argument")
|
alert.success("Starting execution WITH an execution argument")
|
||||||
} else {
|
} else {
|
||||||
alert.success("Starting execution")
|
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", {
|
fetch(globalUrl+"/api/v1/workflows/"+props.match.params.key+"/execute", {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -1870,8 +1870,8 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const paperAppStyle = {
|
const paperAppStyle = {
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
minHeight: "100px",
|
minHeight: 100,
|
||||||
maxHeight: "100px",
|
maxHeight: 100,
|
||||||
minWidth: "100%",
|
minWidth: "100%",
|
||||||
maxWidth: "100%",
|
maxWidth: "100%",
|
||||||
marginTop: "5px",
|
marginTop: "5px",
|
||||||
@@ -2557,7 +2557,7 @@ const AngularWorkflow = (props) => {
|
|||||||
<Grid item>
|
<Grid item>
|
||||||
<img alt={newAppname} src={image} style={{borderRadius: borderRadius, height: 80, width: 80,}} />
|
<img alt={newAppname} src={image} style={{borderRadius: borderRadius, height: 80, width: 80,}} />
|
||||||
</Grid>
|
</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}}>
|
<Grid item style={{flex: 1}}>
|
||||||
<h4 style={{marginBottom: 0, marginTop: 5}}>{newAppname}</h4>
|
<h4 style={{marginBottom: 0, marginTop: 5}}>{newAppname}</h4>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -6121,7 +6121,7 @@ const AngularWorkflow = (props) => {
|
|||||||
:
|
:
|
||||||
<Tooltip color="primary" title="Test execution" placement="top">
|
<Tooltip color="primary" title="Test execution" placement="top">
|
||||||
<Button disabled={executionRequestStarted || !workflow.isValid} style={{height: boxSize, width: boxSize}} color="primary" variant="contained" onClick={() => {
|
<Button disabled={executionRequestStarted || !workflow.isValid} style={{height: boxSize, width: boxSize}} color="primary" variant="contained" onClick={() => {
|
||||||
executeWorkflow()
|
executeWorkflow(executionText, workflow.start)
|
||||||
}}>
|
}}>
|
||||||
<PlayArrowIcon style={{ fontSize: 60}} />
|
<PlayArrowIcon style={{ fontSize: 60}} />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -6502,13 +6502,31 @@ const AngularWorkflow = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
</Breadcrumbs>
|
</Breadcrumbs>
|
||||||
<Divider style={{backgroundColor: "white", marginTop: 10, marginBottom: 10,}}/>
|
<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 ?
|
{executionData.status !== undefined && executionData.status.length > 0 ?
|
||||||
<div>
|
<div>
|
||||||
<b>Status: </b>{executionData.status}
|
<b>Status: </b>{executionData.status}
|
||||||
</div>
|
</div>
|
||||||
: null
|
: 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 ?
|
{executionData.started_at !== undefined ?
|
||||||
<div>
|
<div>
|
||||||
<b>Started: </b>{new Date(executionData.started_at*1000).toISOString()}
|
<b>Started: </b>{new Date(executionData.started_at*1000).toISOString()}
|
||||||
@@ -6521,12 +6539,6 @@ const AngularWorkflow = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
: null
|
: 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 ?
|
{executionData.execution_argument !== undefined && executionData.execution_argument.length > 0 ?
|
||||||
parsedExecutionArgument()
|
parsedExecutionArgument()
|
||||||
: null }
|
: null }
|
||||||
|
|||||||
Reference in New Issue
Block a user