From c50ecf67362555e3611b34e8175bd613df334775 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Fri, 24 Oct 2014 22:09:28 +0000 Subject: README.md edited online with Bitbucket --- README.md | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 118 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 2b97480..66480a9 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,118 @@ -# Requirements - - -## Python 2.6.x: - -* argparse >= 1.2 -* multiprocessing >= 2.6 - - -## Python 2.7.x: - -* None, all dependencies are built-in - - -## Python 3.x.x: - -* None, all dependencies are built-in -* Converting the code with 2to3 works perfectly fine. - +# Requirements + +The `htc_utils.bindings` require a working HTCondor installation in your `PATH` + +### Python 2.6.x: + +* `argparse` >= 1.2 +* `multiprocessing` >= 2.6 + +### Python 2.7.x ~ 3.x.x: + +All dependencies are satisfied by default. + + +# Installation + +### At the system level +``` +python setup.py install +``` + +### Or at the user level +``` +python setup.py install --user +``` + +# HTCondor Bindings + +## `Job` & `Submit` Classes + +This is an example of how to generate and submit simple jobs to a HTCondor cluster using htc_utils. + +``` +#!python +import random +from htc_utils.bindings import Job, Submit + +# Create job object (filename will be "my_neato_condor.job") +job = Job('my_neato_condor') + +# Populate initial job attributes +job.attr('getenv', True) +job.attr('executable', '/bin/sleep') +job.attr('arguments', 1) +job.logging('logs', create=True) +job.attr('queue') + +# Populate additional sub-attributes (i.e. re-execute job with +# a different set of arguments. +for fileno in range(5): + x = random.Random().randint(2, 5) + job.subattr('arguments', x) + job.subattr('queue') + +# Write job file to disk +job.commit() + +# Pass our job to the Submit class +submit = Submit(job) + +# Send our job to the cluster +submit.execute() +``` + +### Contents of `my_neato_condor.job` + +``` +universe = vanilla +getenv = true +executable = /bin/sleep +arguments = 1 +notification = Never +priority = 0 +transfer_executable = true +should_transfer_files = IF_NEEDED +when_to_transfer_output = ON_EXIT +hold = false +log = logs/condor_$(Cluster).log +output = logs/stdout_$(Cluster)_$(Process).log +error = logs/stderr_$(Cluster)_$(Process).log +queue + +arguments = 5 +queue + +arguments = 2 +queue + +arguments = 2 +queue + +arguments = 4 +queue + +arguments = 4 +queue + +``` + +## CLI Components + +`htc_utils` provides a wrapper to the `Job` class to aid job creation outside of Python. + +### Job example rewritten using `condor_batch` + +``` +#!bash +condor_batch -n my_neato_condor \ +--logging logs \ +--logging-create \ +--getenv true \ +--subarg 5 \ +--subarg 2 \ +--subarg 2 \ +--subarg 4 \ +--subarg 4 \ +/bin/sleep 1 +``` -- cgit