HTCondor Job Submission Guide
HTCondor Job Submission Guide
Todd Tannenbaum
1
University of Wisconsin-Madison
Center for High Throughput Computing
(CHTC)
2
Agenda
› Today:
Introduction for users
Also useful for administrators
› Plan for Tomorrow:
Session One (9:30am-11:00am)
• Architecture/Administration Overview (90min)
Session Two (11:30am-1:00pm)
• Open Question/Answer Session (45 min)
• Monitoring (20 min)
• What's New and What's Coming Up? (20 min)
3
Introduction
4
What is HTCondor?
• Software that schedules and runs
computing tasks on computers
HTCONDOR
5
How It Works
• Submit tasks to a queue (on a submit point)
• HTCondor schedules them to run on
computers (execute points)
execute
submit
execute
execute
6
Single Computer
execute execute
submit
execute
7
Multiple Computers
execute
submit
execute
execute
8
Why HTCondor?
• HTCondor manages and runs work on your
behalf
• Schedule tasks on a single computer to not
overwhelm the computer
• Schedule tasks on a group* of computers
(which may/may not be directly accessible to
the user)
• Schedule tasks submitted by multiple users
on one or more computers
10
Open Science Grid
[Link]
11
CMS Global Pool
• Dynamic cluster, ~200k - 300k cores pulled
in from sites worldwide
12
12
Bursting into Google Cloud @ SC16
13
13
User-Focused Tutorial
• For the purposes of this tutorial, we are
assuming that someone else has set up
HTCondor on a computer/computers to
create a HTCondor “pool”.
• The focus of this talk is an introduction on
how to get started running computational
work on this system.
14
Running a Job with
HTCondor
15
Jobs
• A single computing task is called a “job”
• Three main pieces of a job are the input,
executable (program) and output
[Link]
compare_
[Link]
states
[Link]
17
File Transfer
• What about files? Can use a shared file system,
chirp, or file transfer mechanism.
• Our example will use HTCondor’s file transfer :
Submit Execute
(submit_dir)/ (execute_dir)/
input files output files
executable
18
Job Translation
• Submit file: communicates everything
about your job(s) to HTCondor
executable = compare_states
arguments = [Link] [Link] [Link]
should_transfer_files = YES
transfer_input_files = [Link], [Link]
when_to_transfer_output = ON_EXIT
log = [Link]
output = [Link]
error = [Link]
request_cpus = 1
request_disk = 20MB
request_memory = 20MB
queue 1
19
Submit File
[Link]
executable = compare_states
arguments = [Link] [Link] [Link]
should_transfer_files = YES
transfer_input_files = [Link], [Link]
when_to_transfer_output = ON_EXIT
log = [Link]
output = [Link]
error = [Link]
request_cpus = 1
request_disk = 20MB
request_memory = 20MB
queue 1
20
Submit File
[Link]
• List your
executable = compare_states executable and
arguments = [Link] [Link] [Link] any arguments it
takes.
should_transfer_files = YES
transfer_input_files = [Link], [Link]
when_to_transfer_output = ON_EXIT compare_
states
log = [Link]
output = [Link]
error = [Link] • Arguments are
any options
request_cpus = 1
request_disk = 20MB
passed to the
request_memory = 20MB executable from
the command line.
queue 1 $ compare_states [Link] [Link] [Link]
21
Submit File
[Link]
executable = compare_states • Indicate
arguments = [Link] [Link] [Link] your input
should_transfer_files = YES files.
transfer_input_files = [Link], [Link]
when_to_transfer_output = ON_EXIT
log = [Link]
output = [Link] [Link]
error = [Link]
request_cpus = 1
request_disk = 20MB
request_memory = 20MB [Link]
queue 1
22
Submit File
[Link]
executable = compare_states • HTCondor will
arguments = [Link] [Link] [Link] transfer back
should_transfer_files = YES all new and
transfer_input_files = [Link], [Link]
when_to_transfer_output = ON_EXIT changed files
log = [Link] (usually
output = [Link]
error = [Link]
output) from
request_cpus = 1
the job.
request_disk = 20MB
request_memory = 20MB
[Link]
queue 1
23
Submit File
[Link]
• log: file
executable = compare_states
arguments = [Link] [Link] [Link] created by
should_transfer_files = YES
HTCondor to
transfer_input_files = [Link], [Link] track job
when_to_transfer_output = ON_EXIT
progress
log = [Link] • output/err
output = [Link]
error = [Link] or: captures
request_cpus = 1 stdout and
request_disk = 20MB stderr
request_memory = 20MB
queue 1
24
Submit File
[Link]
executable = compare_states
• Request the
arguments = [Link] [Link] [Link] appropriate
should_transfer_files = YES resources
transfer_input_files = [Link], [Link] for your job
when_to_transfer_output = ON_EXIT
to run.
log = [Link]
output = [Link] • queue:
error = [Link] keyword
request_cpus = 1 indicating
request_disk = 20MB
request_memory = 20MB
“create a
job.”
queue 1
25
Submitting and Monitoring
• To submit a job/jobs:
condor_submit submit_file_name
• To monitor submitted jobs, use:
condor_q
$ condor_submit [Link]
Submitting job(s).
1 job(s) submitted to cluster 128.
$ condor_q
-- Schedd: [Link] : <[Link]:9618?... @ 05/01/17 10:35:54
OWNER BATCH_NAME SUBMITTED DONE RUN IDLE TOTAL JOB_IDS
alice CMD: compare_states 5/9 11:05 _ _ 1 1 128.0
Submit Node
(submit_dir)/
[Link]
compare_states
[Link]
[Link]
[Link]
[Link]
[Link]
29
Job Starts by doing File Transfer
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128.0 alice 5/9 11:09 0+00:00:00 < 0 0.0 compare_states [Link] [Link] w
30
Job Running
$ condor_q -nobatch
31
Job Completes
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128 alice 5/9 11:09 0+00:02:02 > 0 0.0 compare_states [Link] [Link]
32
Job Completes (cont.)
$ condor_q -nobatch
Submit Node
(submit_dir)/
[Link]
compare_states
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
33
Log File
000 (128.000.000) 05/09 11:09:08 Job submitted from host:
<[Link]&sock=6423_b881_3>
...
001 (128.000.000) 05/09 11:10:46 Job executing on host:
<[Link]:9618&sock=5053_3126_3>
...
006 (128.000.000) 05/09 11:10:54 Image size of job updated: 220
1 - MemoryUsage of job (MB)
220 - ResidentSetSize of job (KB)
...
005 (128.000.000) 05/09 11:12:48 Job terminated.
(1) Normal termination (return value 0)
Usr 0 00:00:00, Sys 0 00:00:00 - Run Remote Usage
Usr 0 00:00:00, Sys 0 00:00:00 - Run Local Usage
Usr 0 00:00:00, Sys 0 00:00:00 - Total Remote Usage
Usr 0 00:00:00, Sys 0 00:00:00 - Total Local Usage
0 - Run Bytes Sent By Job
33 - Run Bytes Received By Job
0 - Total Bytes Sent By Job
33 - Total Bytes Received By Job
Partitionable Resources : Usage Request Allocated
Cpus : 1 1 1
Disk (KB) : 14 20480 17203728
Memory (MB) : 1 20 20
34
Job States
transfer
transfer
executable
output
and input to
back to
execute
submit node
node
35
Assumptions
• Aspects of your submit file may be
dictated by infrastructure and configuration
• For example: file transfer
– previous example assumed files would need
to be transferred between submit/execute
should_transfer_files = YES
36
Shared file system
• If a system has a shared file system, where
file transfer is not enabled, the submit
directory and execute directory are the same.
Submit Execute
shared_dir/
input
executable
output
37
Resource Request
• Jobs are nearly always using a part of a
computer, not the whole thing
• Very important to request appropriate
resources (memory, cpus, disk) for a job
whole
computer
your request
38
Resource Assumptions
• Even with reasonable default CPU, memory
and disk requests, these may be too small!
• Important to run test jobs and use the log file
to request the right amount of resources:
– requesting too little: causes problems for your
and other jobs; jobs might by held by HTCondor
– requesting too much: jobs will match to fewer
“slots”
39
Job Matching and
Class Ad Attributes
40
The Central Manager
• HTCondor matches jobs with computers
via a “central manager”.
execute
submit
execute
41
Class Ads
• HTCondor stores a list of information about
each job and each computer.
• This information is stored as a “Class Ad”
= UtsnameSysname = "Linux"
MAX_PREEMPT = ( 3600 * 72 )
Requirements = ( START ) && (
IsValidCheckpointPlatform ) && (
WithinResourceLimits )
OpSysMajorVer = 6
TotalMemory = 9889
+ HasGluster = true
HTCondor configuration OpSysName = "SL"
HasDocker = true
...
44
Job Matching
• On a regular basis, the central manager
reviews Job resource requests and Machine
Class Ads and matches jobs to computers.
execute
submit
execute
45
Job Execution
• (Then the submit and execute points
communicate directly.)
execute
submit
execute
46
Class Ads for People
• Class Ads also provide lots of useful
information about jobs and computers to
HTCondor users and administrators
47
Finding Job Attributes
• Use the “long” option for condor_q
condor_q -l JobId
$ condor_q -l 128.0
WhenToTransferOutput = "ON_EXIT"
TargetType = "Machine"
Cmd = "/home/alice/tests/htcondor_week/compare_states"
JobUniverse = 5
Iwd = "/home/alice/tests/htcondor_week"
RequestDisk = 20480
NumJobStarts = 0
WantRemoteIO = true
OnExitRemove = true
TransferInput = "[Link],[Link]"
MyType = "Job”
UserLog = "/home/alice/tests/htcondor_week/[Link]"
RequestMemory = 20
...
48
Some Useful Job Attributes
• UserLog: location of job log
• Iwd: Initial Working Directory (i.e.
submission directory) on submit node
• MemoryUsage: maximum memory the job
has used
• RemoteHost: where the job is running
• BatchName: attribute to label job batches
• ...and more
49
Selectively display specific
attributes
• Use the “auto-format” option:
condor_q [U/C/J] -af Attribute1 Attribute2 ...
50
Other Displays
• See the whole queue (all users, all jobs)
condor_q -all
$ condor_q -all
51
condor_q Reminder
• Default output is batched jobs
– Batches can be grouped manually using the
JobBatchName attribute in a submit file:
JobBatchName = “CoolJobs”
52
Class Ads for Computers
as condor_q is to jobs, condor_status is to computers (or “machines”)
$ condor_status
Name OpSys Arch State Activity LoadAv Mem Actvty
slot1@[Link] LINUX X86_64 Unclaimed Idle 0.000 673 25+01
slot1_1@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+01
slot1_2@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+01
slot1_3@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+00
slot1_4@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+14
slot1_5@[Link] LINUX X86_64 Claimed Busy 1.000 1024 0+01
slot1@[Link] LINUX X86_64 Unclaimed Idle 1.000 2693 19+19
slot1_1@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+04
slot1_2@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+01
slot1_3@[Link] LINUX X86_64 Claimed Busy 0.990 2048 0+02
slot1@[Link] LINUX X86_64 Unclaimed Idle 0.010 645 25+05
slot1_1@[Link] LINUX X86_64 Claimed Busy 1.000 2048 0+01
55
Submitting Multiple Jobs
with HTCondor
56
Many Jobs, One Submit File
• HTCondor has built-in ways to submit
multiple independent jobs with one submit
file
57
Advantages
• Run many independent jobs...
– analyze multiple data files
– test parameter or input combinations
– and more!
• ...without having to:
– start each job individually
– create separate submit files for each job
58
Multiple, Numbered, Input Files
[Link]
(submit_dir)/
executable = [Link]
arguments = [Link] [Link] [Link]
transfer_input_files = [Link] [Link]
[Link]
log = [Link] [Link]
output = [Link]
error = [Link] [Link]
queue
queue 3
60
Automatic Variables
ClusterId ProcId
• Each job’s
ClusterId and
ProcId numbers
128 0
are saved as job
queue N 128 1 attributes
• They can be
128 2
accessed inside
... ... the submit file
using:
128 N-1 – $(ClusterId)
– $(ProcId)
61
Job Variation
[Link]
(submit_dir)/
executable = [Link]
arguments = [Link] [Link] [Link]
transfer_input_files = [Link] [Link]
[Link]
log = [Link] [Link]
output = [Link]
error = [Link] [Link]
queue
log = job_$(ClusterId).log
output = job_$(ClusterId)_$(ProcId).out
error = job_$(ClusterId)_$(ProcId).err
queue 3
64
Shared Files
• HTCondor can transfer an entire directory
or all the contents of a directory
(submit_dir)/
– transfer whole directory [Link]
transfer_input_files = shared shared/
[Link]
[Link]
– transfer contents only [Link]
[Link]
transfer_input_files = shared/
[Link]
log
[Link]
executable = [Link]
arguments = file$(Process).in file$(ProcId).out
transfer_input_files = input/file$(ProcId).in
log = log/job$(ProcId).log
error = err/job$(ProcId).err
queue 3
67
InitialDir
• Change the submission directory for each job
using initialdir
• Allows the user to organize job files into
separate directories.
• Use the same name for all input/output files
• Useful for jobs with lots of output files
68
Separate Jobs with InitialDir
(submit_dir)/
[Link] job0/ job1/ job2/
[Link] [Link] [Link] [Link]
[Link] [Link] [Link]
[Link] [Link] [Link]
[Link] [Link] [Link]
[Link]
executable = [Link]
initialdir = job$(ProcId)
arguments = [Link] [Link] Executable should be
transfer_input_files = [Link] in the directory with
the submit file, *not*
log = [Link] in the individual job
error = [Link] directories
queue 3
69
Other Submission Methods
• What if your input files/directories aren’t
numbered from 0 - (N-1)?
• There are other ways to submit many jobs!
70
Submitting Multiple Jobs
executable = compare_states Replacing
arguments = [Link] [Link] [Link]
single job
transfer_input_files = [Link], [Link]
inputs
queue 1
71
Possible Queue Statements
matching ... queue infile matching *.dat
pattern
in ... list queue infile in ([Link] [Link] [Link])
72
Queue Statement Comparison
matching .. Natural nested looping, minimal programming, use optional
pattern “files” and “dirs” keywords to only match files or directories
Requires good naming conventions,
in .. list Supports multiple variables, all information contained in a single
file, reproducible
Harder to automate submit file creation
from .. file Supports multiple variables, highly modular (easy to use one
submit file for many job batches), reproducible
Additional file needed
73
Using Multiple Variables
• Both the “from” and “in” syntax support
using multiple variables from a list.
[Link] job_list.txt
executable = compare_states [Link], 2010
arguments = -year $(option) –input $(file) [Link], 2015
[Link], 2010
should_transfer_files = YES [Link], 2015
when_to_transfer_output = ON_EXIT [Link], 2010
transfer_input_files = $(file) [Link], 2015
75
Testing and Troubleshooting
76
What Can Go Wrong?
• Jobs can go wrong “internally”:
– "job failed to run…"
– something happens after the executable
begins to run
• Jobs can go wrong from HTCondor’s
perspective:
– A job can’t be started at all ("failed to launch"),
– Uses too much memory,
– Has a badly formatted executable,
– And more...
77
Reviewing Failed Jobs
• A job’s log, output and error files can provide
valuable information for troubleshooting
78
Reviewing Jobs
• To review a large group of jobs at once,
use condor_history
As condor_q is to the present, condor_history is to the past
$ condor_history alice
ID OWNER SUBMITTED RUN_TIME ST COMPLETED CMD
189.1012 alice 5/11 09:52 0+00:07:37 C 5/11 16:00 /home/alice
189.1002 alice 5/11 09:52 0+00:08:03 C 5/11 16:00 /home/alice
189.1081 alice 5/11 09:52 0+00:03:16 C 5/11 16:00 /home/alice
189.944 alice 5/11 09:52 0+00:11:15 C 5/11 16:00 /home/alice
189.659 alice 5/11 09:52 0+00:26:56 C 5/11 16:00 /home/alice
189.653 alice 5/11 09:52 0+00:27:07 C 5/11 16:00 /home/alice
189.1040 alice 5/11 09:52 0+00:05:15 C 5/11 15:59 /home/alice
189.1003 alice 5/11 09:52 0+00:07:38 C 5/11 15:59 /home/alice
189.962 alice 5/11 09:52 0+00:09:36 C 5/11 15:59 /home/alice
189.961 alice 5/11 09:52 0+00:09:43 C 5/11 15:59 /home/alice
189.898 alice 5/11 09:52 0+00:13:47 C 5/11 15:59 /home/alice
81
Diagnosing Holds
• If HTCondor puts a job on hold, it provides
a hold reason, which can be viewed with:
condor_q -hold [ -wide]
$ condor_q -hold -af HoldReason
Error from slot1_1@[Link]: Job has gone over
memory limit of 2048 megabytes.
Error from slot1_20@[Link]: SHADOW at
[Link] failed to send file(s) to <[Link]:35110>: error
reading from /home/alice/[Link]: (errno 2) No such file or directory;
STARTER failed to receive file(s) from <[Link]:9618>
Error from slot1_11@[Link]: STARTER
at [Link] failed to send file(s) to <[Link]:9618>; SHADOW at
[Link] failed to write to file /home/alice/Test_18925319_16.err:
(errno 122) Disk quota exceeded
Error from slot1_38@[Link]: Failed
to execute '/var/lib/condor/execute/slot1/dir_2471876/condor_exec.exe' with
arguments 2: (errno=2: 'No such file or directory')
82
Common Hold Reasons
• Job has used more memory than
requested
• Incorrect path to files that need to be
transferred
• Badly formatted bash scripts (have
Windows instead of Unix line endings)
• Submit directory is over quota
• The admin has put your job on hold
83
Fixing Holds
• Job attributes can be edited while jobs are
in the queue using:
condor_qedit [U/C/J] Attribute Value
$ condor_qedit 128.0 RequestMemory 3072
Set attribute ”RequestMemory".
$ condor_hold 128
All jobs in cluster 128 have been held
$ condor_hold 128.0
Job 128.0 held
86
Job States, Revisited
condor_hold, or
HTCondor puts
condor_release a job on hold
Held
(H)
87
Job States, Revisited*
condor_hold,
or job error
condor_release condor_rm Removed
(X)
Held
(H)
*not comprehensive
88
Some Use Cases and
Mechanisms
89
Interactive Jobs
• An interactive job proceeds like a normal
batch job, but opens a bash session into the
job’s execution directory instead of running
an executable.
condor_submit -i submit_file
$ condor_submit -i [Link]
Submitting job(s).
1 job(s) submitted to cluster 18980881.
Waiting for job to start...
Welcome to slot1_9@[Link]!
90
Output Handling
• Only transfer back specific files from the
job’s execution using transfer_ouput_files
transfer_output_files = [Link]
(submit_dir)/ (execute_dir)/
condor_exec.exe
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
91
condor_chirp
• What if you want to only read part of a file?
• What if you want to write records into an
output file?
Use condor_chirp !
[Link]
92
Self-Checkpointing
• By default, a job that is interrupted will
start from the beginning if it is restarted.
• It is possible to implement self-
checkpointing, which will allow a job to
restart from a saved state if interrupted.
• Self-checkpointing is useful for very long
jobs, and being able to run on
opportunistic resources.
93
Self-Checkpointing How-To
• Edit executable:
– Atomically save intermediate states to a
checkpoint file
– Always check for a checkpoint file when starting
• Add HTCondor option that a) saves all
intermediate/output files from the interrupted
job and b) transfers them to the job when
HTCondor runs it again
when_to_transfer_output = ON_EXIT_OR_EVICT
# Optional: also checkpoint if my job exits with
# a specified exit status
CheckpointExitCode = 77
94
Job Universes
• HTCondor has different “universes” for
running specialized job types
HTCondor Manual: Choosing an HTCondor Universe
• Vanilla (default)
– good for most software
HTCondor Manual: Vanilla Universe
95
Other Universes
• Local
– Run jobs on the submit node
• Java
– Built-in Java support
– Executable is a jar file
• Grid
– Delegate jobs to another
scheduler
– The basis for HTCondor-CE
96
Other Universes (cont.)
• Docker
– Run jobs inside a Docker container
• VM
– Run jobs inside a virtual machine
• Parallel
– Used for coordinating jobs across multiple
servers (e.g. MPI code)
– Not necessary for single server multi-core
jobs
97
Multi-CPU and GPU Computing
• Jobs that use multiple cores on a single
computer can be run in the vanilla universe
(parallel universe not needed):
request_cpus = 16
98
Docker Universe
universe = docker
executable = /bin/my_executable
99
Docker Universe
universe = docker
executable = /bin/my_executable
docker_image = deb7_and_HEP_stack
100
Docker Universe
universe = docker
executable = /bin/my_executable
docker_image = deb7_and_HEP_stack
transfer_input_files = some_input
HTCondor can transfer input files from
submit machine into container
101
Docker Universe
universe = docker
executable = /bin/my_executable
arguments = arg1
docker_image = deb7_and_HEP_stack
transfer_input_files = some_input
output = out
error = err
log = log
queue
102
Automation
103
Automation
• After job submission, HTCondor manages
jobs based on its configuration
• You can use options that will customize job
management even further
• These options can
automate when
jobs are started,
stopped, and removed.
104
Retries
• Problem: a small number of jobs fail with a
known error code; if they run again, they
complete successfully.
• Solution: If the job exits with the error
code, leave it in the queue to run again
max_retries = 3
105
Retries, cont.
• Can also combine with
success_exit_code = < Integer >
retry_until = < Integer | Expression >
executable = [Link]
max_retries = 5
retry_untl = ExitCode >= 0
queue
106
Automatically Hold Jobs
• Problem: Your job should run in 2 hours or
less, but a few jobs “hang” randomly and
run for days
• Solution: Put jobs on hold if they run for
over 2 hours, using a periodic_hold
statement job is running
107
Automatically Release Jobs
• Problem (related to previous): A few jobs
are being held for running long; they will
complete if they run again.
• Solution: automatically release those held
jobs with a periodic_release option,
up to 5 times job is held
109
Automatic Memory Increase
• Putting all these pieces together, the
following lines will:
– request a default amount of memory (2GB)
– put the job on hold if it is exceeded
– release the the job with an increased memory request
request_memory = ifthenelse(isUndefined(MemoryUsage),
2048,(MemoryUsage * 3/2), 2048)
periodic_hold = (MemoryUsage >= ((RequestMemory) * 5/4 )) &&
(JobStatus == 2)
periodic_release = (CurrentTime - EnteredCurrentStatus) > 180) &&
(NumJobStarts < 5) && (HoldReasonCode == 3)
110
Relevant Job Attributes
• CurrentTime: current time
• EnteredCurrentStatus: time of last status
change
• ExitCode: the exit code from the job
• HoldReasonCode: number corresponding to a
hold reason
• NumJobStarts: how many times the job has
gone from idle to running
• JobStatus: number indicating idle, running, held,
etc.
• MemoryUsage: how much memory the job has
used
HTCondor Manual: Appendix A: JobStatus and HoldReason Codes
111
General User Commands
• condor_submit Submit new Jobs
• condor_status View Pool Status
• condor_q View Job Queue
• condor_q -analyze Why job/machines fail to match?
• condor_ssh_to_job Create ssh session to active job
• condor_submit -i Submit interactive job
• condor_hold / release Hold a job, or release a held job
• condor_run Submit and block
• condor_rm Remove Jobs
• condor_prio Intra-User Job Prios
• condor_history Completed Job Info
• condor_submit_dag Submit new DAG workflow
• condor_chirp Access files/ad from active job
112
Describing Workflows with
DAGMan
113
Workflows
• Problem: Want to submit download
jobs in a particular order,
with dependencies split
combine
114
DAG = ”directed acyclic graph”
• topological ordering of
vertices (“nodes”) is
established by directional
connections (“edges”)
• “acyclic” aspect requires
a start and end, with no
looped repetition
– can contain cyclic
subcomponents, covered
in later slides for Wikimedia Commons
workflows
[Link]/wiki/Directed_acyclic_graph 115
DAGMan in the HTCondor
Manual
116
Simple Example for this Tutorial
• The DAG input file will A
communicate the
“nodes” and directional
“edges” of the DAG
B1 B2 B3 ... BN
Wikimedia Commons
[Link] 119
Endless Workflow Possibilities
[Link] 120
Submitting and Monitoring
a DAGMan Workflow
121
Basic DAG input file:
JOB nodes, PARENT-CHILD edges
[Link] A
JOB A [Link]
JOB B1 [Link]
JOB B2 [Link]
JOB B3 [Link] B1 B2 B3 ... BN
JOB C [Link]
PARENT A CHILD B1 B2 B3
PARENT B1 B2 B3 CHILD C
$ condor_submit_dag [Link]
------------------------------------------------------------------
File for submitting this DAG to HTCondor : [Link]
Log of DAGMan debugging messages : [Link]
Log of HTCondor library output : [Link]
Log of HTCondor library error messages : [Link]
Log of the life of condor_dagman itself : [Link]
Submitting job(s).
1 job(s) submitted to cluster 87274940.
------------------------------------------------------------------
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128.0 alice 4/30 18:08 0+00:00:36 R 0 0.3 condor_dagman
129.0 alice 4/30 18:08 0+00:00:00 I 0 0.3 A_split.sh
2 jobs; 0 completed, 0 removed, 1 idle, 1 running, 0 held, 0 suspended
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128.0 alice 4/30 18:08 0+00:20:36 R 0 0.3 condor_dagman
130.0 alice 4/30 18:18 0+00:00:00 I 0 0.3 B_run.sh
131.0 alice 4/30 18:18 0+00:00:00 I 0 0.3 B_run.sh
132.0 alice 4/30 18:18 0+00:00:00 I 0 0.3 B_run.sh
4 jobs; 0 completed, 0 removed, 3 idle, 1 running, 0 held, 0 suspended
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128.0 alice 4/30 18:08 0+00:46:36 R 0 0.3 condor_dagman
133.0 alice 4/30 18:54 0+00:00:00 I 0 0.3 C_combine.sh
2 jobs; 0 completed, 0 removed, 1 idle, 1 running, 0 held, 0 suspended
$ condor_q
-- Schedd: [Link] : <[Link]:9618?...
OWNER BATCH_NAME SUBMITTED DONE RUN IDLE TOTAL JOB_IDS
alice [Link]+128 4/30 8:08 4 _ 1 6 129.0...133.0
2 jobs; 0 completed, 0 removed, 1 idle, 1 running, 0 held, 0 suspended
$ condor_rm 128
All jobs in cluster 128 have been marked for removal
• Named dag_file.rescue001
• increments if more rescue DAG files are created
• Records which NODES have completed
successfully
• does not contain the actual DAG structure
DAGMan > DAG Monitoring and DAG Removal
DAGMan > The Rescue DAG 129
Rescue Files For Resuming a
Failed DAG
• A rescue file is created when:
– a node fails, and after DAGMan advances
through any other possible nodes
– the DAG is removed from the queue
(or aborted; covered later)
– the DAG is halted and not unhalted
(covered later)
• Resubmission uses the rescue file (if it exists)
when the original DAG file is resubmitted
– override: condor_submit_dag dag_file -f
DAGMan > The Rescue DAG 130
Node Failures Result in DAG
Failure
• If a node JOB fails
(non-zero exit code) A
– DAGMan continues to
run other JOB nodes
until it can no longer
make progress B1 B2 B3 ... BN
• Example at right:
– B2 fails
– Other B* jobs continue
– DAG fails and exits after C
B* and before node C
DAGMan > The Rescue DAG 131
Resolving held node jobs
$ condor_q -nobatch
-- Schedd: [Link] : <[Link]:9618?...
ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
128.0 alice 4/30 18:08 0+00:20:36 R 0 0.3 condor_dagman
130.0 alice 4/30 18:18 0+00:00:00 H 0 0.3 B_run.sh
131.0 alice 4/30 18:18 0+00:00:00 H 0 0.3 B_run.sh
132.0 alice 4/30 18:18 0+00:00:00 H 0 0.3 B_run.sh
4 jobs; 0 completed, 0 removed, 0 idle, 1 running, 3 held, 0 suspended
134
PRE and POST scripts run on the
submit server, as part of the node
[Link]
JOB A [Link] A
SCRIPT POST A [Link] POST script
JOB B1 [Link]
JOB B2 [Link]
JOB B3 [Link]
JOB C [Link] B1 B2 B3 ... BN
SCRIPT PRE C tar_it.sh
PARENT A CHILD B1 B2 B3
PARENT B1 B2 B3 CHILD C
139
Additional Resources
• HTCondor-Users Email List!
[Link]
140
THANK YOU!
141
ADDITIONAL DAGMAN SLIDES
142
Submit File Templates via VARS
• VARS line defines node-specific values that are
passed into submit file variables
VARS node_name var1=“value” [var2=“value”]
• Allows a single submit file shared by all B jobs, rather
than one submit file for each JOB.
[Link] [Link]
JOB B1 [Link] …
VARS B1 data=”B1” opt=“10” InitialDir = $(data)
JOB B2 [Link] arguments = $(data).csv $(opt)
VARS B2 data=“B2” opt=“12” …
JOB B3 [Link] queue
VARS B3 data=“B3” opt=“14”
[Link]
JOB 1 ../[Link]
JOB 2 ../[Link]
PARENT 1 CHILD 2
148
A SUBDAG within a DAG
[Link]
JOB A [Link]
A
SUBDAG EXTERNAL B [Link]
JOB C [Link]
PARENT A CHILD B
PARENT B CHILD C
B1 B2 B3 ... BN
[Link] (written by A)
JOB B1 [Link]
JOB B2 [Link]
…
JOB BN [Link] C
DAGMan Applications > Advanced Features > DAG Within a DAG 149
More on SUBDAG Behavior
• WARNING: SUBDAGs should only be used (over
SPLICES) when absolutely necessary!
– Each SUBDAG EXTERNAL has it’s own DAGMan job
running in the queue.
• SUBDAGs are nodes (can have PRE/POST scripts,
retries, etc.)
• A SUBDAG is not submitted until prior nodes in
the outer DAG have completed.
DAGMan Applications > Advanced Features > DAG Within a DAG 150
Use a SUBDAG to achieve Cyclic
Components within a DAG
• POST script determines whether another iteration is A
necessary; if so, exits non-zero
• RETRY applies to entire SUBDAG, which may include
multiple, sequential nodes
[Link]
JOB A [Link]
SUBDAG EXTERNAL B [Link]
B
SCRIPT POST B [Link]
POST script
RETRY B 1000
RETRY
JOB C [Link]
PARENT A CHILD B
PARENT B CHILD C
C
DAGMan Applications > Advanced Features > DAG Within a DAG 151
DAG-level Control
152
Pause a running DAG with
hold/release
• Hold the DAGMan job process:
condor_hold dagman_jobID
• Pauses the DAG
– No new node jobs submitted
– Queued node jobs continue to run (including
SUBDAGs), but no PRE/POST scripts
– DAGMan jobs remains in the queue until
released (condor_release) or removed
157
Other DAGMan Features:
Node-Level Controls
• Set the PRIORITY of JOB nodes with:
PRIORITY node_name priority_value