Rush Logo Rush Render Queue - Environment Variables
V 103.07b 05/11/16
(C) Copyright 2008, 2016 Seriss Corporation. All rights reserved.
(C) Copyright 1995,2000 Greg Ercolano. All rights reserved.


   Environment Variables  

These environment variables are used by the rush system. Some variables affect the behavior of the rush client program, and some are set by the rush daemon to pass information to the user's Render Script. Some fall into both categories.

Render Scripts should at very least make use of $RUSH_FRAME or $RUSH_PADFRAME to determine the current frame being rendered.

    General Rush Environment Variables
      These variables affect behavior of rush(1) and related programs.  
    RUSH_DIR Rush install directory. eg. "/usr/local/rush", etc.
    RUSH_FU If set to 1, one can modify other people's jobs.
    RUSH_JOBID The 'default' jobid for all rush(1) commands.

    Rush 'Frame' Environment Variables
      These variables are passed from rush(1) to render scripts
    RUSH_FRAME The current frame number, eg. '37'.
    RUSH_PADFRAME The current padded frame number, eg. '0037'.
    RUSH_FIRST_FRAME The first frame in the job, eg. '1'. (Rush 102.42 and up)
    RUSH_LAST_FRAME The last frame in the job, eg. '100'. (Rush 102.42 and up)

    Rush -fmt Environment Variables
      These variables affect rush report's default output format.  
    RUSH_LF_FMT Optional report format string for the 'rush -lf -fmt env' report.
    Can be set to the string normally passed as an argument to
    '-fmt' (eg. 'rush -lf -fmt <STRING>').
    RUSH_LJ_FMT Optional report format string for the 'rush -lj -fmt env' report.
    Can be set to the string normally passed as an argument to
    '-fmt' (eg. 'rush -lj -fmt <STRING>').
    RUSH_LAJ_FMT Optional report format string for the 'rush -laj -fmt env' report.
    Can be set to the string normally passed as an argument to
    '-fmt' (eg. 'rush -laj -fmt <STRING>').
    RUSH_LAJF_FMT Optional report format string for the 'rush -lajf -fmt env' report.
    Can be set to the string normally passed as an argument to
    '-fmt' (eg. 'rush -laj -fmt <STRING>').

    All Render Script Environment Variables
      These variables are passed to the render script for each running frame during rendering.  
    RUSH_DIR Rush install directory. eg. "/usr/local/rush", etc.
    RUSH_FIRST_FRAME The first frame in the job, eg. '1'. (Rush 102.42 and up)
    RUSH_FRAME
    The current frame number, eg. '37'.
    RUSH_HOSTNAME The hostname we're rendering on, eg. "tahoe"
    RUSH_ISDAEMON Use this variable to detect network worm avoidance.
    RUSH_JOBID The jobid for the rendering frame, eg. "tahoe.37"
    RUSH_LAST_FRAME The last frame in the job, eg. '100'. (Rush 102.42 and up)
    RUSH_LOGFILE The logfile for the script's own output, eg. "/net/rush/logs"
    RUSH_PADFRAME The padded frame number being rendered, eg. '0037'.
    RUSH_RAM The job's current Ram value
    RUSH_TMPDIR The tmp directory rush automatically creates and removes.
    RUSH_TRY The number of times this frame has tried to render, eg. "3".




   RUSH_DIR  

    RUSH_DIR is an environment variable used by rush(1), and many of the various rush programs to determine where rush is installed. It is also passed to the render script (during rendering).

    This variable is the directory name of the rush directory. Normally, this is /usr/local/rush. Appending '/bin' gives a path to the rush(1) and rushd(8) binaries.

    This variable should be in the user's environment so all rush(1) commands can access it, and as well, should also be set in the boot scripts before rushd(8) is started. Both rush(1) and rushd(8) depend on this variable being set.

   RUSH_FRAME  

    RUSH_FRAME is an environment variable passed to the render script (during rendering).

    It contains the frame number to be rendered, i.e., "1", "12", "104", "12.25". No padding of zeroes are used. To get padded frame numbers, use RUSH_PADFRAME.

    Jobs submitted with a floating point frame range will cause RUSH_FRAME to return floating point values, such as "1.00", "1.05", "1.10", etc. Right padding (1.10) indicates the precision of the frame range.

   RUSH_FIRST_FRAME  

    (New in rush 102.42 and up)

    RUSH_FIRST_FRAME is an environment variable passed to the render script (during rendering).

    It contains the frame number of the first frame in the job. For instance, if a job has a frame range of 50-200, RUSH_FIRST_FRAME will be '50'. No padded zeroes are used.

    The render script can use this value to determine if it's rendering the first frame in the job, eg:

        if ( $RUSH_FRAME == $RUSH_FIRST_FRAME ) then
            # working on first frame..
        endif
        

   RUSH_LAST_FRAME  

    (New in rush 102.42 and up)

    RUSH_LAST_FRAME is an environment variable passed to the render script (during rendering).

    It contains the frame number of the last frame in the job. For instance, if a job has a frame range of 50-200, RUSH_LAST_FRAME will be '200'. No padded zeroes are used.

    The render script can use this value to determine if it's rendering the last frame in the job, eg:

        if ( $RUSH_FRAME == $RUSH_LAST_FRAME ) then   
            # working on last frame..
        endif
        

   RUSH_FU  

    RUSH_FU is an environment variable used by the rush(1) command.

    If set to '1', implies the '-fu' flag for all commands. Not recommended for use in user's environment. This variable is meant only to be used by GUI interfaces that are layered on top of the rush command line tool.

   RUSH_HOSTNAME  

    RUSH_HOSTNAME is an environment variable passed to the render script (during rendering).

    It contains the hostname the render script is currently running on. This is the name that appears in 'rush -lah' reports, and in the 'HOSTNAME' column of 'rush -lf' reports.

   RUSH_ISDAEMON  

    RUSH_ISDAEMON is an environment variable passed to the render script (during rendering).

    This variable is set by the rushd daemon to contain the process ID of the daemon.

    Submit scripts in particular should check if this variable is set to detect if the job is being submitted from within a job, to avoid network worm scenarios eg. where a job attempts to recursively submit itself.

    Unless you intentionally want a job to submit other jobs, the submit section of a script should check if this variable is set, and if so, exit immediately, e.g.

      Preventing Network Worms
      #!/bin/csh -f
      if ( $1 == "-render" ) then
           # RENDER 
           render //some/path/foo.${RUSH_PADFRAME}.rib
           exit 0
      else
           # SUBMIT JOB
           
           # Check if we're being submitted by another job..
           if ( $?RUSH_ISDAEMON ) then
               cat << EOF
      
          ****************** WARNING! *********************
      
          Detected an attempt for a job to submit jobs, which unless done properly
          can cause a recursive 'network worm'. As a preventative measure, this script
          is DUMPING THE PARENT JOB AND KILLING ITSELF to prevent spreading a network worm.
      
          ****************** WARNING! *********************
      EOF
              # DUMP PARENT JOB, COMMIT SUICIDE
              rush -dump ; kill -9 $$
              exit 1        # unlikely to get here after above..
          endif
          
          # Do regular submit here..
          rush -submit << EOF
              frames 1-10
              command $0 -render
              cpus +any=10
              logdir  //server/jobs/logs/ribrender-%s
      EOF
          if ( $status == 0 ) exit 0
          echo 'ERROR: Job failed to submit'
          exit 1
      endif
      

   RUSH_JOBID  

    RUSH_JOBID is an environment variable interpreted by the rush(1) command, and is also passed to the render script (during rendering).

    It contains the jobid of the current running job. i.e., "tahoe.37"

    When this variable is set, the rush(1) command line tool will use this jobid if no jobid is specified.

    Example: 'rush -lf' will use RUSH_JOBID to determine which job's framelist to display, whereas specifying a jobid with eg. 'rush -lf tahoe.37' overrides the RUSH_JOBID setting.

    Since RUSH_JOBID is passed to the render script, rush(1) commands can be added to the render script without specifying the jobid, as it will be set already. eg. to reset the try count of the current frame from within the render script, only 'rush -try 0' is needed; there is no need to specify 'rush -try 0 $RUSH_JOBID'.

   RUSH_LOGFILE  

    RUSH_LOGFILE is an environment variable passed to the render script (during rendering).

    It contains the absolute path to the output log for the currently running render script. The contents of this file grows as the render script generates output.

    The pathname in this variable always ends with the frame number being rendered [eg. 0001, 0002, 0003], so it will be a pathname specific to the current frame being rendered.

    This variable is dependent on the job's current LogDir value, which can be changed dynamically with the rush -logdir command line option.

    For example, the render script can use this variable to search the renderer's output for error messages, and act conditionally based on the error detected. See Detecting Render Problems with Grep for examples of this technique.

   RUSH_PADFRAME  

    RUSH_PADFRAME is an environment variable passed to the render script (during rendering).

    It contains the frame number to be rendered, and includes 4 padding zeroes,
    I.e., "0001", "0012", "0104".

    The output format of this variable is controlled by the rush.conf file's FramePad setting.

    Jobs submitted with a floating point frame range will cause padded floating point values to be returned, eg. "0012.10".

    For un-padded frame numbers, use RUSH_FRAME.

   RUSH_RAM  

    RUSH_RAM is an environment variable passed to the render script (during rendering).

    It contains the job's current Ram value, which can be changed dynamically with the rush -ram command line option.

   RUSH_TMPDIR  
    RUSH_TMPDIR is an environment variable passed to the render script (during rendering).

    It contains the path to a temp directory that is automatically created before the frame starts rendering, and is completely removed after the frame completes execution, deleting all files left behind.

    This variable is dependent on the current TmpDir setting in the rush.conf file.

    Use this variable when creating temporary files in your render script, so that the files are automatically removed even if your renders are bumped or dumped while in progress, e.g.,

      Using RUSH_TMPDIR
      
          ### YOUR RENDER COMMANDS HERE
          render -output $RUSH_TMPDIR/foo.rgb
          post_filter -in=$RUSH_TMPDIR/foo.rgb \
                      -out=/job/SHOW/img/$RUSH_PADFRAME.rgb             
              

   RUSH_TRY  

    RUSH_TRY is an environment variable passed to the render script (during rendering).

    It contains a value indicating the number of times this frame has attempted to render the frame (changed from Run -> Que). This is the number in the 'TRY' column of a 'rush -lf' report.

    Can be changed with rush -try.