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

Sometimes developers need to test a flow under realistic conditions to ensure that all settings are correct that users have access to resources, permissions and quotas, to run the jobs that they intend to run.
  • 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.

For more basic flows in which each stage consists of similar types of jobs, test scripts may not be needed. However, for more complex flows with jobs that have different characteristics and dependencies, estimating the longest path, how often job requirements result in conflict and so on, are difficult to estimate without running tests that provide results to analyze.
% 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