GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing pycondor.github.io — Basic Workflow — PyCondor documentation Basic Workflow¶This tutorial walks through the example workflow shown below. To follow along with this tutorial, make sure you have PyCondor installed (see the Installation instruction). Here’s an outline of the tutorial:
from pycondor import Job, Dagman # Define the error, output, log, and submit directories error = 'condor/error' output = 'condor/output' log = 'condor/log' submit = 'condor/submit' # Instantiate a Dagman dagman = Dagman(name='tutorial_dagman', submit=submit) # Instantiate Jobs job_date = Job(name='date_job', executable='/bin/date', submit=submit, error=error, output=output, log=log, dag=dagman) job_sleep = Job(name='sleep_job', executable='/bin/sleep', submit=submit, error=error, output=output, log=log, dag=dagman) job_sleep.add_arg('1') job_sleep.add_arg('2') job_sleep.add_arg('3') # Add inter-job relationship # Ensure that job_sleep finishes before job_date starts job_sleep.add_child(job_date) # Write all necessary submit files and submit job to HTCondor dagman.build_submit() Job and Dagman objects¶The basic building blocks in PyCondor are the Job and Dagman objects. A Job object represents an executable (e.g. a shell command, Python script, etc.) that you would like to run using HTCondor. While the Dagman object represents a collection of Job objects to run. from pycondor import Job, Dagman Both the Job and Dagman objects can be imported directly from Job and Dagman file directories¶There are several files associated with both Job and Dagman objects. For each Job and Dagman object, PyCondor will create a submit file. This file will be formatted such that it can be submitted to HTCondor for execution. In addition to submit files, there will also be log files, standard output files, and standard error files associated with running a Job and/or Dagman. # Define the error, output, log, and submit directories error = 'condor/error' output = 'condor/output' log = 'condor/log' submit = 'condor/submit' Above we’ve specified the paths to where we would like these files to be written. These will be passed to Job and Dagman objects we create in the following steps. Setting up a Dagman¶The Dagman (short for directed acyclic graph manager) object is a collection of Job objects to be run. # Instantiate a Dagman dagman = Dagman(name='tutorial_dagman', submit=submit) For a Dagman, only a Setting up Jobs¶Now we’re ready to add some Job objects to the Dagman. Both a # Instantiate Jobs job_date = Job(name='date_job', executable='/bin/date', submit=submit, error=error, output=output, log=log, dag=dagman) job_sleep = Job(name='sleep_job', executable='/bin/sleep', submit=submit, error=error, output=output, log=log, dag=dagman) job_sleep.add_arg('1') job_sleep.add_arg('2') job_sleep.add_arg('3') In this example, In addition to defining an executable for a Job to run, you can also pass arguments to the executable using the Job Adding inter-job relationships¶One useful feature of Dagman objects is they can support inter-job relationships between the Jobs they manage. # Add inter-job relationship # Ensure that job_sleep finishes before job_date starts job_sleep.add_child(job_date) In many workflows, there are dependencies between different Jobs. For example, you might want to make sure one Job finishes before another Job begins. Inter-job relationships in PyCondor can be specified using the Job For this tutorial, Build and submit the Dagman¶Now that the workflow for this tutorial has been set up, we can build all the appropriate Job and Dagman submit files and submit them to HTCondor for execution. # Write all necessary submit files and submit job to HTCondor dagman.build_submit() The Dagman For more examples see the Examples documentation page. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |