1.4.1.3. Transferring files

1.4.1.3.1. Implicit transfer of executable

The simplest example that involve file transfer is the job script itself.

create a file repl.ini,

universe                = parallel
executable              = repl.sh

log                     = repl.log
output                  = repl-$(Node).out
error                   = repl-$(Node).err
stream_error            = True
stream_output           = True

should_transfer_files   = Yes
when_to_transfer_output = ON_EXIT

machine_count           = 2
request_cpus            = 2

request_memory          = 512M
request_disk            = 1G

queue

and a file repl.sh,

#!/bin/bash -l

# helpers ##############################################################

COLUMNS=72

print_double_line() {
	eval printf %.0s= '{1..'"${COLUMNS}"\}
	echo
}

print_line() {
	eval printf %.0s- '{1..'"${COLUMNS}"\}
	echo
}

########################################################################

print_double_line
echo "hostname: $(hostname)"
print_line
echo "CPU:"
print_line
lscpu
echo Hello from $_CONDOR_PROCNO of $_CONDOR_NPROCS

print_double_line
echo "HTCondor config summary:"
print_line
condor_config_val -summary

print_double_line
echo "Current environment:"
print_line
env | sort

print_double_line
echo "Avaiable MPI:"
module avail mpi

module load mpi/openmpi3-x86_64

print_double_line
echo "Current environment:"
print_line
env | sort

print_double_line
echo "module path:"
which mpicc
which mpirun

This ClassAd involve transferring a script named repl.sh, and be default it will be copied to worker nodes.

And then you can submit your job using

condor_submit repl.ini

After waiting for a while as the job finished, you can see what happened by reading the contents of log, output, and error as specified in the ClassAd.

See Monitor your jobs to see how to monitor the status of your job. For advance use, use this command instead,

condor_submit repl.ini; tail -F repl.log repl-0.out repl-0.err repl-1.out repl-1.err

and see Streaming stdout & stderr with tail for an explanation on what it does.

Note

We normally won’t use the module system here, but if needed, notice the shebang #!/bin/bash -l is necessary for module to be found.

This example also includes some information specific to HTCondor that you can play around.

1.4.1.3.2. Explicit file transfer

Create a file cat.ini,

universe                = parallel
executable              = /usr/bin/cat
arguments               = cat.txt

log                     = cat.log
output                  = cat-$(Node).out
error                   = cat-$(Node).err
stream_error            = True
stream_output           = True

transfer_input_files    = cat.txt
should_transfer_files   = Yes
when_to_transfer_output = ON_EXIT

machine_count           = 2
request_cpus            = 2

request_memory          = 512M
request_disk            = 1G

queue

Over here, we use transfer_input_files to specify which input files to be copied to the worker nodes. If it is a relative path, it will be the relative path w.r.t. the current directory that you are submitting the job from.

To prepare the file for transfer_input_files, let’s create cat.txt with the content,

hello world

And then submit your job using

condor_submit cat.ini

After waiting for a while as the job finished, you can see what happened by reading the contents of log, output, and error as specified in the ClassAd.

See Monitor your jobs to see how to monitor the status of your job. For advance use, use this command instead,

condor_submit cat.ini; tail -F cat.log cat-0.out cat-0.err cat-1.out cat-1.err

and see Streaming stdout & stderr with tail for an explanation on what it does.

If you want to transfer more than one files, delimit them with a comma, like so:

transfer_input_files = file1,file2,/path/to/file3