Deadline Scripting Reference
10.1.23.6
|
A base class for managing a process. More...
Inherited by Deadline.Plugins.DeadlinePlugin.
Classes | |
class | RegexHandlerCallback |
A regular expression callback class to handle lines of stdout. More... | |
Public Types | |
enum class | AbortLevel { Minor , Major , Fatal , Success } |
The different levels when aborting a render. More... | |
Public Member Functions | |
void | AbortRender (string message) |
Aborts the render with a Major abort level. More... | |
void | AbortRender (string message, AbortLevel level) |
Aborts the render with the given abort level. More... | |
void | AddExitCodeToIgnore (int exitCode) |
Adds an exit code that should be ignored. More... | |
void | AddPopupHandler (string regexTitle, string buttons) |
Adds a popup handler to press one or more buttons when a matching popup is detected. More... | |
void | AddPopupHandler (string regexTitle, string regexContent, string buttons) |
Adds a popup handler to press one or more buttons when a matching popup is detected. More... | |
void | AddPopupIgnorer (string regexTitle) |
Adds a popup ignorer. If a matching popup is detected, it is ignored. This should not be used on popups that block the rendering process (AddPopupHandler should be used in this case). More... | |
void | AddPopupIgnorer (string regexTitle, string regexContent) |
Adds a popup ignorer. If a matching popup is detected, it is ignored. This should not be used on popups that block the rendering process (AddPopupHandler should be used in this case). More... | |
RegexHandlerCallback | AddStdoutHandlerCallback (string regexString) |
Adds a stdout handler that can be used to handle a matching line of stdout. A RegexHandlerCallback object is returned, and a callback can be assigned to this object's HandleCallback property to handle a matching line of stdout. More... | |
RegexHandlerCallback | AddStdoutHandlerEvent (string regexString) |
DEPRECATED: Use AddStdoutHandlerCallback. More... | |
void | ClearEnvironmentVariables () |
Clears the extra environment variables for the rendering process. More... | |
bool | EnvironmentVariableExists (string key) |
Checks if the environment with the given key exists. More... | |
string | GetEnvironmentVariable (string key) |
Gets the extra environment variable for the rendering process with the given key. If the variable is not defined, an empty string is returned. More... | |
string | GetPreviousStdoutLine () |
Gets the previous line of stdout. This should be called from a callback for a stdout handler to get the line before the current one. More... | |
string | GetRegexMatch (int index) |
Gets the matched text at the given index for the current regular expression. This should be called from a callback for a stdout handler to get a match from the current line being handled. More... | |
ManagedProcess () | |
Constructor. More... | |
void | RedirectStdoutToFile (string filename) |
Redirect stdout for this render to the specified file. This should be called from the callback to initialize the process to ensure that all stdout goes to the file. More... | |
void | ResetProcessAffinity () |
Resets the affinity settings for the process. More... | |
void | SetEnvironmentVariable (string key, string value) |
Sets extra environment variables for the rendering process only. This will take precedence over a variable in the current environment with the same name. More... | |
void | SetUpdateTimeout (int timeout) |
Sets the update timeout. A timeout error will occur if the process goes the specified number of seconds without any stdout being printed out. More... | |
void | SuppressThisLine () |
Suppresses the next line of stdout. This should be called from a callback for a stdout handler to suppress the current line being handled. More... | |
Static Public Member Functions | |
static bool | DetectLoop (MethodBase info) |
Properties | |
bool | AsynchronousStdout [get, set] |
Gets or sets if stdout redirection is asynchronous. This is ignored if StdoutRedirection is disabled. This is also ignored on Windows. More... | |
bool | CreateNewConsole [get, set] |
Gets or sets if a new console should be created. More... | |
bool | DebugLogging [get, set] |
Gets or sets if debug logging is enabled. More... | |
string | Domain [get, set] |
The domain when running the process as a different user. This is ignored on Linux and Mac OSX. More... | |
bool | FatalPythonErrors [get, set] |
Gets or sets if python errors should be treated as fatal errors. More... | |
bool | HandleQtPopups [get, set] |
Gets or sets whether or not the process should handle Qt popups More... | |
bool | HandleWindows10Popups [get, set] |
Gets or sets whether or not the process should handle Windows10 popups More... | |
bool | HideDosWindow [get, set] |
Gets or sets of the Dos window should be hidden. More... | |
bool | ImmediateTermination [get, set] |
Gets or sets if the process should terminate immediately instead of being allowed to shutdown gracefully. More... | |
int | MaxHandledLineSize [get, set] |
Gets or sets the maximum line size that will be handled by the stdout handlers. Set to 0 to disable stdout handling. More... | |
string | Password [get, set] |
The password when running the process as a different user. This is ignored on Linux and Mac OSX. More... | |
string[] | PopupButtonClasses [get, set] |
Gets or sets the list of class names that the popup handlers considers to be buttons. More... | |
bool | PopupHandling [get, set] |
Gets or sets if popup handling is enabled. More... | |
int | PopupMaxChildWindows [get, set] |
Gets or sets the maximum number of controls that can be in a popup window. If a popup has more then this, it will not be considered a popup and will be ignored. More... | |
string[] | PopupTextClasses [get, set] |
Gets or sets the list of class names that the popup handlers considers to be text fields. More... | |
bool | PreserveEnvironment [get, set] |
If true, the environment will be preserved when running the process as another user using 'su' or 'sudo'. This is ignored on Windows. More... | |
bool | PressEnterDuringRender [get, set] |
Gets or sets if the Enter button should be pressed shortly after starting the process. This can be useful if the process requires a key press to exit after it finishes running. More... | |
int[] | ProcessAffinity [get, set] |
Gets or sets the affinity for the process (Windows and Linux only). If set to an empty list, the default affinity will be used. More... | |
ProcessPriorityClass | ProcessPriority [get, set] |
Gets or sets the process priority class. This should typically be set to ProcessPriorityClass.BelowNormal so that the machine is still interactive during a heavy render. More... | |
bool | RunAsUser [get, set] |
If true, the process will run as the user specified in UserName. More... | |
bool | RunAsUserWithSu [get, set] |
If true, 'su' will be used to run the process as another user instead of 'sudo'. This is ignored on Windows. More... | |
bool | SetHomeVariable [get, set] |
If true, the HOME environment variable will be set to the users home directory when running sudo. Not compatible with su. This is ignored on Windows. More... | |
bool | SimulateLogin [get, set] |
If true, 'su' will simulate a login by the user we are running as. More... | |
string | StdOutEncoding [get, set] |
Used to specify the name of the Character Encoding that will be used to decode StdOut and StdErr. More... | |
bool | StdoutHandling [get, set] |
Gets or sets if stdout handling is enabled. This is ignored if StdoutRedirection is disabled. More... | |
bool | StdoutRedirection [get, set] |
Gets or sets if stdout redirection is enabled. More... | |
bool | TerminateOnExit [get, set] |
Gets or sets of the process should be terminated on exit. More... | |
bool | UseExtraEnvironmentVariablesOnly [get, set] |
If True, only the rendering process' extra environment variables will be used. If False (the default behavior), the extra environment variables will be merged with the current environment. More... | |
bool | UseProcessTree [get, set] |
If True, further sub-processes started by this ManagedProcess will be tracked and terminated along with it. On Windows, this utilizes Job Objects. Defaults to True. More... | |
string | UserName [get, set] |
The user to run as. Only works if RunAsUser is enabled. More... | |
Events | |
GenericDelegate1< int > | CheckExitCodeCallback |
If a function is assigned to this callback, it will be called after the executable has finished running, and can be used to check the exit code. If no function is assigned, the default behavior will be to fail if the executable returns a non-zero exit code. More... | |
GenericDelegate0 | InitializeProcessCallback |
If a function is assigned to this callback, it will be called to initialize the process. More... | |
GenericDelegate3< string[], string, string, string > | ModifyCommandLineCallback |
If a function is assigned to this callback, it will be called immediately before the executable is run, and can be used to modify the executable command. The function must return a tuple of three strings denoting the executable path, the command arguments, and the startup directory. More... | |
GenericDelegate0 | PostRenderTasksCallback |
If a function is assigned to this callback, it will be called after the executable has finished running. More... | |
GenericDelegate0 | PreRenderTasksCallback |
If a function is assigned to this callback, it will be called prior to running the executable. More... | |
GenericDelegate0< string > | RenderArgumentCallback |
If a function is assigned to this callback, it will be called to return the arguments to be passed to the executable. More... | |
GenericDelegate0 | RenderCanceledCallback |
If a function is assigned to this callback, it will be called when the render is canceled. It can be used to perform some cleanup operations. More... | |
GenericDelegate0< string > | RenderExecutableCallback |
A function must be assigned to this callback. It should return the executable to be run. If the executable isn't rooted, the current directory will be checked first, followed by all directories in the PATH environment variable. More... | |
GenericDelegate0< string > | StartupDirectoryCallback |
If a function is assigned to this callback, it will be called to return the directory that the exectuable should run. More... | |
GenericDelegate0 | TimeoutTasksCallback |
If a function is assigned to this callback, it will be called if update timeouts are enabled, and that timeout has passed. More... | |
A base class for managing a process.
|
strong |
The different levels when aborting a render.
FranticX.Processes.ManagedProcess.ManagedProcess | ( | ) |
Constructor.
void FranticX.Processes.ManagedProcess.AbortRender | ( | string | message | ) |
Aborts the render with a Major abort level.
message | The message explaining why the render was aborted. |
void FranticX.Processes.ManagedProcess.AbortRender | ( | string | message, |
AbortLevel | level | ||
) |
Aborts the render with the given abort level.
message | The message explaining why the render was aborted. |
level | The abort level. |
void FranticX.Processes.ManagedProcess.AddExitCodeToIgnore | ( | int | exitCode | ) |
Adds an exit code that should be ignored.
exitCode | The exit code. |
void FranticX.Processes.ManagedProcess.AddPopupHandler | ( | string | regexTitle, |
string | buttons | ||
) |
Adds a popup handler to press one or more buttons when a matching popup is detected.
regexTitle | The regular expression used to match the title of the popup. |
buttons | The button to press. To press more than one button, use semicolons to separate the buttons. |
void FranticX.Processes.ManagedProcess.AddPopupHandler | ( | string | regexTitle, |
string | regexContent, | ||
string | buttons | ||
) |
Adds a popup handler to press one or more buttons when a matching popup is detected.
regexTitle | The regular expression used to match the title of the popup. |
regexContent | The regular expression used to match the window content of the popup. |
buttons | The button to press. To press more than one button, use semicolons to separate the buttons. |
void FranticX.Processes.ManagedProcess.AddPopupIgnorer | ( | string | regexTitle | ) |
Adds a popup ignorer. If a matching popup is detected, it is ignored. This should not be used on popups that block the rendering process (AddPopupHandler should be used in this case).
regexTitle | The regular expression used to match the title of the popup. |
void FranticX.Processes.ManagedProcess.AddPopupIgnorer | ( | string | regexTitle, |
string | regexContent | ||
) |
Adds a popup ignorer. If a matching popup is detected, it is ignored. This should not be used on popups that block the rendering process (AddPopupHandler should be used in this case).
regexTitle | The regular expression used to match the title of the popup. |
regexContent | The regular expression used to match the window content of the popup. |
RegexHandlerCallback FranticX.Processes.ManagedProcess.AddStdoutHandlerCallback | ( | string | regexString | ) |
Adds a stdout handler that can be used to handle a matching line of stdout. A RegexHandlerCallback object is returned, and a callback can be assigned to this object's HandleCallback property to handle a matching line of stdout.
regexString | The regular expression used to match a line of stdout. |
RegexHandlerCallback FranticX.Processes.ManagedProcess.AddStdoutHandlerEvent | ( | string | regexString | ) |
DEPRECATED: Use AddStdoutHandlerCallback.
regexString |
void FranticX.Processes.ManagedProcess.ClearEnvironmentVariables | ( | ) |
Clears the extra environment variables for the rendering process.
|
static |
info |
bool FranticX.Processes.ManagedProcess.EnvironmentVariableExists | ( | string | key | ) |
Checks if the environment with the given key exists.
key | The name of the environment variable. |
string FranticX.Processes.ManagedProcess.GetEnvironmentVariable | ( | string | key | ) |
Gets the extra environment variable for the rendering process with the given key. If the variable is not defined, an empty string is returned.
key | The name of the environment variable. |
string FranticX.Processes.ManagedProcess.GetPreviousStdoutLine | ( | ) |
Gets the previous line of stdout. This should be called from a callback for a stdout handler to get the line before the current one.
string FranticX.Processes.ManagedProcess.GetRegexMatch | ( | int | index | ) |
Gets the matched text at the given index for the current regular expression. This should be called from a callback for a stdout handler to get a match from the current line being handled.
index | The index. An error will be thrown if the index falls outside the range for the current regular expression. |
void FranticX.Processes.ManagedProcess.RedirectStdoutToFile | ( | string | filename | ) |
Redirect stdout for this render to the specified file. This should be called from the callback to initialize the process to ensure that all stdout goes to the file.
filename | The name of the file. If the file already exists, it will be overwritten. |
void FranticX.Processes.ManagedProcess.ResetProcessAffinity | ( | ) |
Resets the affinity settings for the process.
void FranticX.Processes.ManagedProcess.SetEnvironmentVariable | ( | string | key, |
string | value | ||
) |
Sets extra environment variables for the rendering process only. This will take precedence over a variable in the current environment with the same name.
key | The name of the environment variable. |
value | The value. |
void FranticX.Processes.ManagedProcess.SetUpdateTimeout | ( | int | timeout | ) |
Sets the update timeout. A timeout error will occur if the process goes the specified number of seconds without any stdout being printed out.
timeout | The timeout, in seconds. If less than 0, timeout is disabled (which is the default behavior). |
void FranticX.Processes.ManagedProcess.SuppressThisLine | ( | ) |
Suppresses the next line of stdout. This should be called from a callback for a stdout handler to suppress the current line being handled.
|
getset |
Gets or sets if stdout redirection is asynchronous. This is ignored if StdoutRedirection is disabled. This is also ignored on Windows.
|
getset |
Gets or sets if a new console should be created.
|
getset |
Gets or sets if debug logging is enabled.
|
getset |
The domain when running the process as a different user. This is ignored on Linux and Mac OSX.
|
getset |
Gets or sets if python errors should be treated as fatal errors.
|
getset |
Gets or sets whether or not the process should handle Qt popups
|
getset |
Gets or sets whether or not the process should handle Windows10 popups
|
getset |
Gets or sets of the Dos window should be hidden.
|
getset |
Gets or sets if the process should terminate immediately instead of being allowed to shutdown gracefully.
|
getset |
Gets or sets the maximum line size that will be handled by the stdout handlers. Set to 0 to disable stdout handling.
|
getset |
The password when running the process as a different user. This is ignored on Linux and Mac OSX.
|
getset |
Gets or sets the list of class names that the popup handlers considers to be buttons.
|
getset |
Gets or sets if popup handling is enabled.
|
getset |
Gets or sets the maximum number of controls that can be in a popup window. If a popup has more then this, it will not be considered a popup and will be ignored.
|
getset |
Gets or sets the list of class names that the popup handlers considers to be text fields.
|
getset |
If true, the environment will be preserved when running the process as another user using 'su' or 'sudo'. This is ignored on Windows.
|
getset |
Gets or sets if the Enter button should be pressed shortly after starting the process. This can be useful if the process requires a key press to exit after it finishes running.
|
getset |
Gets or sets the affinity for the process (Windows and Linux only). If set to an empty list, the default affinity will be used.
|
getset |
Gets or sets the process priority class. This should typically be set to ProcessPriorityClass.BelowNormal so that the machine is still interactive during a heavy render.
|
getset |
If true, the process will run as the user specified in UserName.
|
getset |
If true, 'su' will be used to run the process as another user instead of 'sudo'. This is ignored on Windows.
|
getset |
If true, the HOME environment variable will be set to the users home directory when running sudo. Not compatible with su. This is ignored on Windows.
|
getset |
If true, 'su' will simulate a login by the user we are running as.
Only applicable on Unix-based systems, and only if RunAsUser and RunAsUserWithSu are true.
|
getset |
Used to specify the name of the Character Encoding that will be used to decode StdOut and StdErr.
If left null/empty, or an invalid/un-supported value is provided, the system default will be used instead.
Refer to the table at https://msdn.microsoft.com/en-us/library/system.text.encoding.aspx for available values.
|
getset |
Gets or sets if stdout handling is enabled. This is ignored if StdoutRedirection is disabled.
|
getset |
Gets or sets if stdout redirection is enabled.
|
getset |
Gets or sets of the process should be terminated on exit.
|
getset |
If True, only the rendering process' extra environment variables will be used. If False (the default behavior), the extra environment variables will be merged with the current environment.
|
getset |
If True, further sub-processes started by this ManagedProcess will be tracked and terminated along with it. On Windows, this utilizes Job Objects. Defaults to True.
|
getset |
The user to run as. Only works if RunAsUser is enabled.
GenericDelegate1<int> FranticX.Processes.ManagedProcess.CheckExitCodeCallback |
If a function is assigned to this callback, it will be called after the executable has finished running, and can be used to check the exit code. If no function is assigned, the default behavior will be to fail if the executable returns a non-zero exit code.
GenericDelegate0 FranticX.Processes.ManagedProcess.InitializeProcessCallback |
If a function is assigned to this callback, it will be called to initialize the process.
GenericDelegate3<string[], string, string, string> FranticX.Processes.ManagedProcess.ModifyCommandLineCallback |
If a function is assigned to this callback, it will be called immediately before the executable is run, and can be used to modify the executable command. The function must return a tuple of three strings denoting the executable path, the command arguments, and the startup directory.
GenericDelegate0 FranticX.Processes.ManagedProcess.PostRenderTasksCallback |
If a function is assigned to this callback, it will be called after the executable has finished running.
GenericDelegate0 FranticX.Processes.ManagedProcess.PreRenderTasksCallback |
If a function is assigned to this callback, it will be called prior to running the executable.
GenericDelegate0<string> FranticX.Processes.ManagedProcess.RenderArgumentCallback |
If a function is assigned to this callback, it will be called to return the arguments to be passed to the executable.
GenericDelegate0 FranticX.Processes.ManagedProcess.RenderCanceledCallback |
If a function is assigned to this callback, it will be called when the render is canceled. It can be used to perform some cleanup operations.
GenericDelegate0<string> FranticX.Processes.ManagedProcess.RenderExecutableCallback |
A function must be assigned to this callback. It should return the executable to be run. If the executable isn't rooted, the current directory will be checked first, followed by all directories in the PATH environment variable.
GenericDelegate0<string> FranticX.Processes.ManagedProcess.StartupDirectoryCallback |
If a function is assigned to this callback, it will be called to return the directory that the exectuable should run.
GenericDelegate0 FranticX.Processes.ManagedProcess.TimeoutTasksCallback |
If a function is assigned to this callback, it will be called if update timeouts are enabled, and that timeout has passed.