Skip to content

Instantly share code, notes, and snippets.

@kmader
Forked from kmader/batchimage.condor
Last active August 29, 2015 14:20
Show Gist options
  • Save kmader/5b1d261aac240fed5a58 to your computer and use it in GitHub Desktop.
Save kmader/5b1d261aac240fed5a58 to your computer and use it in GitHub Desktop.
The basic condor setup for a job processing a simple cell image using KNIME
##################################################################
##
## Run a parameter sweep with threshold and filter using condor
## Filename: batchimage.condor
##
##################################################################
universe = vanilla
getenv = True # KNIME needs local environment
my_prefix = FilterTest
#
# Seek max floating point performance
#
Rank = Kflops
#
# Filter and Threshold Settings
#
thresh_count= 30
filter_count = 1
job_count = $(thresh_count) * $(filter_count)
threshold_start = 50
threshold_end = 200
#
# MATLAB does all the math there,
# Condor just does string substitution
#
cur_threshold = ( $(threshold_start) + ($(threshold_end) - $(threshold_start))*$(Process)/$(thresh_count) )
cur_filter = 1
#
# The name of the csv file to write and the image file to read
#
current_path=$(readlink -e .)
output_file = $(current_path)$(my_prefix).t.$(Process).csv
image_file=$(readlink -e input_image.jpg)
#
# For KNIME and other SEPP packages, the executable must be a script wrapper.
#
executable = filterandthreshold.sh
arguments = "-workflow.variable=inputimage,$(image_file),String -workflow.variable=threshold,$(cur_threshold),double -workflow.variable=outputcsv,$output_file),String"
#
# To redirect stdout and/or stderr to /dev/null, comment these out.
#
log = $(my_prefix).log
output = $(my_prefix).$(Process).out
error = $(my_prefix).$(Process).err
#
# Lastly, tell condor how many jobs to queue up.
#
queue $(job_count)
#!/bin/sh
#
# Filename: filterandthreshold.sh
#
# We use a shell wrapper for two reasons:
#
# 1) By using "$*" we ensure that the matlab command string is
# passed as a single argument even if it contains spaces.
#
# 2) Condor changes argv[0], which causes problems for SEPP. Hence,
# whenever we run a program from /usr/sepp/bin/* we must use a
# shell script wrapper.
#
exec /usr/sepp/bin/knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile=CellWorkflow.zip "$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment