posted on: 2009-10-08 09:31:44
Shows a procedure for submitting a condor job that runs a jar file with different command line arguments, reads a file and writes the output to a file.

>So I made a jar file with a package in it. The package is condortest and the jar file is not an executeable jar file. It can be but it doesn't have to be. The class Example has the main() function that I execute when I run the program.

Here is the condor file.

########################
# This is a comment.
# Submit file for a simple program located at 
# /home/username/some/path/my_file
########################

universe = java
notify_user = email@aplace.thatwill.bemailed.alot
notification = Always
getenv = TRUE
initialdir = /tmp/where/i/want/files
requirements = (JavaVersion>="1.4")
Executable = example.jar
jar_files = example.jar
Input = input.txt
Output = log/trial.out.$(PROCESS)
log = log/trial.log.$(CLUSTER)
error = log/trial.err.$(PROCESS)
arguments = condortest.Example $(PROCESS)

should_transfer_files = YES
transfer_input_files = 
WhenToTransferOutput = ON_EXIT_OR_EVICT

queue 5

Now lets look at the lines.

initialdir = /tmp/where/i/want/files

This is where condor starts your program from. Your program does not run in this directory, but the environment is similar. This means that any file condor wants to look for, will be looked for relative to this directory. It also means that any files condor writes will be written relative to this directory.

Something that is a little tricky.

Executable = example.jar

This is nescessary but it is not used. This is not executed, but it needs to be present in the location that you perform your condor_submit and it needs to be present in the initialdir.

You can even use a different file. Such as a text file.

jar_files = example.jar
Input = input.txt

Both of these variables require that the files are available in reference to initialdir. Jar files will be included in your class path. If you want to use a jar file you do not need to put it in the Executable variable, but you HAVE to include it in the jar files. The jar_file is not executed but included in the class path and then you make the appropriate arguments. An Input file is also passed along so that you can access it from your program. You can vary the name the same as the output file, such as with the PROCESS variable.

If you are only going to be using a class file then you need to put it as your executable, but it is not executed, you have to include it in the arguments.

Output = log/trial.out.$(PROCESS)
log = log/trial.log.$(CLUSTER)
error = log/trial.err.$(PROCESS)

These files are automatically written by condor. I put them in a log subdirectory, so this directory MUST be present in my initialdir when I run my program. This helps reduce clutter since there is a .out, .err file written for each queue value. error stores your stderr, log stores submit specific entries, and Output is where your stdout goes. (this is the case with java).

arguments = condortest.Example $(PROCESS)

This executes the program, you can translate this the complete command to:

java -cp example.jar:/tmp/mbs condortest.Example $(PROCESS)

The process variable is a number that Example recieves as a command line argument. I use it to vary parameters sets.

queue 5

This is the number of jobs that are submitted.

requirements = (JavaVersion>="1.4")

For lehigh, a large number of the computers on campus have java 1.4 so if you have writting your program 1.4 compliant, which it probably is, then you should compile it to 1.4, which means your program will execute sooner. If not, then change this line to 1.6 or whatever version of java you use.

Finally here is the script I use to make the program execute.

# The script should be sourced by /bin/sh or similar
CONDOR_CONFIG="/usr/local/condor/etc/condor_config"
export CONDOR_CONFIG
PATH="/usr/local/condor/bin:/usr/local/condor/sbin:$PATH"
export PATH
condor_submit example.sub

This sets up the environment so that condor is in your path, and the condor_config file can be found. Then it executes the program. Lehigh has some resources that I have used to figure this out.

Lehigh HPC: Condor

And here is the online manual for the version of condor at Lehigh:

Condor Version 7.2.4

(Lehigh has 7.2.3 so 7.2 seems to point at the one we use.)

NOTES: I have not figured out how to write output files to different directories, I almost think I need to have java create the directory but it isn't too big of a concern yet.

Comments

Name: