Repurposed -OO for all sim run outputs including S_sie.resource being saved in the specified directory. (#1714)

* Repurposed -OO so all sim run outputs including S_sie.resource are saved to the specified folder. The files are placed in the sub-dir either RUN_xxx or DP_Product of the specified folder.

* Updated for repurposed -OO.

* Added quoting code markdown for such as in order to show <name> as is.

* Added quoting code for missing items.

* Updated to raise an error when the --read-only-sim flag is used without the -O or -OO. Also made updates to the related document accordingly.

* Fixed the error message to be more clear.
This commit is contained in:
Hong Chen
2024-07-16 10:31:52 -05:00
committed by GitHub
parent bc44a652b9
commit f666708374
5 changed files with 79 additions and 30 deletions

View File

@ -16,14 +16,27 @@ S_main_${TRICK_HOST_CPU}.exe [trick_version] [sie]
[-u <user_defined_arguments>]
```
- The first argument in the command line must be the simulation input file name. The input file name can be in the form of a full path name but MUST have a RUN_<name> directory immediately above the input file name. By default, all the simulation output is directed to this RUN_<name> directory. The standard <input_file_name> is input.py; however, a simulation could be started from a checkpoint file by substituting chkpnt_<time> in for <input_file_name> for non-Master/Slave and non-Import/Export simulations. For Master/Slave and Import/Export simulations you must have the simulation running, and the simulation must be in a freeze state before reloading a checkpoint.
- The trick_version option will tell what version of Trick built the S_main executable.
- The sie option will generate the smart input editor (SIE) resource file (CP will by default invoke the S_main executable with the sie option to generate this file).
- The '-d' argument is optional and, if specified, starts the simulation in an input file verification mode. In this mode the entire input file is read, echoed to standard out, and then the simulation exits without calling any jobs listed in the S_define file. This mode helps debug input file syntax errors.
- The '-O <output_file_path>' option allows the user to specify the directory to which simulation data log files will be written. If this option is omitted, the RUN_<name> directory is used.
- The '-OO <output_file_path>' option allows the user to specify the directory to which ALL simulation output files will be written. If this option is omitted, the RUN_<name> directory is used.
- The '--read-only-sim' flag can be used to redirect all files written at simulation runtime into the output directory.
- The '-u' option specifies that all remaining arguments are meant to be used by user supplied jobs. All arguments after the -u can be accessed internal to the simulation jobs by calling the get_cmnd_args() function of the executive as illustrated below. In a master/slave simulation, the master's -u args will be passed to the slave.
- The first argument in the command line must be the simulation input file name. The input file name can be in the form of a full path name but MUST have a `RUN_<name>` directory immediately above the input file name. By default, all the simulation output is directed to this `RUN_<name>` directory. The standard `<input_file_name>` is input.py; however, a simulation could be started from a checkpoint file by substituting `chkpnt_<time>` in for `<input_file_name>` for non-Master/Slave and non-Import/Export simulations. For Master/Slave and Import/Export simulations you must have the simulation running, and the simulation must be in a freeze state before reloading a checkpoint.
- The `trick_version` option will tell what version of Trick built the S_main executable.
- The `sie` option will generate the smart input editor (SIE) resource file.
- The `-d` argument is optional and, if specified, starts the simulation in an input file verification mode. In this mode the entire input file is read, echoed to standard out, and then the simulation exits without calling any jobs listed in the S_define file. This mode helps debug input file syntax errors.
- The `-O <output_file_path>` option allows the user to specify the directory to which simulation data log files will be written. If this option is omitted, the `RUN_<name>` directory is used.
- Data Products specification DP_xxx.xml files if generated such as for frame logging are saved in `DP_Product` directory.
- The `-OO <output_file_path>` option allows the user to specify the directory to which ALL simulation output files will be written. If this option is omitted, the `RUN_<name>` directory is used.
- Two subdirectories are automatically created in the designated `<output_file_path>`:
- `DP_Product`
- Data Products sepcification DP_xxx.xml files are saved in this folder.
- `RUN_<name>`
- All simulation output files, excluding DP_xxx.xml files, are saved in this folder. Additionally, the S_sie.resource file is copied to this directory.
- The `--read-only-sim` flag can be used to redirect all files written at simulation runtime into the output directory.
- The `--read-only-sim` flag requires either the `-O` or `-OO` option to be used.
- When the `-O <output_file_path>` option is used and `trick.trick.sie_append_runtime_objs()` is called from the input file, the S_sie.resource file with appended runtime objects is saved in `<output_file_path>`.
- When the `-OO <output_file_path>` option is used and `trick.trick.sie_append_runtime_objs()` is called from the input file, the S_sie.resource file with runtime objects appended is saved in `<output_file_path>/RUN_<name>`.
- If `trick.trick.sie_append_runtime_objs()` is called from the input file, the S_sie.resource file is to be appended with runtime objects.
- When neither the `-O` nor `-OO` option is used, the S_sie.resource file with runtime objects appended is saved in the current directory from which the simulation is executed.
- When the `-O <output_file_path>` option is used without the `--read-only-sim` flag, the S_sie.resource file with runtime objects appended is saved in the current directory from which the simulation is executed.
- When the `-OO <output_file_path>` option is used without the `--read-only-sim` flag, the S_sie.resource file with runtime objects appended is saved in `<output_file_path>/RUN_<name>`.
- The `-u` option specifies that all remaining arguments are meant to be used by user supplied jobs. All arguments after the -u can be accessed internal to the simulation jobs by calling the get_cmnd_args() function of the executive as illustrated below. In a master/slave simulation, the master's `-u` args will be passed to the slave.
The following code example shows how a function can access the command line arguments during execution.