Generic Python Jobs
Generic Python Jobs let you run Python scripts on any OS Agent. Generic Python Jobs can be processed on arbitrary host platforms as long as the Agent where they should run is defined. The only prerequisite is that a Generic Python Job template exists on the target platform. In a fresh installation there are two predefined Generic Python Job templates (Windows and Unix) in Client 0 but administrators can create as many as needed. Generic Python Jobs can run independently or they can be added to a Job Group (JOBG), to a Workflow or to a Schedule.
They can be executed on any OS Agent and on Agent Groups.
The Automic Automation / Python integration includes the Python dictionary with the Automic Automation variables that you can use in Python Jobs. This means that you can include Automic Automation variables using Python scripting just as you do with the AE scripting language. You just have to register the name and value of the variable on the Job's Process page first and you can then use it in your script; you use the :REGISTER_VARIABLE script function for this purpose. The integration lets you create your own variables too, and use them in Python Jobs. Using a specific script statement, you can also get a list of the all available variables. For more information about how to register variables and output files and about how to use Python scripting in Python Jobs, see Python Scripting.
Defining a Generic Python Job
A Generic Python Job definition is made up of the following pages:
- Standard pages that are always available, no matter what type of object you are defining:
- Additional pages that are always available for executable objects:
-
On any of the Process pages, write the script you want this Job to execute on the Agent. Use Python code only or a combination of Python and the Automation Engine scripting language. You can use script variables here.
For more information, see:
-
If necessary, specify additional attributes on any of the other definition pages.
Important! Unlike the other Job types in Automic Automation, you cannot select an Agent on the Attributes page of generic Jobs. This is because the Agent must be set via a script using the &AGENT# or &OVERWRITE_AGENT# variables. The values of these parameters can be defined in a PromptSet or can be inherited from a variable. For more information, see Inheriting Object and PromptSet Variables.
Important Considerations
-
The &OVERWRITE_AGENT# variable has a higher priority than &AGENT#. If both variables are defined, the &OVERWRITE_AGENT# is used.
-
The Agent must be defined before the script is processed. Therefore, you cannot use :PSET to set the &OVERWRITE_AGENT# or &AGENT# variables.
-
If you use :PUT_ATT to overwrite the Agent, you must not change the platform. This means that, if your &AGENT# variable has the name of a UNIX Agent, you cannot use :PUT_ATT to set a Windows Agent. This action results in a FAULT_OTHER error message.
-
Generic Python Jobs do not work with Agent Groups (HOSTG). You cannot set &OVERWRITE_AGENT# or &AGENT# to the name of an Agent group.
-
-
In the Start Parameter section on the Python page do the following:
-
In Python Interpreter enter the Python interpreter that you are using. You have the following options:
-
Leave this file empty. The default python.exe is used. If python.exe is not installed on the target system, py.exe is used instead. If none of them are installed, the Job fails.
-
Enter the full path, for example c:\Prog32\python\ph3.exe.
-
-
In Options you can specify parameters for the interpreter. For information about the available commands, see the official Python documentation at cmdline.html
Important! If you use Unicode characters in your scripts, you must enter -X utf8 here. This is because the Windows default is not UTF8 and it would not interpret UTF-8 characters correctly without this option.
-
Specify the Working Directory in which the Python execution should take place.
-
In Requirements, you specify the list of Python packages (libraries, frameworks or other programs) that this Job requires to be able to execute. Write out each package. It is not necessary to specify their version. When this Job is executed, the Agent calls the Python package manager (PIP), which installs the specified packages (if not already installed).
After executing the Job, the Agent generates a dedicated report called PIP that contains the result of installing the specified packages. If any of them could not be installed, the Job cannot execute.
Important!
-
-
Save your changes.
Executing Generic Python Jobs
You can include the Windows Python Job in Schedules (JSCH)and thus be executed automatically at predefined dates or intervals. Likewise, they can be part of Workflows (JOBP). For more information, see Superordinate Tasks (Parents).
You can also execute them manually. The following topics describe the execution process in Automic Automation in general and the Job-specific characteristics:
Monitoring Generic Python Jobs
As soon as the Job is activated, it is available as task in the Process Monitoring perspective. In the Task list you can see its status. Right-click it to open its monitor (see Monitoring Jobs); it contains three pages that provide the most important information on the Job parameters. The Windows Python page shows the read-only Python-specific settings as defined in the Job and the resolved values if variables were used in the definition.
When processing Jobs, Automic Automation generates output files and reports that guarantee traceability and auditability. Have a look at the following topics to learn more about this:
From the list of tasks in the Process Monitoring perspective, you can access all the functions that are available to Job tasks, see Working with Tasks.
Automic Automation provides multiple tools to troubleshoot in case of failures, see:
See also Troubleshooting, Root-Cause Analysis and Remediation.
Analyzing the Last Execution of a Job with Gen AI
As a developer and object designer, after configuring an executable object, you execute it to make sure that it behaves as you expect. Every time that you execute the object, a runID is generated that identifies that execution. If the execution fails or if the outcome is not what you expect, you use the reports and Executions lists to investigate the reasons for the failure. Automic Automation's Gen AI simplifies this process substantially. You can open the Automation AI Assistant as follows:
-
From the Explorer list in the Process Assembly perspective, right-click the object and select Monitoring > Analyze Last Execution.
-
On the object-specific definition page, click the Analyze Last Execution button.
Automic Automation's Gen AI crawls all the reports and logs available for the last execution of the object, it summarizes what happened, analyzes the automation outcome and provides suggestions to solve any existing or potential issues. It also provides a link to the execution itself in the list of Executions (Process Monitoring) and to the report. You can start a conversation in the Ask Automation AI Assistant field at the bottom of the pane.
For more information, see: