|
|
@ -16,6 +16,39 @@ gRobotToOrchestratorKeyList = ["Storage",gRobotKeyStr,"RobotToOrchestrator"]
|
|
|
|
gOrchestratorToRobotResetKeyList = ["Storage",gRobotKeyStr,"OrchestratorToRobotReset"]
|
|
|
|
gOrchestratorToRobotResetKeyList = ["Storage",gRobotKeyStr,"OrchestratorToRobotReset"]
|
|
|
|
gOrchestratorToRobotResetSafeStopKeyList = gOrchestratorToRobotResetKeyList+["SafeTurnOffBool"]
|
|
|
|
gOrchestratorToRobotResetSafeStopKeyList = gOrchestratorToRobotResetKeyList+["SafeTurnOffBool"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
|
|
|
# Activity list
|
|
|
|
|
|
|
|
## Robot START (create RDP session, send CMD to start process)
|
|
|
|
|
|
|
|
gActivityROBOTStartTimeHH_MMStr = "03:00" # Time "HH:MM" [Server time] to execute activity, example "05:10"
|
|
|
|
|
|
|
|
gActivityROBOTStartWeekdayList = [0,1,2,3,4] # WeekdayList when atcivity is starting, default [0,1,2,3,4,5,6]
|
|
|
|
|
|
|
|
gActivityROBOTStartList = [
|
|
|
|
|
|
|
|
{ # Start RDP Session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionConnect", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inHostStr": gRDPSessionHostStr, "inPortStr": gRDPSessionPortStr, "inLoginStr": gRobotADLoginStr, "inPasswordStr": gRobotADPasswordStr} # Args dictionary
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ # Run robot file in RDP session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionProcessStartIfNotRunning", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inProcessNameWEXEStr": f"{gRobotProcessNameWOEXEStr}.exe", "inFilePathStr": gRobotStartFilePathStr, "inFlagGetAbsPathBool": False} # Args dictionary
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
## Robot FORCE STOP (send CMD to stop process, logoff)
|
|
|
|
|
|
|
|
gActivityROBOTStopTimeHH_MMStr = "08:00" # Time "HH:MM" [Server time] to execute activity, example "05:10"
|
|
|
|
|
|
|
|
gActivityROBOTStopWeekdayList = [0,1,2,3,4] # WeekdayList when atcivity is starting, default [0,1,2,3,4,5,6]
|
|
|
|
|
|
|
|
gActivityROBOTStopList = [
|
|
|
|
|
|
|
|
{ # Kill process
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionProcessStop", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inProcessNameWEXEStr":f"{gRobotProcessNameWOEXEStr}.exe","inFlagForceCloseBool": True} # Args dictionary
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ # Logoff RDP Session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionLogoff", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr} # Args dictionary
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
# Function, which is generate Dict for front-endswith
|
|
|
|
# Function, which is generate Dict for front-endswith
|
|
|
|
def ControlPanelRenderDict(inGSettings):
|
|
|
|
def ControlPanelRenderDict(inGSettings):
|
|
|
|
"""result={
|
|
|
|
"""result={
|
|
|
@ -37,35 +70,11 @@ def ControlPanelRenderDict(inGSettings):
|
|
|
|
}"""
|
|
|
|
}"""
|
|
|
|
# START :: Create activities :: START #
|
|
|
|
# START :: Create activities :: START #
|
|
|
|
## Robot START (create RDP session, send CMD to start process)
|
|
|
|
## Robot START (create RDP session, send CMD to start process)
|
|
|
|
lActivityROBOTStartList = [
|
|
|
|
lActivityROBOTStartEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(['RobotRDPActive','ActivityList'])},{json.dumps(gActivityROBOTStartList)});".replace("\"","\'")
|
|
|
|
{ # Start RDP Session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionConnect", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inHostStr": gRDPSessionHostStr, "inPortStr": gRDPSessionPortStr, "inLoginStr": gRobotADLoginStr, "inPasswordStr": gRobotADPasswordStr} # Args dictionary
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ # Run robot file in RDP session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionProcessStartIfNotRunning", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inProcessNameWEXEStr": f"{gRobotProcessNameWOEXEStr}.exe", "inFilePathStr": gRobotStartFilePathStr, "inFlagGetAbsPathBool": False} # Args dictionary
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
lActivityROBOTStartEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(['RobotRDPActive','ActivityList'])},{json.dumps(lActivityROBOTStartList)});".replace("\"","\'")
|
|
|
|
|
|
|
|
## Robot SAFE STOP (SAFE STOP COMMAND (FROM ROBOT RULES), Logoff must do robot when safe turn off)
|
|
|
|
## Robot SAFE STOP (SAFE STOP COMMAND (FROM ROBOT RULES), Logoff must do robot when safe turn off)
|
|
|
|
lActivityROBOTSafeStopEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(gOrchestratorToRobotResetSafeStopKeyList)},true);".replace("\"","\'")
|
|
|
|
lActivityROBOTSafeStopEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(gOrchestratorToRobotResetSafeStopKeyList)},true);".replace("\"","\'")
|
|
|
|
## Robot FORCE STOP (create RDP session, send CMD to start process)
|
|
|
|
## Robot FORCE STOP (send CMD to stop process, logoff)
|
|
|
|
lActivityROBOTStopList = [
|
|
|
|
lActivityROBOTStopEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(['RobotRDPActive','ActivityList'])},{json.dumps(gActivityROBOTStopList)});".replace("\"","\'")
|
|
|
|
{ # Kill process
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionProcessStop", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr, "inProcessNameWEXEStr":f"{gRobotProcessNameWOEXEStr}.exe","inFlagForceCloseBool": True} # Args dictionary
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ # Logoff RDP Session
|
|
|
|
|
|
|
|
"DefNameStr":"RDPSessionLogoff", # Function name in RobotRDPActive.Processor
|
|
|
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
|
|
|
"ArgDict":{"inRDPSessionKeyStr": gRDPSessionKeyStr} # Args dictionary
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
lActivityROBOTStopEscaped = f"mGlobal.Processor.ServerValueSet({json.dumps(['RobotRDPActive','ActivityList'])},{json.dumps(lActivityROBOTStopList)});".replace("\"","\'")
|
|
|
|
|
|
|
|
# END :: Create activities :: END #
|
|
|
|
# END :: Create activities :: END #
|
|
|
|
# START :: Init result dict template :: START #
|
|
|
|
# START :: Init result dict template :: START #
|
|
|
|
# lBodyKeyValue_r3_start=f'<a onclick="{lActivityROBOTStartEscaped}" style=\"color:green\">Start</a>'
|
|
|
|
# lBodyKeyValue_r3_start=f'<a onclick="{lActivityROBOTStartEscaped}" style=\"color:green\">Start</a>'
|
|
|
@ -75,10 +84,11 @@ def ControlPanelRenderDict(inGSettings):
|
|
|
|
"DataStorageKey":gControlPanelKeyStr, # CLIENT SIDE:: Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side
|
|
|
|
"DataStorageKey":gControlPanelKeyStr, # CLIENT SIDE:: Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side
|
|
|
|
"SubheaderText":"<Subheader text, state filled below>",
|
|
|
|
"SubheaderText":"<Subheader text, state filled below>",
|
|
|
|
"BodyKeyValueList":[
|
|
|
|
"BodyKeyValueList":[
|
|
|
|
{"Key":"Info","Value":"1"},
|
|
|
|
{"Key":"Scheduler","Value":""},
|
|
|
|
{"Key":"Info","Value":"2"},
|
|
|
|
{"Key":"Start","Value":f"at {gActivityROBOTStartTimeHH_MMStr} in weekdays {gActivityROBOTStartWeekdayList}"},
|
|
|
|
{"Key":"Info","Value":"3"},
|
|
|
|
{"Key":"Stop (kill)","Value":f"at {gActivityROBOTStopTimeHH_MMStr} in weekdays {gActivityROBOTStopWeekdayList}"},
|
|
|
|
{"Key":"Statistic","Value":""}
|
|
|
|
{"Key":"Statistic","Value":""},
|
|
|
|
|
|
|
|
{"Key":"...","Value":""}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"FooterText":"Last update: 9:38:00 09.10.2019",
|
|
|
|
"FooterText":"Last update: 9:38:00 09.10.2019",
|
|
|
|
"FooterButtonX2List":[
|
|
|
|
"FooterButtonX2List":[
|
|
|
@ -117,8 +127,32 @@ def TechDictKeyList_ItemGet(inDict, inKeyList, inDefault={}):
|
|
|
|
lResult=inDefault
|
|
|
|
lResult=inDefault
|
|
|
|
return lResult
|
|
|
|
return lResult
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
|
|
|
# Scheduler to start/stop process
|
|
|
|
|
|
|
|
## Start ROBOT at time
|
|
|
|
|
|
|
|
lActivityTimeItemRobotStart = {
|
|
|
|
|
|
|
|
"TimeHH:MM": gActivityROBOTStartTimeHH_MMStr, #Time [HH:MM] to trigger activity
|
|
|
|
|
|
|
|
"WeekdayList": gActivityROBOTStartWeekdayList, #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
|
|
|
|
|
|
|
|
"Activity":{
|
|
|
|
|
|
|
|
"Type": "GlobalDictKeyListValueSet", #Activity type
|
|
|
|
|
|
|
|
"KeyList": ['RobotRDPActive','ActivityList'] # RobotRDP Active ActivityList
|
|
|
|
|
|
|
|
"Value": gActivityROBOTStartList # ActivityList - see upper
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
## Force stop ROBOT at time
|
|
|
|
|
|
|
|
lActivityTimeItemRobotStop = {
|
|
|
|
|
|
|
|
"TimeHH:MM": gActivityROBOTStopTimeHH_MMStr, #Time [HH:MM] to trigger activity
|
|
|
|
|
|
|
|
"WeekdayList": gActivityROBOTStopWeekdayList, #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
|
|
|
|
|
|
|
|
"Activity":{
|
|
|
|
|
|
|
|
"Type": "GlobalDictKeyListValueSet", #Activity type
|
|
|
|
|
|
|
|
"KeyList": ['RobotRDPActive','ActivityList'] # RobotRDP Active ActivityList
|
|
|
|
|
|
|
|
"Value": gActivityROBOTStopList # ActivityList - see upper
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#Orchestrator settings update
|
|
|
|
#Orchestrator settings update
|
|
|
|
def SettingsUpdate(inGSettings):
|
|
|
|
def SettingsUpdate(inGSettings):
|
|
|
|
#Add RobotRDPActive in control panel
|
|
|
|
#Add RobotRDPActive in control panel
|
|
|
|
inGSettings["ControlPanelDict"]["RobotList"].append({"RenderFunction": ControlPanelRenderDict, "KeyStr": gControlPanelKeyStr})
|
|
|
|
inGSettings["ControlPanelDict"]["RobotList"].append({"RenderFunction": ControlPanelRenderDict, "KeyStr": gControlPanelKeyStr})
|
|
|
|
|
|
|
|
# Add scheduler activity in Scheduler.ActivityTimeList
|
|
|
|
|
|
|
|
inGSettings["Scheduler"]["ActivityTimeList"].append(lActivityTimeItemRobotStart)
|
|
|
|
|
|
|
|
inGSettings["Scheduler"]["ActivityTimeList"].append(lActivityTimeItemRobotStop)
|
|
|
|
return inGSettings
|
|
|
|
return inGSettings
|