Added stopsignal module with checkDependency and addStopSignal definitions
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from core.apirequest import executeRequest
|
from core.apirequest import executeRequest
|
||||||
from core.runtime.runtimecontract import buildRuntimeAttr, buildPreRuntimeAttr
|
from core.runtime.runtimecontract import buildRuntimeAttr, buildPreRuntimeAttr
|
||||||
|
from core.runtime.stopsignals import addStopSignal
|
||||||
|
|
||||||
|
|
||||||
def buildAction (action, outputs):
|
def buildAction (action, outputs):
|
||||||
@@ -11,8 +12,6 @@ def buildAction (action, outputs):
|
|||||||
return outputs, None
|
return outputs, None
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
if hasattr(action, "depends"):
|
|
||||||
outputs["stopsignals"].append(action.alias)
|
|
||||||
return outputs, None
|
return outputs, None
|
||||||
|
|
||||||
response, outputs = executeRequest(action, outputs, resolved)
|
response, outputs = executeRequest(action, outputs, resolved)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from core.runtime.managefailure import manageFailure
|
from core.runtime.managefailure import manageFailure
|
||||||
from core.execution.action.action import buildAction
|
from core.execution.action.action import buildAction
|
||||||
|
from core.runtime.stopsignals import checkDependency
|
||||||
#from core.runtime.skipstep import skipStep
|
#from core.runtime.skipstep import skipStep
|
||||||
#from core.runtime.recursive import recursiveSet
|
#from core.runtime.recursive import recursiveSet
|
||||||
|
|
||||||
@@ -11,19 +12,13 @@ def buildOperation(definition, outputs):
|
|||||||
responses = []
|
responses = []
|
||||||
outputs["stopsignals"] = []
|
outputs["stopsignals"] = []
|
||||||
for action in actions:
|
for action in actions:
|
||||||
if hasattr(action, "depends"):
|
stop = checkDependency(action, outputs)
|
||||||
stop =any(
|
|
||||||
dependency in outputs["stopsignals"]
|
|
||||||
for dependency in action.depends
|
|
||||||
)
|
|
||||||
|
|
||||||
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
|
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
|
||||||
#print(outputs["stopsignals"])
|
#print(outputs["stopsignals"])
|
||||||
#stop = True
|
|
||||||
#break
|
|
||||||
|
|
||||||
if stop:
|
if stop:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
outputs, response = executeContract(action, outputs)
|
outputs, response = executeContract(action, outputs)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from core.execution import action
|
|||||||
from core.execution.action.action import buildAction
|
from core.execution.action.action import buildAction
|
||||||
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
||||||
from core.apirequest import executeRequest
|
from core.apirequest import executeRequest
|
||||||
|
from core.runtime.stopsignals import checkDependency
|
||||||
|
|
||||||
def buildRecursive(definition, outputs):
|
def buildRecursive(definition, outputs):
|
||||||
responses = []
|
responses = []
|
||||||
@@ -29,19 +30,16 @@ def buildRecursive(definition, outputs):
|
|||||||
|
|
||||||
outputs["stopsignals"] = []
|
outputs["stopsignals"] = []
|
||||||
for job in recursiveset:
|
for job in recursiveset:
|
||||||
if hasattr(job, "depends"):
|
stop = checkDependency(job, outputs)
|
||||||
stop =any(
|
|
||||||
dependency in outputs["stopsignals"]
|
|
||||||
for dependency in job.depends
|
|
||||||
)
|
|
||||||
|
|
||||||
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
||||||
#print(outputs["stopsignals"])
|
#print(outputs["stopsignals"])
|
||||||
|
#print(stop)
|
||||||
|
|
||||||
if stop:
|
if stop:
|
||||||
#print("STOP SIGNAL DETECTED")
|
#print("STOP SIGNAL DETECTED")
|
||||||
#print(f"Stopping {job.name} due to stop signal")
|
#print(f"Stopping {job.name} due to stop signal")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#print(f"RECURSIVE DEBUG DURING {job.name}")
|
#print(f"RECURSIVE DEBUG DURING {job.name}")
|
||||||
#print(item)
|
#print(item)
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
from core.execution.action import action
|
||||||
from core.runtime import buildSelect, buildOutput, buildSave, loadSave, saveRow, readRow, buildLog
|
from core.runtime import buildSelect, buildOutput, buildSave, loadSave, saveRow, readRow, buildLog
|
||||||
from core.runtime.image import buildImage
|
from core.runtime.image import buildImage
|
||||||
#from core.runtime.select import buildSelect3
|
#from core.runtime.select import buildSelect3
|
||||||
from core.runtime.resolver import resolveItem, extractItem
|
from core.runtime.resolver import resolveItem, extractItem
|
||||||
from core.runtime.applyconditions import applyConditions
|
from core.runtime.applyconditions import applyConditions
|
||||||
from core.runtime.responsepolicy import responsePolicy
|
from core.runtime.responsepolicy import responsePolicy
|
||||||
|
from core.runtime.stopsignals import addStopSignal
|
||||||
|
|
||||||
def buildPreRuntimeAttr(action, outputs):
|
def buildPreRuntimeAttr(action, outputs):
|
||||||
outputs = loadSave(action, outputs)
|
outputs = loadSave(action, outputs)
|
||||||
@@ -14,19 +16,21 @@ def buildPreRuntimeAttr(action, outputs):
|
|||||||
|
|
||||||
match, filter = applyConditions(action, resolved, outputs)
|
match, filter = applyConditions(action, resolved, outputs)
|
||||||
|
|
||||||
|
if match:
|
||||||
|
outputs = addStopSignal(action, outputs)
|
||||||
|
|
||||||
return outputs, resolved, match, filter
|
return outputs, resolved, match, filter
|
||||||
|
|
||||||
|
|
||||||
def buildRuntimeAttr(action, outputs, resolved, response):
|
def buildRuntimeAttr(action, outputs, resolved, response):
|
||||||
outputs, resolved = responsePolicy(response, action, outputs, resolved)
|
outputs, resolved = responsePolicy(response, action, outputs, resolved)
|
||||||
|
|
||||||
if not response.ok:
|
|
||||||
if hasattr(action, "depends"):
|
|
||||||
outputs["stopsignals"].append(action.alias)
|
|
||||||
return outputs, response
|
|
||||||
|
|
||||||
outputs = buildOutput(response, action, outputs)
|
outputs = buildOutput(response, action, outputs)
|
||||||
|
|
||||||
|
if not response.ok:
|
||||||
|
outputs = addStopSignal(action, outputs)
|
||||||
|
return outputs, response
|
||||||
|
|
||||||
resolved = extractItem(action, outputs, resolved)
|
resolved = extractItem(action, outputs, resolved)
|
||||||
|
|
||||||
outputs = buildImage(response, action, outputs)
|
outputs = buildImage(response, action, outputs)
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
def checkDependency(action, outputs):
|
||||||
|
if hasattr(action, "depends"):
|
||||||
|
stop = any(
|
||||||
|
dependency in outputs["stopsignals"]
|
||||||
|
for dependency in action.depends
|
||||||
|
)
|
||||||
|
|
||||||
|
if stop:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def addStopSignal(action, outputs):
|
||||||
|
if hasattr(action, "depends"):
|
||||||
|
outputs["stopsignals"].append(action.alias)
|
||||||
|
|
||||||
|
return outputs
|
||||||
@@ -8,6 +8,7 @@ alias = "rmassmessagepush"
|
|||||||
|
|
||||||
depends = [
|
depends = [
|
||||||
"synapsegetroomalias",
|
"synapsegetroomalias",
|
||||||
|
"synapsegetlastmessage",
|
||||||
]
|
]
|
||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ alias = "synapsegetattachment"
|
|||||||
|
|
||||||
depends = [
|
depends = [
|
||||||
"synapsegetroomalias",
|
"synapsegetroomalias",
|
||||||
|
"synapsegetlastmessage",
|
||||||
]
|
]
|
||||||
|
|
||||||
## PRE-RUNTIME ACTIONS
|
## PRE-RUNTIME ACTIONS
|
||||||
|
|||||||
@@ -47,18 +47,18 @@ outputs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filters = [
|
filters = [
|
||||||
{
|
# {
|
||||||
"filterkey": "rmass_sent_status",
|
# "filterkey": "rmass_sent_status",
|
||||||
"operator": "==",
|
# "operator": "==",
|
||||||
"filtervalue": "fail",
|
# "filtervalue": "fail",
|
||||||
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
# "print": f"Failed to send message to RMASS. Bypassing {name}...",
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
"filterkey": "rmass_sent_status",
|
# "filterkey": "rmass_sent_status",
|
||||||
"operator": "==",
|
# "operator": "==",
|
||||||
"filtervalue": "error",
|
# "filtervalue": "error",
|
||||||
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
# "print": f"Failed to send message to RMASS. Bypassing {name}...",
|
||||||
},
|
# },
|
||||||
{
|
{
|
||||||
"filterkey": "event_id",
|
"filterkey": "event_id",
|
||||||
"operator": "==",
|
"operator": "==",
|
||||||
|
|||||||
@@ -11,15 +11,9 @@ recursiveset = {
|
|||||||
"outputlabel": "outmessageitem",
|
"outputlabel": "outmessageitem",
|
||||||
"actions": [
|
"actions": [
|
||||||
synapsegetroomalias,
|
synapsegetroomalias,
|
||||||
rmassmessagepush,
|
|
||||||
synapsegetlastmessage,
|
synapsegetlastmessage,
|
||||||
#synapsegetattachment,
|
rmassmessagepush,
|
||||||
#getrmassattachmenturl,
|
|
||||||
#synapseattachmenttormass,
|
|
||||||
#getrmassattachmentid,
|
|
||||||
#rmassattachmentpush,
|
|
||||||
rmassattachmentpushflow,
|
rmassattachmentpushflow,
|
||||||
#synapsegetlastmessage,
|
|
||||||
savermassmessageid,
|
savermassmessageid,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTMwNTE5ODUsIm5iZiI6MTc5MzA1MTgwNSwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MzA1MTg2NX0.pMPPsvgYfsRhTj7NJFc0hj3N-8gP1Th3oX9NQce9e2-NJw7ANxFv-7sdmeDE71_B71He7cych-kW5RFuJpc2ZA", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTU2NDM4NjUsIm5iZiI6MTc5MzA1MTgwNSwianRpIjoiU1BJbnZpSXBmTE5WY1NVQ1ZOQ0VvRUdGUWEwOVIrN3dKOHJuNGZqYU5ZMD0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MzA1MTg2NSwic3ViIjoiMjM4MzAyIn0.2N1mzB9BYKgd5tMK10ZuBxW0zqNDDmhN8JtVoQAoeKHcm9JtNzdRa4LfsNPiJ1MOzkXBkTBuktmUI8AiDq78YQ"}
|
||||||
Reference in New Issue
Block a user