You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Wiki/ENG_Guide/html/Orchestrator/HowToStart.html

292 lines
15 KiB

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>How to start &mdash; pyOpenRPA v1.2.0 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Description" href="Orchestrator.html" />
<link rel="prev" title="Description" href="../Studio/Studio.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> pyOpenRPA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">ROBOT</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Robot/Robot.html">Description</a></li>
</ul>
<p class="caption"><span class="caption-text">STUDIO</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Studio/Studio.html">Description</a></li>
</ul>
<p class="caption"><span class="caption-text">ORCHESTRATOR</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">How to start</a></li>
<li class="toctree-l1"><a class="reference internal" href="Orchestrator.html">Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="gSettingsTemplate.html">gSettings Template</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">pyOpenRPA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>How to start</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/Orchestrator/HowToStart.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="how-to-start">
<h1>How to start<a class="headerlink" href="#how-to-start" title="Permalink to this headline"></a></h1>
<p>Start configuration example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">psutil</span><span class="o">,</span> <span class="nn">datetime</span><span class="o">,</span> <span class="nn">logging</span><span class="o">,</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">sys</span> <span class="c1"># stdout from logging</span>
<span class="c1"># Config settings</span>
<span class="n">lPyOpenRPASourceFolderPathStr</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">&quot;..\Sources&quot;</span> <span class="c1"># Path for test pyOpenRPA package</span>
<span class="c1"># INFO Relative/Absolute import see below - after settings init</span>
<span class="c1"># Template for import CP - Control Panels</span>
<span class="c1"># ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine</span>
<span class="c1">## !!! For Absolute import !!!</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># import pyRobot_CP</span>
<span class="c1"># pyRobot_CP.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1">## !!! For Relative import !!!</span>
<span class="c1"># sys.path.insert(0,os.path.abspath(os.path.join(r&quot;..\ROBOT\Builds&quot;)))</span>
<span class="c1"># from pyRobot_CP import ControlPanel</span>
<span class="c1"># ControlPanel.SettingsUpdate(inGSettings=gSettings)</span>
<span class="c1"># Operations</span>
<span class="k">if</span> <span class="n">lPyOpenRPASourceFolderPathStr</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span><span class="p">:</span> <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lPyOpenRPASourceFolderPathStr</span><span class="p">)))</span> <span class="c1"># Path for test pyOpenRPA package</span>
<span class="c1"># Start import after config the pyOpenRPA folder</span>
<span class="kn">from</span> <span class="nn">pyOpenRPA.Orchestrator</span> <span class="kn">import</span> <span class="n">SettingsTemplate</span> <span class="c1"># Import functionallity</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span> <span class="c1"># New init way - allow run as module -m PyOpenRPA.Orchestrator</span>
<span class="kn">from</span> <span class="nn">pyOpenRPA</span> <span class="kn">import</span> <span class="n">Orchestrator</span> <span class="c1"># Import orchestrator main</span>
<span class="n">gSettings</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">inModeStr</span><span class="o">=</span><span class="s2">&quot;BASIC&quot;</span><span class="p">)</span> <span class="c1"># Create GSettings with basic configuration</span>
<span class="c1"># TEST Add User ND - Add Login ND to superuser of the Orchestrator</span>
<span class="n">lUACClientDict</span> <span class="o">=</span> <span class="n">SettingsTemplate</span><span class="o">.</span><span class="n">__UACClientAdminCreate__</span><span class="p">()</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;LogViewerBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;CMDInputBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;ScreenshotViewerBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartOrchestratorBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartOrchestratorGITPullBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AdminDict&quot;][&quot;RestartPCBool&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;RDPKeyDict&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AgentKeyDict&quot;]</span>
<span class="c1"># del lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;]</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;][&quot;VersionCheck&quot;]=True</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;CPKeyDict&quot;][&quot;TEST&quot;]=True</span>
<span class="c1">#lUACClientDict[&quot;pyOpenRPADict&quot;][&quot;AgentKeyDict&quot;][&quot;DESKTOP----;ND&quot;]=True</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inADLoginStr</span><span class="o">=</span><span class="s2">&quot;ND&quot;</span><span class="p">,</span> <span class="n">inADStr</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">inADIsDefaultBool</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">inURLList</span><span class="o">=</span><span class="p">[],</span> <span class="n">inRoleHierarchyAllowedDict</span><span class="o">=</span><span class="n">lUACClientDict</span><span class="p">)</span>
<span class="c1"># TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inADLoginStr</span><span class="o">=</span><span class="s2">&quot;IMaslov&quot;</span><span class="p">,</span> <span class="n">inADStr</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">inADIsDefaultBool</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">inURLList</span><span class="o">=</span><span class="p">[])</span>
<span class="c1"># TEST Add Supertoken for the all access between robots</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACSuperTokenUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inSuperTokenStr</span><span class="o">=</span><span class="s2">&quot;1992-04-03-0643-ru-b4ff-openrpa52zzz&quot;</span><span class="p">)</span>
<span class="c1">## !!! For Relative import !!! CP Version Check</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;&quot;</span><span class="p">)))</span>
<span class="kn">from</span> <span class="nn">ControlPanel</span> <span class="kn">import</span> <span class="n">CP_VersionCheck</span>
<span class="n">CP_VersionCheck</span><span class="o">.</span><span class="n">SettingsUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">gSettings</span><span class="p">[</span><span class="s2">&quot;Logger&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Exception when init CP. See below.&quot;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">ControlPanel</span> <span class="kn">import</span> <span class="n">CP_Test</span>
<span class="n">CP_Test</span><span class="o">.</span><span class="n">SettingsUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">gSettings</span><span class="p">[</span><span class="s2">&quot;Logger&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Exception when init CP. See below.&quot;</span><span class="p">)</span>
<span class="c1"># Call the orchestrator def</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">Orchestrator</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;!WARNING! Current orchestrator settings do not support old type of the Orchestrator start. Use new Orchestrator type start (see v1.2.0)&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="Orchestrator.html" class="btn btn-neutral float-right" title="Description" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="../Studio/Studio.html" class="btn btn-neutral float-left" title="Description" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2020, Ivan Maslov.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>