From e14bed7fcab0caa13c168aec616c7af64aa234c1 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Fri, 7 Jan 2022 23:33:29 +0300 Subject: [PATCH] Testing pyOpenRPA.Orchestrator.Managers.Process defs --- .../Orchestrator/Managers/Process.py | 5 +++- .../Orchestrator/Managers/__init__.py | 4 +-- .../pyOpenRPA/Orchestrator/ServerSettings.py | 8 +++--- .../Orchestrator/__Orchestrator__.py | 25 ++++++++++--------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/Managers/Process.py b/Sources/pyOpenRPA/Orchestrator/Managers/Process.py index d57616f6..c3e1273f 100644 --- a/Sources/pyOpenRPA/Orchestrator/Managers/Process.py +++ b/Sources/pyOpenRPA/Orchestrator/Managers/Process.py @@ -33,6 +33,7 @@ class Process(): self.mProcessNameWOExeStr = inProcessNameWOExeStr self.mStopSafeTimeoutSecFloat = inStopSafeTimeoutSecFloat __Orchestrator__.GSettingsGet()["ManagersProcessDict"][inProcessNameWOExeStr.upper()]=self + self.StatusCheck() def Manual2Auto(self): """ @@ -54,6 +55,8 @@ class Process(): # Send activity item to agent - wait result if self.mStartPathStr is not None: lCMDStr = f"start {os.path.abspath(self.mStartPathStr)}" elif self.mStartCMDStr is not None: lCMDStr = f"start {self.mStartCMDStr}" + #import pdb + #pdb.set_trace() lActivityItemStart = __Orchestrator__.ProcessorActivityItemCreate(inDef="OSCMD", inArgDict={"inCMDStr":lCMDStr,"inSendOutputToOrchestratorLogsBool":False}, inArgGSettingsStr="inGSettings") @@ -88,7 +91,7 @@ class Process(): :return: """ # Send activity item to agent - wait result - lCMDStr = f'taskkill /im "{self.mProcessNameWOExeStr}" /fi "username eq %USERNAME%"' + lCMDStr = f'taskkill /im "{self.mProcessNameWOExeStr}.exe" /fi "username eq %USERNAME%"' lActivityItemStart = __Orchestrator__.ProcessorActivityItemCreate( inDef="OSCMD",inArgDict={"inCMDStr": lCMDStr,"inSendOutputToOrchestratorLogsBool":False},inArgGSettingsStr="inGSettings") lGUIDStr = __Orchestrator__.AgentActivityItemAdd(inHostNameStr=self.mAgentHostNameStr, diff --git a/Sources/pyOpenRPA/Orchestrator/Managers/__init__.py b/Sources/pyOpenRPA/Orchestrator/Managers/__init__.py index 03aac9d7..9c455b1b 100644 --- a/Sources/pyOpenRPA/Orchestrator/Managers/__init__.py +++ b/Sources/pyOpenRPA/Orchestrator/Managers/__init__.py @@ -1,2 +1,2 @@ -from .ControlPanel import ControlPanel -from .Process import Process \ No newline at end of file +from .ControlPanel import * +from .Process import * \ No newline at end of file diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index c1fa9b19..473e0ce1 100644 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -391,9 +391,10 @@ def pyOpenRPA_Debugging_HelperDefList(inRequest, inGSettings): lPathSplitList = __Orchestrator__.WebRequestParsePath(inRequest=inRequest).split('/') lQueryStr = None if "HelperDefList" != lPathSplitList[-1] and "" != lPathSplitList[-1]: lQueryStr = lPathSplitList[-1] - lDefList = __Orchestrator__.ActivityItemHelperDefList(inDefQueryStr=lQueryStr) - for lDefStr in lDefList: - lResultDict["results"].append({"name": lDefStr, "value": lDefStr, "text": lDefStr}) + if lQueryStr != "" and lQueryStr is not None: + lDefList = __Orchestrator__.ActivityItemHelperDefList(inDefQueryStr=lQueryStr) + for lDefStr in lDefList: + lResultDict["results"].append({"name": lDefStr, "value": lDefStr, "text": lDefStr}) __Orchestrator__.WebRequestResponseSend(inRequest=inRequest, inResponeStr=json.dumps(lResultDict)) def pyOpenRPA_Debugging_HelperDefAutofill(inRequest, inGSettings): @@ -473,6 +474,7 @@ def SettingsUpdate(inGlobalConfiguration): {"Method": "POST", "URL": "/pyOpenRPA/ProcessorQueueAdd", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Processor, "ResponseContentType": "application/json"}, {"Method": "POST", "URL": "/pyOpenRPA/ActivityListExecute", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_ActivityListExecute, "ResponseContentType": "application/json"}, {"Method": "POST", "URL": "/pyOpenRPA/Agent/O2A", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_O2A, "ResponseContentType": "application/json"}, + {"Method": "POST", "URL": "/pyOpenRPA/Agent/A2O", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_A2O, "ResponseContentType": "application/json"}, {"Method": "GET", "URL": "/pyOpenRPA/Debugging/HelperDefList/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefList, "ResponseContentType": "application/json"}, {"Method": "GET", "URL": "/pyOpenRPA/Debugging/HelperDefAutofill/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefAutofill, "ResponseContentType": "application/json"}, ] diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index 2775e483..d219da89 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -1208,19 +1208,20 @@ def ActivityItemHelperDefAutofill(inDef): } lResultDict["Def"] = inDef lGS = GSettingsGet() - lDefSignature = inspect.signature(lGS["ProcessorDict"]["AliasDefDict"][inDef]) - for lItemKeyStr in lDefSignature.parameters: - lItemValue = lDefSignature.parameters[lItemKeyStr] - # Check if arg name contains "GSetting" or "Logger" - if "GSETTING" in lItemKeyStr.upper(): - lResultDict["ArgGSettingsStr"] = lItemKeyStr - elif "LOGGER" in lItemKeyStr.upper(): - lResultDict["ArgLoggerStr"] = lItemKeyStr - else: - if lItemValue.default is inspect._empty: - lResultDict["ArgDict"][lItemKeyStr] = None + if inDef in lGS["ProcessorDict"]["AliasDefDict"]: + lDefSignature = inspect.signature(lGS["ProcessorDict"]["AliasDefDict"][inDef]) + for lItemKeyStr in lDefSignature.parameters: + lItemValue = lDefSignature.parameters[lItemKeyStr] + # Check if arg name contains "GSetting" or "Logger" + if "GSETTING" in lItemKeyStr.upper(): + lResultDict["ArgGSettingsStr"] = lItemKeyStr + elif "LOGGER" in lItemKeyStr.upper(): + lResultDict["ArgLoggerStr"] = lItemKeyStr else: - lResultDict["ArgDict"][lItemKeyStr] = lItemValue.default + if lItemValue.default is inspect._empty: + lResultDict["ArgDict"][lItemKeyStr] = None + else: + lResultDict["ArgDict"][lItemKeyStr] = lItemValue.default return lResultDict def ActivityItemCreate(inDef, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None, inGUIDStr = None, inThreadBool = False):