Basic Information / JobScripts¶
Every job has some information related to the kind of job (rendering engine or tool) you had selected but also other information that is common to all kind of jobs.
One of those entries is what in the "new job dialog" will appear as the field "Command:".
That field will be automatically filled if you use one of the script generators, but can also be manually set to any script of your own.
The script generators usually create tcsh scripts, but there's no need for that command value to point to a tcsh script. It's just that the script generators create those kinds scripts and so you have probably see them there most of the time, but doesn't have to be that way.
The "Command" entry value can be set to any script, path to script, binary on your path or even a series of "shell" commands separated by semicolons. The slaves will try to execute whatever is there for every task they get assigned to.
Before running each job task (executing that command value) on any node, the slave will set all environment variables to the appropriate values for that single task. Therefore, the job script will be able to obtain all related information directly from it's environment, such as frame number, frame padding, start, end, job id, etc.
(Note: in the event that information is needed that the slave has not provided via the environment, using the job id value you could request that or any other information that is needed by using the command line tools to query the master or, better yet, the python module)
For example, valid "Command" values are:
- "sleep 10" and every task will sleep for ten seconds and finish.
- "echo Hi there, I should be rendering $DRQUEUE_FRAME but I am not in the mood" that will print the message with different $DRQUEUE_FRAME values for different frames.
- "/company/setup/drqueue/scripts/our_own_maya_script" will run that script.
- "mantra < /shared/myscenes/scene.$DRQUEUE_FRAME.ifd"
Writing a jobscript is quite easy. Just enter the sequence of commands you'd like to run. Any command or tool available on the slave can be run.
So you could even query your own databases, compile, copy/move/delete/create any file, even copy from remote locations, download with wget, unzip, untar... whatever.
For example, let's suppose you don't like the idea of transferring scene files all the time from your shared location. So to speed up loading scenes and so you could, at the beginning of the jobscript, check if you have the files already copied to your chosen local path and if not copy them there and then render. Something like:
# local directory to copy remote projects LOCAL_PATH_BASE=/drqueue/local # if the last part of the project path is the project name... # and also supposing we set a custom environment variable pointing to the project path LOCAL_PROJECT_PATH=$LOCAL_BASE/$(basename "$DRQUEUE_PROJECT_PATH") if [ ! -d "$LOCAL_PROJECT_PATH" ]; then # if the directory is not there, we copy everything cp -r "$DRQUEUE_PROJECT_PATH" "$LOCAL_PATH_BASE" # at this point we should check the success of the copy operation fi # Once we know the project is copied locally we could run the render with the new path /usr/bin/renderer --scene $DRQUEUE_SCENE --project $LOCAL_PROJECT_PATH --frame $DRQUEUE_FRAME # and that's some starting point