diff --git a/Sources/GuideSphinx/Orchestrator/02_Defs.rst b/Sources/GuideSphinx/Orchestrator/02_Defs.rst index 7cfbd2ef..712956b1 100644 --- a/Sources/GuideSphinx/Orchestrator/02_Defs.rst +++ b/Sources/GuideSphinx/Orchestrator/02_Defs.rst @@ -27,7 +27,7 @@ pyOpenRPA.Orchestrator.__Orchestrator__ References ********** -`Python-sphinx`_ +`reStructuredText`_ .. target-notes:: .. _`reStructuredText`: http://docutils.sourceforge.net/rst.html diff --git a/Sources/GuideSphinx/Robot/01_Robot.rst b/Sources/GuideSphinx/Robot/01_Robot.rst index f2017b64..d3ab5e32 100644 --- a/Sources/GuideSphinx/Robot/01_Robot.rst +++ b/Sources/GuideSphinx/Robot/01_Robot.rst @@ -1,5 +1,5 @@ ************************ -Description +1. Description ************************ pyOpenRPA Robot is the python package. diff --git a/Sources/GuideSphinx/make_ENG_Guide.bat b/Sources/GuideSphinx/make_ENG_Guide.bat index 4797fd2c..d24c66c9 100644 --- a/Sources/GuideSphinx/make_ENG_Guide.bat +++ b/Sources/GuideSphinx/make_ENG_Guide.bat @@ -31,6 +31,7 @@ if errorlevel 9009 ( %SPHINXBUILD% -M html %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% %SPHINXBUILD% -M markdown %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +..\..\Wiki\ENG_Guide\html\index.html goto end :help diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index 0d2f269a..620b8576 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -624,7 +624,7 @@ def ProcessorAliasDefUpdate(inGSettings, inDef, inAliasStr): def ProcessorActivityItemCreate(inDef, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None): """ - Create ActivityItem + Create activity item. Activity item can be used as list item in ProcessorActivityItemAppend or in Processor.ActivityListExecute. .. code-block:: python @@ -689,28 +689,68 @@ def ProcessorActivityItemCreate(inDef, inArgList=None, inArgDict=None, inArgGSet } return lActivityItemDict -def ProcessorActivityItemAppend(inGSettings, inDef, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None): +def ProcessorActivityItemAppend(inGSettings, inDef=None, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None, inActivityItemDict=None): """ - Add Activity item in Processor list + Create and add activity item in processor queue. + + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + # EXAMPLE 1 + def TestDef(inArg1Str, inGSettings, inLogger): + pass + lActivityItem = Orchestrator.ProcessorActivityItemAppend( + inGSettings = gSettingsDict, + inDef = TestDef, + inArgList=[], + inArgDict={"inArg1Str": "ArgValueStr"}, + inArgGSettingsStr = "inGSettings", + inArgLoggerStr = "inLogger") + # Activity have been already append in the processor queue + + # EXAMPLE 2 + def TestDef(inArg1Str): + pass + Orchestrator.ProcessorAliasDefUpdate( + inGSettings = gSettings, + inDef = TestDef, + inAliasStr="TestDefAlias") + lActivityItem = Orchestrator.ProcessorActivityItemCreate( + inDef = "TestDefAlias", + inArgList=[], + inArgDict={"inArg1Str": "ArgValueStr"}, + inArgGSettingsStr = None, + inArgLoggerStr = None) + Orchestrator.ProcessorActivityItemAppend( + inGSettings = gSettingsDict, + inActivityItemDict = lActivityItem) + # Activity have been already append in the processor queue :param inGSettings: Global settings dict (singleton) - :param inDef: - :param inArgList: - :param inArgDict: - :param inArgGSettingsStr: - :param inArgLoggerStr: - """ - if inArgList is None: inArgList=[] - if inArgDict is None: inArgDict={} - lActivityList=[ - { - "Def":inDef, # def link or def alias (look gSettings["Processor"]["AliasDefDict"]) - "ArgList":inArgList, # Args list - "ArgDict":inArgDict, # Args dictionary - "ArgGSettings": inArgGSettingsStr, # Name of GSettings attribute: str (ArgDict) or index (for ArgList) - "ArgLogger": inArgLoggerStr # Name of GSettings attribute: str (ArgDict) or index (for ArgList) - } - ] + :param inDef: def link or def alias (look gSettings["Processor"]["AliasDefDict"]) + :param inArgList: Args list for the Def + :param inArgDict: Args dict for the Def + :param inArgGSettingsStr: Name of def argument of the GSettings dict + :param inArgLoggerStr: Name of def argument of the logging object + :param inActivityItemDict: Fill if you already have ActivityItemDict (don't fill inDef, inArgList, inArgDict, inArgGSettingsStr, inArgLoggerStr) + """ + if inActivityItemDict is None: + if inArgList is None: inArgList=[] + if inArgDict is None: inArgDict={} + if inDef is None: raise Exception(f"pyOpenRPA Exception: ProcessorActivityItemAppend need inDef arg if you dont use inActivityItemDict") + lActivityList=[ + { + "Def":inDef, # def link or def alias (look gSettings["Processor"]["AliasDefDict"]) + "ArgList":inArgList, # Args list + "ArgDict":inArgDict, # Args dictionary + "ArgGSettings": inArgGSettingsStr, # Name of GSettings attribute: str (ArgDict) or index (for ArgList) + "ArgLogger": inArgLoggerStr # Name of GSettings attribute: str (ArgDict) or index (for ArgList) + } + ] + else: + lActivityList = [inActivityItemDict] inGSettings["ProcessorDict"]["ActivityList"]+=lActivityList ## Process defs @@ -718,8 +758,16 @@ def ProcessIsStarted(inProcessNameWOExeStr): # Check if process is started """ Check if there is any running process that contains the given name processName. - :param inProcessNameWOExeStr: - :return: True - process is running; False - process is not running + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + lProcessIsStartedBool = Orchestrator.ProcessIsStarted(inProcessNameWOExeStr = "notepad") + # lProcessIsStartedBool is True - notepad.exe is running on the Orchestrator machine + + :param inProcessNameWOExeStr: Process name WithOut (WO) '.exe' postfix. Example: "notepad" (not "notepad.exe") + :return: True - process is running on the orchestrator machine; False - process is not running on the orchestrator machine """ #Iterate over the all the running process for proc in psutil.process_iter(): @@ -733,11 +781,23 @@ def ProcessIsStarted(inProcessNameWOExeStr): # Check if process is started def ProcessStart(inPathStr, inArgList, inStopProcessNameWOExeStr=None): """ - Start process locally [optional: if task name is not started] + Start process locally. Extra feature: Use inStopProcessNameWOExeStr to stop the execution if current process is running. - :param inPathStr: - :param inArgList: - :param inStopProcessNameWOExeStr: + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + Orchestrator.ProcessStart( + inPathStr = "notepad" + inArgList = [] + inStopProcessNameWOExeStr = "notepad") + # notepad.exe will be started if no notepad.exe is active on the machine + + :param inPathStr: Command to send in CMD + :param inArgList: List of the arguments for the CMD command. Example: ["test.txt"] + :param inStopProcessNameWOExeStr: Trigger: stop execution if process is running. Process name WithOut (WO) '.exe' postfix. Example: "notepad" (not "notepad.exe") + :return: None - nothing is returned. If process will not start -exception will be raised """ lStartProcessBool = True if inStopProcessNameWOExeStr is not None: #Check if process running @@ -752,17 +812,29 @@ def ProcessStart(inPathStr, inArgList, inStopProcessNameWOExeStr=None): if lStartProcessBool == True: # Start if flag is true lItemArgs=[inPathStr] + if inArgList is None: inArgList = [] # 2021 02 22 Minor fix default value lItemArgs.extend(inArgList) subprocess.Popen(lItemArgs,shell=True) def ProcessStop(inProcessNameWOExeStr, inCloseForceBool, inUserNameStr = "%username%"): """ - Stop process + Stop process on the orchestrator machine. You can set user session on the machine and set flag about to force close process. - :param inProcessNameWOExeStr: - :param inCloseForceBool: - :param inUserNameStr: - :return: + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + Orchestrator.ProcessStop( + inProcessNameWOExeStr = "notepad" + inCloseForceBool = True + inUserNameStr = "USER_99") + # Will close process "notepad.exe" on the user session "USER_99" (!ATTENTION! if process not exists no exceptions will be raised) + + :param inProcessNameWOExeStr: Process name WithOut (WO) '.exe' postfix. Example: "notepad" (not "notepad.exe") + :param inCloseForceBool: True - do force close. False - send signal to safe close (!ATTENTION! - Safe close works only in orchestrator session. Win OS doens't allow to send safe close signal between GUI sessions) + :param inUserNameStr: User name which is has current process to close. Default value is close process on the Orchestrator session + :return: None """ # Support input arg if with .exe lProcessNameWExeStr = inProcessNameWOExeStr @@ -783,15 +855,35 @@ def ProcessStop(inProcessNameWOExeStr, inCloseForceBool, inUserNameStr = "%usern def ProcessListGet(inProcessNameWOExeList=None): """ - Check activity of the list of processes + Return process list on the orchestrator machine. You can determine the list of the processes you are interested - def will return the list about it. + + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + lProcessList = Orchestrator.ProcessListGet() + # Return the list of the process on the machine. !ATTENTION! RUn orchestrator as administrator to get all process list on the machine. :param inProcessNameWOExeList: - :return: TODO FILL THE RESULT DICT + :return: { + "ProcessWOExeList": ["notepad","..."], + "ProcessWOExeUpperList": ["NOTEPAD","..."], + "ProcessDetailList": [ + { + 'pid': 412, + 'username': "DESKTOP\\USER", + 'name': 'notepad.exe', + 'vms': 13.77767775, + 'NameWOExeUpperStr': 'NOTEPAD', + 'NameWOExeStr': "'notepad'"}, + {...}] + """ if inProcessNameWOExeList is None: inProcessNameWOExeList = [] '''Get list of running process sorted by Memory Usage and filtered by inProcessNameWOExeList''' lMapUPPERInput = {} # Mapping for processes WO exe - lResult = {"ProcessWOExeList":[],"ProcessDetailList":[]} + lResult = {"ProcessWOExeList":[], "ProcessWOExeUpperList":[],"ProcessDetailList":[]} # Create updated list for quick check lProcessNameWOExeList = [] for lItem in inProcessNameWOExeList: @@ -807,9 +899,13 @@ def ProcessListGet(inProcessNameWOExeList=None): pinfo['NameWOExeUpperStr'] = pinfo['name'][:-4].upper() # Add if empty inProcessNameWOExeList or if process in inProcessNameWOExeList if len(lProcessNameWOExeList)==0 or pinfo['name'].upper() in lProcessNameWOExeList: - pinfo['NameWOExeStr'] = lMapUPPERInput[pinfo['name'].upper()] + try: # 2021 02 22 Minor fix if not admin rights + pinfo['NameWOExeStr'] = lMapUPPERInput[pinfo['name'].upper()] + except Exception as e: + pinfo['NameWOExeStr'] = pinfo['name'][:-4] lResult["ProcessDetailList"].append(pinfo) # Append dict to list lResult["ProcessWOExeList"].append(pinfo['NameWOExeStr']) + lResult["ProcessWOExeUpperList"].append(pinfo['NameWOExeUpperStr']) except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): pass return lResult diff --git a/Wiki/ENG_Guide/html/Orchestrator/01_Orchestrator.html b/Wiki/ENG_Guide/html/Orchestrator/01_Orchestrator.html index 54f2133f..207a29f0 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/01_Orchestrator.html +++ b/Wiki/ENG_Guide/html/Orchestrator/01_Orchestrator.html @@ -86,7 +86,7 @@

