Configuring Execution Options

You can set options for error reporting, reattempting execution, return codes, and the execution environment.

  1. Double-click the OS Command component icon .

    The OS Command Component Editor appears.

  2. From the OS Command Component Editor, click the Advanced tab.

  3. In the Consider execution failed if area, determine the conditions that will indicate that the program failed.

    If you do not select any of the options, the program will be considered to succeed no matter how it exits. However, if the program cannot be found, the component will always fail.

    Option Description
    Return code is other than If you want to define the return codes for successful completion of the execution, you can type multiple return codes separated by commas (e.g., “1,2,5” means consider return codes of 1, 2, or 5 as success) or a range of numbers separated by a colon (e.g., “0:9” means any return code from 0 to 9 inclusive indicates success). You can combine the codes to specify multiple ranges (e.g., “0:9, 21:30”). You can also use negative return codes (though few programs return them).
    There is output to the Standard Output stream Indicate that if the command produces any output to standard output, the run will be considered a failure and the simulation process flow will be aborted. This option is rarely used and is independent of whether standard output has been redirected or not. It is also independent of whether standard output is also logged.
    There is output to the Standard Error stream Indicate that if the command produces any output to the standard error stream, the run will be considered a failure and the rest of the simulation process flow will be aborted. By default, this option is selected and is typically set for Linux programs.
    Execution takes longer than Set a time limit (in seconds) after which execution is deemed to have failed. The default timeout is 300 seconds (5 minutes). A timeout of 0 means do not check run time. Alternatively, you can use the Timeout option on the Component Properties panel to control this option. For more information about component properties, see Configuring the Affinities.

  4. In the Log Output area, set the following options, as desired (these options are in addition to whether standard error is redirected to a file and whether output to standard error is considered a sign that the program failed):

    Option Description
    Log Standard Error If selected, any messages the program writes to standard error will also be logged to the job log. By default, this option is selected. This option is useful in determining why the program did not run as expected.
    Log Standard Output If selected, any messages to standard output are also sent to the job log. Selecting this option is not recommended because many programs can produce a lot of output, and log messages are relatively expensive.
    Log at most If selected, the amount of text that is logged can be limited. This prevents a program that writes a lot of messages to standard output or standard error from flooding the job log. Only the number of lines specified by this option are logged. If more lines are produced, only the first and last few lines are logged and all lines in the middle are discarded. The number of lines taken from the start and end of the file are each half of the value specified here, so the total number of lines logged is the given value.

    Note: Lines are logged as they are produced by the program. This option can be useful if the program writes a couple of lines and then executes for a long time. You can see the status messages in the job log before the program finishes.

  5. In the Retry Execution after Failure area, set the retry options.

    Typically, the retry options are for cases where a program may fail because of an external condition, such as a Web server being down, that can be expected to correct itself in a short time. These options are also used to retry execution if a program fails because all licenses are in use.

    Set the following retry options, as desired:

    Option Description
    Maximum number of retries Set a number of re-executions to attempt. Zero (0) retries indicates that you want to run the program only once. One (1) retry indicates to try one more time if the first attempt fails.

    The Maximum number of retries option on the Component Properties dialog box is in addition to the number of retries on the OS Command Editor.

    The OS Command component’s Maximum number of retries are tried first (on the same station, if you are connected to a SIMULIA Execution Engine), then the component properties’ retries are tried (possibly on a different station, if you are connected to a SIMULIA Execution Engine). For more information about component properties, see General Component Properties.

    Wait time for retry Set an amount of time between the re-execution attempts.
    Retry only if failed within Limit re-execution to runs when the previous execution failed within the specified amount of time. If the program ran longer than this number of seconds and then failed, no further retries are attempted.

  6. In the Wait for File area, use the following options to run a program that submits a job to an external system and then waits for that job to finish by looking for an output file the job writes:

    Option Description
    Wait for file after program finishes Have Isight wait for a file to appear after the program finishes. If selected, you must enter a file name in the File field. You can enter the path name or click Browse to locate the file. The file name can contain variable substitutions, such as “{var xx},” similar to file parameters. This file can be a file parameter, but it is not necessary. For more information about file parameters and substitutions, see About Variable Substitutions in the Isight User’s Guide.
    Find this string in the file (optional) Enter the string in the file for which the program should wait. If no string is specified, the command terminates when the file is created.
    Delay after file or string is found (seconds) Enter the number of seconds the program will wait if the file or string is found before continuing. This allows the process to finish writing the file.

  7. In the Execution environment area, set the following options to control some aspects of how the program runs:

    Option Description
    Run command/script as Windows job or Linux Process group (recommended) Specify special processing when the Simcode times out or the job is stopped. When this option is selected, the command is placed into a Windows Job object or a Linux process group. When the Simcode times out or is stopped, the whole Job or Process group is terminated. This is the default and recommended setting.

    If this option is not selected, the command is run as a child process of the Design Gateway or the SIMULIA Execution Engine station. If the Simcode times out or stops, Java tries to end the command; but any other processes the command created are NOT stopped. This can cause a problem when running the command using Windows Batch or when using one of the Linux shells, where all the actual programs are children of the shell, and continue to run after the OSCommand/Simcode component stops. Certain Windows programs will not run if they are inside a Windows job object. To run such a program, do not select this option.

    Note: When this option is selected, a helper program called makejob is run by the OSCommand. You will see this program if you examine the list of processes running on your computer.

    Environment Variables Click this option to enter environment variables. Click the button to enter the variable Name and Value. Click OK when you are finished adding variables. You can use the to remove an environment variable.
    Save program exit code in parameter Enter a parameter name in the text box if you want the exit code saved. If the parameter does not already exist, Isight creates it. This parameter type can be an integer, real, or string. The default is string. If this text box is left empty, which is the default for new models, the exit code is not saved.

    Note: Models created in earlier versions of Isight show “retval” as the parameter name. This ensures that existing models have the same previous behavior.

    Set X-Windows Display on Linux Select this option for Linux X-Windows programs that fail to run because an X-Windows display is not available. The specified display must be available at run time.

    If you select this option, enter a Host Name in the corresponding text box. The host name can be either a domain name or an IP address.

    File name substitutions are allowed, such as {localhost} to obtain the host name of the machine from which the job was submitted.

    Command uses no local system resources Select if the OS command does not use local system resources during execution. For example, the command may remotely execute a command on another compute node and wait for the command to complete, using minimal resources on the local system while waiting. If this option is selected, the local system will be free to perform other work while waiting for the remote command. This option is available only if the grid system on the Grid tab is set to None.

  8. Click OK to save your changes and to close the OS Command Component Editor.