Environment Control
Setting the environment is critical for correct job execution. Accelerator provides two methods to control the execution environment.
- Use a snapshot of the environment used at submission time. This method is the simplest and is automatically selected if the environment variable VOV_ENV is not defined. The disadvantage of this method is that the snapshot may not be portable across platforms.Note: This method is not available for Windows.
- Use a named environment, which allows the tasker
to create the environment on the fly using the VOV Environment Utilities.
This method offers several advantages: strict control on the environment, greater efficiency, less disk space utilization, easier execution across multiple platforms. This method is used if the environment variable VOV_ENV is defined; the value of the variable indicates the name of the environment to use.Note: This method is required for Windows.
Use Environment Snapshots
- The environment variable VOV_ENV is not set.
- The environment variable VOV_ENV is set to the value "" (the empty string) or the value DEFAULT.
- The environment variable VOV_ENV contains the substring SNAPSHOT.
Possible values of nc_snapshotdir | |
---|---|
homedir | Use directory ~/.ncsnapshots/$VOVARCH |
serverdir | Use directory PROJECTNAME.swd/snapshots/$USER/$VOVARCH |
any other value | Use the directory $LOGDIR/snapshots/$USER/$VOVARCH, where LOGDIR is controlled by the variable NC_LOGDIR and has default value ./vnc_logs |
The environment snapshot is a file in Bourne-Shell syntax, which contains most of the
variables in the current environment. The variables that are excluded from the
snapshot include the following: HOST OSREV OSTYPE TERMCAP SHELL
PWD
. These variables are defined in the file
$VOVDIR/tcl/vtcl/vovenvutils.tcl
An environment snapshot may be shared by many jobs.
- Ensure sure the environment variable VOV_ENV is not defined.
- Do not use the option -e.
% unsetenv VOV_ENV
% nc run sleep 10
Resources= linux
Env = SNAPSHOT(vnc_logs/snapshots/joe/linux/env4590.env)
Command = vw sleep 10
Logfile = vnc_logs/20020704/180936.7793
JobId = 00350601
vnc: message: Scheduled jobs: 1 Total estimated time: 0s
Named Environments
The Accelerator Environment Utilities consist of two commands: vel, lists the available environments; ves switches between environments. For more information, refer to Environment Management.
% vel
vel: message: Environment directories:
1 /release/VOV/latest/sun5/local/environments
1 . tcl BASE UNIX utilities, X windows, and VOV
1 . tcl D Define vars: Usage: ves "+D(VAR1=value1,...)"
1 . tcl DEFAULT Just a name for whatever you already have.
% ves BASE
Select a Named Environment
- When submitting a job, to select the environment in which to run the job, use the
option -e. Examples are shown below:
% nc run -e BASE sleep 10 ...output omitted... % nc run -e BASE+SPICE sleep 10 ...output omitted... % nc run -e "BASE+D(MYVAR=somevalue)" sleep 10 ...output omitted...
Use Snapshot with Named Environment
- A combination of an environment snapshot and a name environment can be set up. Try
the following example shows using the -e option to set up a
combined environment with a SNAPSHOT plus a name environment CALIBRE:
% nc run -e SNAPSHOT+CALIBRE sleep 10 ...output omitted... % nc run -e SNAPSHOT+MODULE1+CALIBRE sleep 10 ...output omitted...
Environment Processing
- $VOV_ENV_DIR
- $VOVDIR/local/environments
- $VOVDIR/etc/environments
in that order.
Start | Pre | Post |
---|---|---|
Script <envName>.start.<csh|sh|tcl> |
Script <envName>.pre.<csh|sh|tcl> |
Script <envName>.post.<csh|sh|tcl> |
Processed by: NC: vovtaskerroot > subtasker > vw |
Processed by: NC: vovtaskerroot > subtasker > vw |
Processed by: NC: vw > subtasker > vovtaskerroot Others: vw > subtasker > vovtasker |
|
|
|
|
|
|
- Non-root taskers (products other than NC) process each START environment once, the first time it is referenced by a job, then cache the resulting environment variables and their values. Subsequent requests to process the same START environment will result in the cache being used instead of the script being reprocessed. The vovtaskermgr refresh command can be used to purge the cache and cause the START environment to be reprocessed the next time it is encountered.
- The PRE and POST environment processing stages are undocumented, so PRE and POST environment scripts normally do not exist. They are processed if they exist though.
- Because the PRE and POST commands are executed twice, once with VOV_JOBID defined and once without, steps must be taken in the PRE and POST environment scripts to check for the existing of the variable before using it.
- The END stage, which is used to clean the environment from modifications made in the previous stages is not called in the course of job execution. It is used exclusively by the ves CLI command and the vovbuild command.
- Job PRE and POST commands are executed by the subtasker, so neither will have access to the VOV_JOBID variable.
- NC's container integration has no bearing on the behavior.