ROBOT

STUDIO

diff --git a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html index 0ff3224a..1b270b56 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html +++ b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html @@ -86,7 +86,7 @@

ROBOT

STUDIO

@@ -236,19 +236,19 @@

Check if there is any running process that contains the given name processName.

ProcessListGet([inProcessNameWOExeList])

-

Check activity of the list of processes

+

Return process list on the orchestrator machine.

ProcessStart(inPathStr, inArgList[, …])

-

Start process locally [optional: if task name is not started]

+

Start process locally.

ProcessStop(inProcessNameWOExeStr, …[, …])

-

Stop process

+

Stop process on the orchestrator machine.

-

ProcessorActivityItemAppend(inGSettings, inDef)

-

Add Activity item in Processor list

+

ProcessorActivityItemAppend(inGSettings[, …])

+

Create and add activity item in processor queue.

ProcessorActivityItemCreate(inDef[, …])

-

Create ActivityItem

+

Create activity item.

ProcessorAliasDefCreate(inGSettings, inDef)

Create alias for def (can be used in ActivityItem in field Def) !WHEN DEF ALIAS IS REQUIRED! - Def alias is required when you try to call Python def from the Orchestrator WEB side (because you can’t transmit Python def object out of the Python environment)

@@ -620,12 +620,19 @@ Create Activity Item for the agent

