Fixed retries in sdk, file ordering in admin and editing issues in app creator
This commit is contained in:
+49
-15
@@ -39,8 +39,16 @@ for key, value in standard_filter_manager.filters.items():
|
|||||||
|
|
||||||
@shuffle_filters.register
|
@shuffle_filters.register
|
||||||
def plus(a, b):
|
def plus(a, b):
|
||||||
a = int(a)
|
try:
|
||||||
b = int(b)
|
a = int(a)
|
||||||
|
except:
|
||||||
|
a = 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
b = int(b)
|
||||||
|
except:
|
||||||
|
b = 0
|
||||||
|
|
||||||
return standard_filter_manager.filters["plus"](a, b)
|
return standard_filter_manager.filters["plus"](a, b)
|
||||||
|
|
||||||
@shuffle_filters.register
|
@shuffle_filters.register
|
||||||
@@ -274,11 +282,42 @@ class AppBase:
|
|||||||
self.logger.info(f"[DEBUG] Before last stream result")
|
self.logger.info(f"[DEBUG] Before last stream result")
|
||||||
url = "%s%s" % (self.base_url, stream_path)
|
url = "%s%s" % (self.base_url, stream_path)
|
||||||
self.logger.info("[INFO] URL FOR RESULT (URL): %s" % url)
|
self.logger.info("[INFO] URL FOR RESULT (URL): %s" % url)
|
||||||
|
|
||||||
|
# FIXME: Adding retries here.
|
||||||
try:
|
try:
|
||||||
ret = requests.post(url, headers=headers, json=action_result)
|
finished = False
|
||||||
#self.logger.info(f"[DEBUG] Result: {ret.status_code}")
|
for i in range (0, 5):
|
||||||
#if ret.status_code != 200:
|
try:
|
||||||
# self.logger.info(f"[DEBUG] Shuffle Response: {ret.text}")
|
ret = requests.post(url, headers=headers, json=action_result, timeout=10)
|
||||||
|
|
||||||
|
self.logger.info(f"[DEBUG] Result: {ret.status_code} (break on 200)")
|
||||||
|
if ret.status_code == 200 or ret.status_code == 201:
|
||||||
|
finished = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.logger.info(f"[DEBUG] RESP: {ret.text}")
|
||||||
|
|
||||||
|
except (requests.exceptions.RequestException, TimeoutError) as e:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
|
except http.client.RemoteDisconnected as e:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
|
except urllib3.exceptions.ProtocolError as e:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
if not finished:
|
||||||
|
# Not sure why this would work tho :)
|
||||||
|
action_result["status"] = "FAILURE"
|
||||||
|
action_result["result"] = f"POST error: {e}"
|
||||||
|
self.logger.info(f"[DEBUG] Before typeerror stream result: {e}")
|
||||||
|
ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=action_result)
|
||||||
|
|
||||||
self.logger.info(f"""[DEBUG] Successful request result request: Status= {ret.status_code} & Response= {ret.text}. Action status: {action_result["status"]}""")
|
self.logger.info(f"""[DEBUG] Successful request result request: Status= {ret.status_code} & Response= {ret.text}. Action status: {action_result["status"]}""")
|
||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
@@ -2445,7 +2484,7 @@ class AppBase:
|
|||||||
# THE START IS ACTUALLY RIGHT HERE :O
|
# THE START IS ACTUALLY RIGHT HERE :O
|
||||||
# Checks whether conditions are met, otherwise set
|
# Checks whether conditions are met, otherwise set
|
||||||
branchcheck, tmpresult = check_branch_conditions(action, fullexecution, self)
|
branchcheck, tmpresult = check_branch_conditions(action, fullexecution, self)
|
||||||
if isinstance(tmpresult, object) or isinstance(tmpresult, list):
|
if isinstance(tmpresult, object) or isinstance(tmpresult, list) or isinstance(tmpresult, dict):
|
||||||
self.logger.info("[DEBUG] Fixing branch return as object -> string")
|
self.logger.info("[DEBUG] Fixing branch return as object -> string")
|
||||||
try:
|
try:
|
||||||
#tmpresult = tmpresult.replace("'", "\"")
|
#tmpresult = tmpresult.replace("'", "\"")
|
||||||
@@ -2453,19 +2492,14 @@ class AppBase:
|
|||||||
except json.decoder.JSONDecodeError as e:
|
except json.decoder.JSONDecodeError as e:
|
||||||
self.logger.info(f"[WARNING] Failed condition parsing {tmpresult} to string")
|
self.logger.info(f"[WARNING] Failed condition parsing {tmpresult} to string")
|
||||||
|
|
||||||
|
# IF branches fail: Exit!
|
||||||
if not branchcheck:
|
if not branchcheck:
|
||||||
self.logger.info("Failed one or more branch conditions.")
|
self.logger.info("Failed one or more branch conditions.")
|
||||||
self.action_result["result"] = tmpresult
|
self.action_result["result"] = tmpresult
|
||||||
self.action_result["status"] = "SKIPPED"
|
self.action_result["status"] = "SKIPPED"
|
||||||
try:
|
self.action_result["completed_at"] = int(time.time())
|
||||||
ret = requests.post("%s%s" % (self.base_url, stream_path), headers=headers, json=self.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(e)
|
|
||||||
|
|
||||||
self.logger.info("\n\n[DEBUG] RETURNING BECAUSE A BRANCH FAILED: %s\n\n" % tmpresult)
|
self.send_result(self.action_result, headers, stream_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Replace name cus there might be issues
|
# Replace name cus there might be issues
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
### DEFAULT
|
### DEFAULT
|
||||||
NAME=shuffle-app_sdk
|
NAME=shuffle-app_sdk
|
||||||
VERSION=0.9.59
|
VERSION=0.9.61
|
||||||
|
|
||||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
||||||
docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly
|
docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,7 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
build: ./frontend
|
#build: ./frontend
|
||||||
image: ghcr.io/frikky/shuffle-frontend:nightly
|
image: ghcr.io/frikky/shuffle-frontend:nightly
|
||||||
container_name: shuffle-frontend
|
container_name: shuffle-frontend
|
||||||
hostname: shuffle-frontend
|
hostname: shuffle-frontend
|
||||||
@@ -94,4 +94,3 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
#driver: overlay
|
#driver: overlay
|
||||||
#driver: bridge
|
|
||||||
|
|||||||
@@ -3185,7 +3185,7 @@ const Admin = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem key={index} style={{ backgroundColor: bgColor }}>
|
<ListItem key={index} style={{ backgroundColor: bgColor, maxHeight: 100, overflow: "hidden",}}>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
style={{
|
style={{
|
||||||
maxWidth: 225,
|
maxWidth: 225,
|
||||||
|
|||||||
@@ -275,7 +275,6 @@ const AppCreator = (defaultprops) => {
|
|||||||
const [urlPathQueries, setUrlPathQueries] = useState([]);
|
const [urlPathQueries, setUrlPathQueries] = useState([]);
|
||||||
const [update, setUpdate] = useState("");
|
const [update, setUpdate] = useState("");
|
||||||
const [urlPathParameters] = useState([]);
|
const [urlPathParameters] = useState([]);
|
||||||
const [firstrequest, setFirstrequest] = React.useState(true);
|
|
||||||
const [basedata, setBasedata] = React.useState({});
|
const [basedata, setBasedata] = React.useState({});
|
||||||
const [actions, setActions] = useState([]);
|
const [actions, setActions] = useState([]);
|
||||||
const [filteredActions, setFilteredActions] = useState([]);
|
const [filteredActions, setFilteredActions] = useState([]);
|
||||||
@@ -343,16 +342,13 @@ const AppCreator = (defaultprops) => {
|
|||||||
window.location.host === "shuffler.io";
|
window.location.host === "shuffler.io";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (firstrequest) {
|
if (window.location.pathname.includes("apps/edit")) {
|
||||||
setFirstrequest(false);
|
setIsEditing(true);
|
||||||
if (window.location.pathname.includes("apps/edit")) {
|
handleEditApp();
|
||||||
setIsEditing(true);
|
} else {
|
||||||
handleEditApp();
|
checkQuery();
|
||||||
} else {
|
}
|
||||||
checkQuery();
|
}, []);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleEditApp = () => {
|
const handleEditApp = () => {
|
||||||
fetch(globalUrl + "/api/v1/apps/" + props.match.params.appid + "/config", {
|
fetch(globalUrl + "/api/v1/apps/" + props.match.params.appid + "/config", {
|
||||||
@@ -1635,6 +1631,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
if (urlParams !== undefined && urlParams !== null && urlParams.has("id")) {
|
if (urlParams !== undefined && urlParams !== null && urlParams.has("id")) {
|
||||||
data.id = urlParams.get("id")
|
data.id = urlParams.get("id")
|
||||||
}
|
}
|
||||||
|
|
||||||
//id: props.match.params.appid,
|
//id: props.match.params.appid,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5267,7 +5264,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const loadedCheck =
|
const loadedCheck =
|
||||||
isLoaded && isAppLoaded && !firstrequest ? (
|
isLoaded && isAppLoaded ? (
|
||||||
<div>
|
<div>
|
||||||
<div style={bodyDivStyle}>{landingpageDataBrowser}</div>
|
<div style={bodyDivStyle}>{landingpageDataBrowser}</div>
|
||||||
{newActionModal}
|
{newActionModal}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ func deployServiceWorkers(image string) {
|
|||||||
// Looks for and cleans up all existing items in swarm we can't re-use (Shuffle only)
|
// Looks for and cleans up all existing items in swarm we can't re-use (Shuffle only)
|
||||||
cleanupExistingNodes(ctx)
|
cleanupExistingNodes(ctx)
|
||||||
// frikky@debian:~/git/shuffle/functions/onprem/worker$ docker service create --replicas 5 --name shuffle-workers --env SHUFFLE_SWARM_CONFIG=run --publish published=33333,target=33333 ghcr.io/frikky/shuffle-worker:nightly
|
// frikky@debian:~/git/shuffle/functions/onprem/worker$ docker service create --replicas 5 --name shuffle-workers --env SHUFFLE_SWARM_CONFIG=run --publish published=33333,target=33333 ghcr.io/frikky/shuffle-worker:nightly
|
||||||
networkName := "shuffle-executions"
|
networkName := "shuffle_swarm_executions"
|
||||||
if len(swarmNetworkName) > 0 {
|
if len(swarmNetworkName) > 0 {
|
||||||
networkName = swarmNetworkName
|
networkName = swarmNetworkName
|
||||||
}
|
}
|
||||||
@@ -809,7 +809,7 @@ func main() {
|
|||||||
// Run by default from now
|
// Run by default from now
|
||||||
zombiecheck(ctx, workerTimeout)
|
zombiecheck(ctx, workerTimeout)
|
||||||
|
|
||||||
log.Printf("[INFO] Running towards %s (BASE_URL) with Org %s", baseUrl, environment)
|
log.Printf("[INFO] Running towards %s (BASE_URL) with environment name %s", baseUrl, environment)
|
||||||
httpProxy := os.Getenv("HTTP_PROXY")
|
httpProxy := os.Getenv("HTTP_PROXY")
|
||||||
httpsProxy := os.Getenv("HTTPS_PROXY")
|
httpsProxy := os.Getenv("HTTPS_PROXY")
|
||||||
|
|
||||||
@@ -857,6 +857,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.Timeout = 10 * time.Second
|
||||||
|
|
||||||
fullUrl := fmt.Sprintf("%s/api/v1/workflows/queue", baseUrl)
|
fullUrl := fmt.Sprintf("%s/api/v1/workflows/queue", baseUrl)
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
"GET",
|
"GET",
|
||||||
|
|||||||
Reference in New Issue
Block a user