Simulation Scripts
This section describes job simulation scripts that emulate jobs. Such scripts are often used by developers as well as business systems analysts.
Typically, these scripts perform no real functions and do not access licenses; they
emulate the appearance of actual usage. These scripts are often used to debug a
system or configuration issue, test the capacity of the system, checking if the
resources are available for upcoming jobs, and setting benchmarks for dispatching
jobs, such as 1000 calls of nc run /bin/date
.
Why Developers Use Simulation Job Scripts
- Developers may not have access to the tools; they need to create simulated jobs for realistic testing in an artificial environment.
- Developers may have access, but in an earlier stage of development, it may be preferable to create placeholder tools, thus avoiding the use and cost of licenses.
Using Job Script Simulations for Troubleshooting and Planning
Running tests with simulated jobs can help identify hardware bottlenecks or other system limitations. Using test scripts with proportional values help generate profiles very quickly, such as usage over time. Such scripts can be used with scaled memory/time requirements, such as 1 Megabyte of memory of a test script represents 1 Gigabyte represents 1 Megabtyte of actual usage, or 1 minute of a test script represents 1 hour of actual usage.
% sleep x
% cp aa bb
% vovmemtime
Guidelines for Simulation Job Scripts
- Frequently Used Code
-
array
cp file1file2
: Emulates I/O data transfer.Note: To successfully view a data transfer on a job profile, very large files must be used; transactions and other usages must continue at least one minute to be visible.sleep x
: Do nothing during the specified time x. For tests and evaluations, it is best to include a random number generator. Used alone, sleep jobs complete at known, precise times - based on the specified timing, several jobs could complete simultaneously, which does not occur in actual job runs. For information about job profiles, refer to Job Profiling.vovmetime
: Allocates memory, also uses CPU.vtool
: Used for calling licenses.vtool
can be used to emulate calling licenses. For information, refer to Wrap Unlicensed Tools in the Altair Monitor Administrator guide.
- Simple examples of scripts
-
Note: Using the sleep command alone may cause unrealistic behaviors, such as all jobs completing at the same time. Due to the scheduling of jobs and the availability of resources exact timing is unlikely. For more realistic behaviour, including a random variation of timing is recommended.
- bash version
-
% #!/bin/bash % dur=$[ ( $RANDOM % $1 / 5 ) + $1 ]s % echo "Sleeping for $dur" $% sleep $dur