pyOpenRPA.Orchestrator.__Orchestrator__.ProcessIsStarted(inProcessNameWOExeStr)[source]

Check if there is any running process that contains the given name processName.

+
# USAGE
+from pyOpenRPA import Orchestrator
+
+lProcessIsStartedBool = Orchestrator.ProcessIsStarted(inProcessNameWOExeStr = "notepad")
+# lProcessIsStartedBool is True - notepad.exe is running on the Orchestrator machine
+
+
Parameters
-

inProcessNameWOExeStr

+

inProcessNameWOExeStr – Process name WithOut (WO) ‘.exe’ postfix. Example: “notepad” (not “notepad.exe”)

Returns
-

True - process is running; False - process is not running

+

True - process is running on the orchestrator machine; False - process is not running on the orchestrator machine

@@ -633,63 +640,144 @@ Create Activity Item for the agent

pyOpenRPA.Orchestrator.__Orchestrator__.ProcessListGet(inProcessNameWOExeList=None)[source]
-

Check activity of the list of processes

+

Return process list on the orchestrator machine. You can determine the list of the processes you are interested - def will return the list about it.

+
# USAGE
+from pyOpenRPA import Orchestrator
+
+lProcessList = Orchestrator.ProcessListGet()
+# Return the list of the process on the machine. !ATTENTION! RUn orchestrator as administrator to get all process list on the machine.
+
+
Parameters

