Using an IronPython Program for Integration with a Scheduler
This section describes how to create an IronPython program for integration with a scheduler. Each such program is used for a single, specific scheduler environment. If the program is installed with a valid name and in the correct location, then it will automatically be loaded and used by Ansys Electromagnetics tools.
Installation Details
The IronPython program must be installed in the schedulers subdirectory of the Ansys Electromagnetics installation directory. For example, if the installation directory is C:\Program Files\AnsysEM\v242\Win64\, then the IronPython program must be installed in directory C:\Program Files\AnsysEM\v242\Win64\schedulers.
The program file extension must be ".py". Select the program name so that it does not conflict with other IronPython programs in the same directory. If the Operating System or file system treat file names in a case sensitive manner, the file extension ".py" must be lower case.
Python Programming Notes
The scheduler program will be run in the IronPython environment both on Microsoft Windows and on Linux. There are some differences between IronPython and CPython. The version of IronPython in use for the current release will be listed in the first lines of the Tools > Open Command Window.
Implementation Details
The program must contain the following:
Import the ISchedulerPluginExtension
interface as follows:
from Ansys.Ansoft.SchedulerPluginDotNet import ISchedulerPluginExtension
Define a class that implements the ISchedulerPluginExtension
interface. In this document, this class is named SamplePluginExtension
,
but any class name may be used. The class member functions are described
in the next section. The class definition will look similar to the following:
class SamplePluginExtension(ISchedulerPluginExtension):
def GetName(self):
return "SamplePluginExtension"
def GetDescription(self):
return "Example python script plugin extension"
. . .
Include the following line in the program so that the
class that you have defined, SamplePluginExtension
, is loaded by the
infrastructure:
ExtensionRegistrar.RegisterPluginExtension(SamplePluginExtension())
The infrastructure will make the EntensionRegistrar
object
available in the environment where the program is loaded.
Each of the functions to be implemented in the SamplePluginExtension
class is described below.