Skip to content

Commit

Permalink
Merge pull request #107 from controlm/run-on-demand-documentation
Browse files Browse the repository at this point in the history
support run on-demand Automation-API #89
  • Loading branch information
RefaelBeker7 authored Dec 8, 2024
2 parents 867ed58 + 0afab2c commit 714f037
Show file tree
Hide file tree
Showing 33 changed files with 903 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Control-M Python Client is built for data scientists and developers who prefer a
notebooks/jobtypes
notebooks/jobproperties
notebooks/connectionprofiles
notebooks/run_ondemand
beyond

.. toctree::
Expand Down
137 changes: 137 additions & 0 deletions docs/_sources/notebooks/run_ondemand.ipynb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Run On Demand"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from ctm_python_client.core.comm import Environment\n",
"from aapi import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[AutomationAPI Documentation](https://documents.bmc.com/supportu/API/Monthly/en-US/Documentation/API_Services_RunService.htm#run2)\n",
"\n",
"The `run_on_demand()` method in the Control-M Python Client allows you to execute individual jobs, folders, or subfolders dynamically without using Workflow. You do not need to deploy the jobs to the Control-M/EM database and the User Daily job does not need to trigger them. This is useful for event-driven job executions.\n",
"\n",
"This guide demonstrates how to use `run_on_demand()` with the `Job`, `Folder`, and `SubFolder` classes.\n",
"\n",
"***Requires Control-M/EM version 9.0.21.200***"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Code Example:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+ echo Hello\n",
"Hello\n",
"\n",
"Run Status\n",
"--------------------------------------------------\n",
" run_on_demand928 .................. Ended OK\n",
" HelloJob ...................... Ended OK\n",
"\n",
"Run Status\n",
"--------------------------------------------------\n",
" TestFolder ........................ Ended OK\n",
" HelloJob .......................... Ended OK\n",
"\n"
]
}
],
"source": [
"import time\n",
"# Step 1: Define the Job, Folder, Sub-Folder\n",
"demand_job = JobCommand('HelloJob', command='echo Hello')\n",
"demand_sub_folder = SubFolder(\"TestSubFolder\", job_list=[demand_job])\n",
"demand_folder = Folder(\"TestFolder\", job_list=[demand_job])\n",
"\n",
"# Step 2: Define an Environment\n",
"env = Environment.create_onprem(host='controlm', username='***', password='****')\n",
"# Step 3: Run the Job On Demand\n",
"run_demand_job = demand_job.run_on_demand(\n",
" environment=env,\n",
" run_as='user',\n",
" controlm_server='ControlM'\n",
" )\n",
"time.sleep(4)\n",
"run_demand_job.print_output('HelloJob')\n",
"\n",
"# Step 4: Run the SubFolder On Demand\n",
"run_demand_sub_folder = demand_sub_folder.run_on_demand(\n",
" environment=env,\n",
" run_as='user',\n",
" controlm_server='ControlM'\n",
" )\n",
"time.sleep(4)\n",
"run_demand_sub_folder.print_statuses()\n",
"\n",
"# Step 5: Run the Folder On Demand\n",
"run_demand_folder = demand_folder.run_on_demand(\n",
" environment=env,\n",
" run_as='user',\n",
" controlm_server='ControlM'\n",
" )\n",
"time.sleep(4)\n",
"run_demand_folder.print_statuses()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Additional Notes:\n",
"\n",
"- Ensure that the *Control-M/EM version is 9.0.21.200* or higher. Older versions not support the `run_on_demand()` method.\n",
"- `Folder`s and `Subfolder`s must include at least one `Job`. If a `Folder` or `SubFolder` does not contain any jobs, an exception will be raised with the error:\n",
"`\"Run is not allowed for JSON without jobs\"`\n",
"- The `run_as` user must have the necessary permissions in Control-M.\n",
"- The `controlm_server` parameter specifies the Control-M server responsible for execution."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
1 change: 1 addition & 0 deletions docs/aapi.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/aapi.integration_factory.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
7 changes: 4 additions & 3 deletions docs/beyond.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="aapi package" href="aapi.html" /><link rel="prev" title="Connection Profiles" href="notebooks/connectionprofiles.html" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="aapi package" href="aapi.html" /><link rel="prev" title="Run On Demand" href="notebooks/run_ondemand.html" />

<link rel="shortcut icon" href="_static/favicon.ico"/><!-- Generated with Sphinx 7.1.2 and Furo 2024.05.06 -->
<title>Going Forward - Control-M Python Client documentation</title>
Expand Down Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down Expand Up @@ -316,14 +317,14 @@ <h2>Extending Control-M Python Client<a class="headerlink" href="#extending-cont
</div>
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
</a>
<a class="prev-page" href="notebooks/connectionprofiles.html">
<a class="prev-page" href="notebooks/run_ondemand.html">
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
<div class="page-info">
<div class="context">
<span>Previous</span>
</div>

<div class="title">Connection Profiles</div>
<div class="title">Run On Demand</div>

</div>
</a>
Expand Down
1 change: 1 addition & 0 deletions docs/ctm_python_client.core.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/ctm_python_client.ext.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/ctm_python_client.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/gettingstarted.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
6 changes: 6 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down Expand Up @@ -365,6 +366,11 @@ <h1>Control-M Python Client Documentation<a class="headerlink" href="#control-m-
<li class="toctree-l2"><a class="reference internal" href="notebooks/connectionprofiles.html#ConnectionProfileAzure">ConnectionProfileAzure</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/run_ondemand.html">Run On Demand</a><ul>
<li class="toctree-l2"><a class="reference internal" href="notebooks/run_ondemand.html#Code-Example:">Code Example:</a></li>
<li class="toctree-l2"><a class="reference internal" href="notebooks/run_ondemand.html#Additional-Notes:">Additional Notes:</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beyond.html">Going Forward</a><ul>
<li class="toctree-l2"><a class="reference internal" href="beyond.html#useful-links">Useful Links</a></li>
<li class="toctree-l2"><a class="reference internal" href="beyond.html#extending-control-m-python-client">Extending Control-M Python Client</a></li>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/ai.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/autogen.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
7 changes: 4 additions & 3 deletions docs/notebooks/connectionprofiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Going Forward" href="../beyond.html" /><link rel="prev" title="Job and Folder Properties" href="jobproperties.html" />
<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Run On Demand" href="run_ondemand.html" /><link rel="prev" title="Job and Folder Properties" href="jobproperties.html" />

<link rel="shortcut icon" href="../_static/favicon.ico"/><!-- Generated with Sphinx 7.1.2 and Furo 2024.05.06 -->
<title>Connection Profiles - Control-M Python Client documentation</title>
Expand Down Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down Expand Up @@ -788,12 +789,12 @@ <h2>ConnectionProfileAzure<a class="headerlink" href="#ConnectionProfileAzure" t
<footer>

<div class="related-pages">
<a class="next-page" href="../beyond.html">
<a class="next-page" href="run_ondemand.html">
<div class="page-info">
<div class="context">
<span>Next</span>
</div>
<div class="title">Going Forward</div>
<div class="title">Run On Demand</div>
</div>
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
</a>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/folders.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/hello.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/jobproperties.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1"><a class="reference internal" href="jobtypes.html">Job types</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
1 change: 1 addition & 0 deletions docs/notebooks/jobtypes.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Job types</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobproperties.html">Job and Folder Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionprofiles.html">Connection Profiles</a></li>
<li class="toctree-l1"><a class="reference internal" href="run_ondemand.html">Run On Demand</a></li>
<li class="toctree-l1"><a class="reference internal" href="../beyond.html">Going Forward</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References:</span></p>
Expand Down
Loading

0 comments on commit 714f037

Please sign in to comment.