Batch FAQ

Question: Why do you have to use vsched -pa before running your first job?

Answer: The Velocity Scheduler needs your domain password to execute your jobs. So, before the first time you submit a job to run on the cluster, you need to register your password with vsched. vsched -pa is a command used to store the password on the secure control node so that it can be used to impersonate the user when running their batch job.


Question: How much scratch space is available on the Velocity nodes?

Answer: At least 25 GBytes. It depends on the machines on which the job runs.  See
CTC Computing Resources.
Question: Is there a limit on the maximum length of a batch job?

Answer: Yes. For details see the CTC
Job Limits Policy.
Question: What happens if you omit one of the required xml tags? 

 <?xml version="1.0" ?>
<!-- Sample XML Job File -->
<job>
<nodes>1</nodes>
<minutes>5</minutes>
<type>batch</type>
<affiliation>vplustest</affiliation>-
<run>\\tc.cornell.edu\tc\users\sverdlik\batch\location.bat</run>
</job>

Answer: After submitting the job, the following error message will be generated.

 ERROR: Object reference not set to an instance of an object.


Question: Are xml tags and the associated data case sensitive?

Answer:
Yes, for the names of the xml tags. No, for the data between the pair of tags.
Question: How can you find out the cluster affiliations that are valid data for the <affiliation>…</affiliation> tags ?

Answer: vsched -affiliations
Question: What happens if you put invalid data between a pair of xml tags?

Answer:
 The job will be rejected with the error message "ERROR: Input string was not in a correct format." or else a more specific message, depending on the error.

Question: How do I capture standard out and standard error in a batch job?

Answer:
Note that this can aid in debugging as you will capture diagnostic error messages.

Basic syntax:

xxx.exe 1>stdout.txt 2>stdout.txt

Example:

set STDOUT=\\tc.cornell.edu\tc\users\%USERNAME%\stdout.txt
set STDERR=\\tc.cornell.edu\tc\users\%USERNAME%\stderr.txt
REM time the job by writing timestamps to a file
echo Begin at: 1>%STDOUT% 2>%STDERR%
time /T 1>>%STDOUT% 2>>%STDERR%
date /T 1>>%STDOUT% 2>>%STDERR%

REM run the job
xxx.exe 1>>%STDOUT% 2>>%STDERR%

REM time the job by writing timestamps to a file
echo End at:1>>%STDOUT% 2>>%STDERR%
time /T 1>>%STDOUT% 2>>%STDERR%
date /T 1>>%STDOUT% 2>>%STDERR%


Question: Will a serial job use only 50% of a dual node?

Answer:
Yes, unless you write your script to explicitly take advantage of both processors.
Question: What happens if you run your executable on one of the CTC login machines?

Answer:
If this is detected, your job will be killed. It is against CTC policy to run jobs on the login nodes. Running a program uses all the computing power and prevents interactive work. Commands stop working and everyone suffers. Failure to adhere to this policy can lead to a loss of computing privileges.
Question: Should I use echo statements in my bat script?

Answer:
They may be useful when debugging a script, but are not required.  In the batch system they are useful only for interactive jobs.

Question: Can I be notified by email when my job is finished?

Answer:
Yes, add
call notify <email_address>"Batch job has ended"
to your script file.
Question: Is there any way to extend the time allocated to my batch job?

Answer:
  No. There's no way to implement this feature, as the backfill scheduling algorithm requires jobs to be of fixed duration.
Question: How do I delete a directory tree in batch?

Answer:
To delete the files in my_directory
del /Q T:\<my_directory>

To delete my_directory and its subdirectories
rmdir /Q /S T:\<my_directory>
Question: Are there any batch file examples?

Answer:
  Yes. See Batch File Examples.
Question: My batch jobs start, but they don't do anything. or My batch jobs used to work, but now they start and don't do anything. What is happening?

Answer:
You need to register your password with vsched -pa. If you changed your Windows password, but did not follow that with vsched -pa this is the behavior you would see.
Question: Can there be a space between the <run> tag  and the beginning of the run tag data?

Answer:
No.  The space will be interpreted as the first character of the data.  Since your command does not start with a space, it will fail silently.  The symptom is that the job won't do anything.
Question: Are there any issues to be aware of if there are spaces in the path in the run tag data?

Answer:
Yes.

  • If there is a space in the path, as with run dir but there are no command-line arguments, then there is nothing different in the syntax.

<run>\\tc.cornell.edu\tc\Users\usersname\run dir\myrun.bat</run>

  • However, if you use command line arguments and your directory name includes run dir, you need double quotes around the command. The string should look like

<run>"\\tc.cornell.edu\tc\Users\username\run dir\myrun.bat" 1arg 2arg 3.1415926</run>


Question: Since not all applications handle spaces in names gracefully, how do you reference names with spaces in a .bat file?

Answer: There are two options, double quotes or the "~" syntax. (dir /x will show both versions of the name.) Suppose you want to set the variable ROOTDIR to a directory and the name of the directory is \\tc.cornell.edu\tc\Users\username\Batch Files.

set ROOTDIR="\\tc.cornell.edu\tc\Users\username\Batch Files"

-or-

set ROOTDIR=\\tc.cornell.edu\tc\Users\username\BATCHF~1