Added re-execution button
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user