inProcessNameWOExeList

Returns
-

TODO FILL THE RESULT DICT

+

{

+

+
+
+

“ProcessWOExeList”: [“notepad”,”…”], +“ProcessWOExeUpperList”: [“NOTEPAD”,”…”], +“ProcessDetailList”: [

+
+
+
{

‘pid’: 412, +‘username’: “DESKTOPUSER”, +‘name’: ‘notepad.exe’, +‘vms’: 13.77767775, +‘NameWOExeUpperStr’: ‘NOTEPAD’, +‘NameWOExeStr’: “‘notepad’”},

+

{…}]

+
pyOpenRPA.Orchestrator.__Orchestrator__.ProcessStart(inPathStr, inArgList, inStopProcessNameWOExeStr=None)[source]
-

Start process locally [optional: if task name is not started]

+

Start process locally. Extra feature: Use inStopProcessNameWOExeStr to stop the execution if current process is running.

+
# USAGE
+from pyOpenRPA import Orchestrator
+
+Orchestrator.ProcessStart(
+    inPathStr = "notepad"
+    inArgList = []
+    inStopProcessNameWOExeStr = "notepad")
+# notepad.exe will be started if no notepad.exe is active on the machine
+
+
Parameters
    -
  • inPathStr

  • -
  • inArgList

  • -
  • inStopProcessNameWOExeStr

  • +
  • inPathStr – Command to send in CMD

  • +
  • inArgList – List of the arguments for the CMD command. Example: [“test.txt”]

  • +
  • inStopProcessNameWOExeStr – Trigger: stop execution if process is running. Process name WithOut (WO) ‘.exe’ postfix. Example: “notepad” (not “notepad.exe”)

+
Returns
+

None - nothing is returned. If process will not start -exception will be raised

+
pyOpenRPA.Orchestrator.__Orchestrator__.ProcessStop(inProcessNameWOExeStr, inCloseForceBool, inUserNameStr='%username%')[source]
-

Stop process

+

Stop process on the orchestrator machine. You can set user session on the machine and set flag about to force close process.

+
# USAGE
+from pyOpenRPA import Orchestrator
+
+Orchestrator.ProcessStop(
+    inProcessNameWOExeStr = "notepad"
+    inCloseForceBool = True
+    inUserNameStr = "USER_99")
+# Will close process "notepad.exe" on the user session "USER_99" (!ATTENTION! if process not exists no exceptions will be raised)
+
+
Parameters
    -
  • inProcessNameWOExeStr

  • -
  • inCloseForceBool

  • -
  • inUserNameStr

  • +
  • inProcessNameWOExeStr – Process name WithOut (WO) ‘.exe’ postfix. Example: “notepad” (not “notepad.exe”)

  • +
  • inCloseForceBool – True - do force close. False - send signal to safe close (!ATTENTION! - Safe close works only in orchestrator session. Win OS doens’t allow to send safe close signal between GUI sessions)

  • +
  • inUserNameStr – User name which is has current process to close. Default value is close process on the Orchestrator session

Returns
-

+

None

-pyOpenRPA.Orchestrator.__Orchestrator__.ProcessorActivityItemAppend(inGSettings, inDef, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None)[source]
-

Add Activity item in Processor list

+pyOpenRPA.Orchestrator.__Orchestrator__.ProcessorActivityItemAppend(inGSettings, inDef=None, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None, inActivityItemDict=None)[source] +

Create and add activity item in processor queue.

+
# USAGE
+from pyOpenRPA import Orchestrator
+
+# EXAMPLE 1
+def TestDef(inArg1Str, inGSettings, inLogger):
+    pass
+lActivityItem = Orchestrator.ProcessorActivityItemAppend(
+    inGSettings = gSettingsDict,
+    inDef = TestDef,
+    inArgList=[],
+    inArgDict={"inArg1Str": "ArgValueStr"},
+    inArgGSettingsStr = "inGSettings",
+    inArgLoggerStr = "inLogger")
+# Activity have been already append in the processor queue
+
+# EXAMPLE 2
+def TestDef(inArg1Str):
+    pass
+Orchestrator.ProcessorAliasDefUpdate(
+    inGSettings = gSettings,
+    inDef = TestDef,
+    inAliasStr="TestDefAlias")
+lActivityItem = Orchestrator.ProcessorActivityItemCreate(
+    inDef = "TestDefAlias",
+    inArgList=[],
+    inArgDict={"inArg1Str": "ArgValueStr"},
+    inArgGSettingsStr = None,
+    inArgLoggerStr = None)
+Orchestrator.ProcessorActivityItemAppend(
+    inGSettings = gSettingsDict,
+    inActivityItemDict = lActivityItem)
+# Activity have been already append in the processor queue
+
+
Parameters
  • inGSettings – Global settings dict (singleton)

  • -
  • inDef

  • -
  • inArgList

  • -
  • inArgDict

  • -
  • inArgGSettingsStr

  • -
  • inArgLoggerStr

  • +
  • inDef – def link or def alias (look gSettings[“Processor”][“AliasDefDict”])

  • +
  • inArgList – Args list for the Def

  • +
  • inArgDict – Args dict for the Def

  • +
  • inArgGSettingsStr – Name of def argument of the GSettings dict

  • +
  • inArgLoggerStr – Name of def argument of the logging object

  • +
  • inActivityItemDict – Fill if you already have ActivityItemDict (don’t fill inDef, inArgList, inArgDict, inArgGSettingsStr, inArgLoggerStr)

@@ -698,7 +786,7 @@ Create Activity Item for the agent

pyOpenRPA.Orchestrator.__Orchestrator__.ProcessorActivityItemCreate(inDef, inArgList=None, inArgDict=None, inArgGSettingsStr=None, inArgLoggerStr=None)[source]
-

Create ActivityItem

+

Create activity item. Activity item can be used as list item in ProcessorActivityItemAppend or in Processor.ActivityListExecute.

# USAGE
 from pyOpenRPA import Orchestrator
 
@@ -1310,7 +1398,12 @@ Var 2  (Backward compatibility): inGSettings, inRDPSessionKeyStr, inHostStr, inP
 
diff --git a/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html b/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html index 9c21ab17..a0c9db84 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html +++ b/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html @@ -86,7 +86,7 @@

ROBOT

STUDIO

diff --git a/Wiki/ENG_Guide/html/Orchestrator/04_HowToStart.html b/Wiki/ENG_Guide/html/Orchestrator/04_HowToStart.html index 2723cdc5..ecbe7476 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/04_HowToStart.html +++ b/Wiki/ENG_Guide/html/Orchestrator/04_HowToStart.html @@ -85,7 +85,7 @@

ROBOT

STUDIO

diff --git a/Wiki/ENG_Guide/html/Robot/01_Robot.html b/Wiki/ENG_Guide/html/Robot/01_Robot.html index 5da91d70..907b7f44 100644 --- a/Wiki/ENG_Guide/html/Robot/01_Robot.html +++ b/Wiki/ENG_Guide/html/Robot/01_Robot.html @@ -7,7 +7,7 @@ - Description — pyOpenRPA v1.2.0 documentation + 1. Description — pyOpenRPA v1.2.0 documentation @@ -86,7 +86,7 @@

ROBOT

    -
  • Description
      +
    • 1. Description
    • @@ -150,7 +150,7 @@
    • »
    • -
    • Description
    • +
    • 1. Description
    • @@ -170,7 +170,7 @@
      -

      Description

      +

      1. Description

      pyOpenRPA Robot is the python package.

      pyOpenRPA Robot

      diff --git a/Wiki/ENG_Guide/html/Robot/02_Defs.html b/Wiki/ENG_Guide/html/Robot/02_Defs.html index a6e8bfc8..41f9c470 100644 --- a/Wiki/ENG_Guide/html/Robot/02_Defs.html +++ b/Wiki/ENG_Guide/html/Robot/02_Defs.html @@ -39,7 +39,7 @@ - + @@ -86,7 +86,7 @@

      ROBOT

        -
      • Description
      • +
      • 1. Description
      • 2. Defs
        • pyOpenRPA.Robot.UIDesktop
        • References
        • @@ -233,7 +233,7 @@