130
1 http://www.cs.wisc.edu/condor Using Condor An Introduction ICE 2011

Using Condor An Introduction ICE 2011

  • Upload
    thao

  • View
    32

  • Download
    0

Embed Size (px)

DESCRIPTION

Using Condor An Introduction ICE 2011. The Condor Project (Established ‘85). Distributed High Throughput Computing research performed by a team of ~35 faculty, full time staff and students. Condor is a batch computing System . High Throughput (HTC), Not High Performance (HPC) - PowerPoint PPT Presentation

Citation preview

Page 1: Using Condor  An Introduction ICE 2011

1http://www.cs.wisc.edu/condor

Using Condor An Introduction

ICE 2011

Page 2: Using Condor  An Introduction ICE 2011

2http://www.cs.wisc.edu/condor

The Condor Project (Established ‘85)

Distributed High Throughput Computing research performed by a team of ~35 faculty, full time staff and students.

Page 3: Using Condor  An Introduction ICE 2011

3http://www.cs.wisc.edu/condor

Condor is a batch computing System

› High Throughput (HTC), Not High Performance (HPC)

› Originated from desktop cycle scavanging

Page 4: Using Condor  An Introduction ICE 2011

4http://www.cs.wisc.edu/condor

Cycle Scavanging› Good metaphor even for clusters

which are dedicated

Page 5: Using Condor  An Introduction ICE 2011

5http://www.cs.wisc.edu/condor

Cycles Are Cheap!› Amazon.com EC2: 10 cents/hour› Academic computing: 4 cents/hour› Opportunistic computing: even

cheaper

Page 6: Using Condor  An Introduction ICE 2011

6http://www.cs.wisc.edu/condor

› Total Usage between 2011-07-21 and 2011-07-22 › Group Usage Summary User Hours Pct Demand› -- ------------------------------ ---------- ----- ------ › 1 Physics_Balantekin 6224.8 16.8% 46.4% › 2 ChE_dePablo 5932.3 16.0% 100.0% › 3 Astronomy_Friedman 5764.0 15.5% 0.0% › 4 Economics_Traczynski 4218.4 11.4% 61.1% › 5 Chemistry_Skinner 4186.5 11.3% 45.4% › 6 BMRB 1731.5 4.7% 15.6%› 7 Physics_Petriello 1708.3 4.6% 7.1% › 8 CMS 1494.6 4.0% 31.8% › 9 LMCG 1444.4 3.9% 27.3% › 10 Biochem_Sussman 996.3 2.7% 3.6% › 11 Atlas 847.9 2.3% 79.9% › 12 MSE 812.5 2.2% 2.9%

› --------------------------------- ---------- ------ ------ › TOTAL 37126.7 100.0% 100.0%

Page 7: Using Condor  An Introduction ICE 2011

7http://www.cs.wisc.edu/condor

Page 8: Using Condor  An Introduction ICE 2011

8http://www.cs.wisc.edu/condor

HTC in a nutshell› Work is divided into “jobs”› Cluster of machines is divided into

“machine”

› HTC runs jobs on machines.

Page 9: Using Condor  An Introduction ICE 2011

9http://www.cs.wisc.edu/condor

Condor Tutorial

Page 10: Using Condor  An Introduction ICE 2011

10http://www.cs.wisc.edu/condor

Definitions› Job

The Condor representation of your work

› Machine The Condor representation of

computers and that can perform the work

› Match Making Matching a job with a machine

“Resource”

Page 11: Using Condor  An Introduction ICE 2011

11http://www.cs.wisc.edu/condor

JobJobs state their requirements and

preferences:I need a Linux/x86 platformI need the machine at least 500 MbI prefer a machine with more memory

Page 12: Using Condor  An Introduction ICE 2011

12http://www.cs.wisc.edu/condor

MachineMachines state their requirements

and preferences:Run jobs only when there is no keyboard

activityI prefer to run Frieda’s jobsI am a machine in the econ departmentNever run jobs belonging to Dr. Smith

Page 13: Using Condor  An Introduction ICE 2011

13http://www.cs.wisc.edu/condor

The Magic of Matchmaking

› Jobs and machines state their requirements and preferences

› Condor matches jobs with machinesbased on requirements and

preferences

Page 14: Using Condor  An Introduction ICE 2011

14http://www.cs.wisc.edu/condor

Getting Started:Submitting Jobs to

Condor› Overview: Choose a “Universe” for your job Make your job “batch-ready” Create a submit description file Run condor_submit to put your job in

the queue

Page 15: Using Condor  An Introduction ICE 2011

15http://www.cs.wisc.edu/condor

1. Choose the “Universe”› Controls how Condor handles jobs› Choices include:

Vanilla Standard Grid Java Parallel VM

Page 16: Using Condor  An Introduction ICE 2011

16http://www.cs.wisc.edu/condor

Using the Vanilla Universe

• The Vanilla Universe:– Allows running

almost any “serial” job

– Provides automatic file transfer, etc.

– Like vanilla ice cream• Can be used in just

about any situation

Page 17: Using Condor  An Introduction ICE 2011

17http://www.cs.wisc.edu/condor

2. Make your job batch-ready

Must be able to run in the background

• No interactive input

• No GUI/window clicks

• No music ;^)

Page 18: Using Condor  An Introduction ICE 2011

18http://www.cs.wisc.edu/condor

Make your job batch-ready (continued)…

Job can still use STDIN, STDOUT, and STDERR (the keyboard and the screen), but files are used for these instead of the actual devices

Similar to UNIX (or DOS) shell:•$ ./myprogram <input.txt >output.txt

Page 19: Using Condor  An Introduction ICE 2011

19http://www.cs.wisc.edu/condor

3. Create a Submit Description File

› A plain ASCII text file› Condor does not care about file extensions› Tells Condor about your job:

Which executable, universe, input, output and error files to use, command-line arguments, environment variables, any special requirements or preferences (more on this later)

› Can describe many jobs at once (a “cluster”), each with different input, arguments, output, etc.

Page 20: Using Condor  An Introduction ICE 2011

20http://www.cs.wisc.edu/condor

Simple Submit Description File

# Simple condor_submit input file# (Lines beginning with # are comments)# NOTE: the words on the left side are not# case sensitive, but filenames are!Universe = vanillaExecutable = my_jobOutput = output.txt Queue

Page 21: Using Condor  An Introduction ICE 2011

21http://www.cs.wisc.edu/condor

4. Run condor_submit› You give condor_submit the name

of the submit file you have created: condor_submit my_job.submit

› condor_submit: Parses the submit file, checks for

errors Creates a “ClassAd” that describes

your job(s) Puts job(s) in the Job Queue

Page 22: Using Condor  An Introduction ICE 2011

22http://www.cs.wisc.edu/condor

The Job Queue› condor_submit sends your job’s

ClassAd(s) to the schedd› The schedd (more details later):

Manages the local job queue Stores the job in the job queue

• Atomic operation, two-phase commit• “Like money in the bank”

› View the queue with condor_q

Page 23: Using Condor  An Introduction ICE 2011

23http://www.cs.wisc.edu/condor

Examplecondor_submit and

condor_q% condor_submit my_job.submitSubmitting job(s).1 job(s) submitted to cluster 1.

% condor_q

-- Submitter: perdita.cs.wisc.edu : <128.105.165.34:1027> : ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD

1.0 frieda 6/16 06:52 0+00:00:00 I 0 0.0 my_job

1 jobs; 1 idle, 0 running, 0 held

%

Page 24: Using Condor  An Introduction ICE 2011

24http://www.cs.wisc.edu/condor

Input, output & error files› Controlled by submit file settings

› You can define the job’s standard input, standard output and standard error: Read job’s standard input from “input_file”:

• Input = input_file• Shell equivalent: program <input_file

Write job’s standard ouput to “output_file”:• Output = output_file• Shell equivalent: program >output_file

Write job’s standard error to “error_file”:• Error = error_file• Shell equivalent: program 2>error_file

Page 25: Using Condor  An Introduction ICE 2011

25http://www.cs.wisc.edu/condor

Email about your job• Condor sends email about job

events to the submitting user• Specify “notification” in your

submit file to control which events:

Notification = completeNotification = neverNotification = errorNotification = always

Default

Page 26: Using Condor  An Introduction ICE 2011

26http://www.cs.wisc.edu/condor

Feedback on your job› Create a log of job events› Add to submit description file:

log = sim.log

› Becomes the Life Story of a Job Shows all events in the life of a job Always have a log file

Page 27: Using Condor  An Introduction ICE 2011

27http://www.cs.wisc.edu/condor

Sample Condor User Log

000 (0001.000.000) 05/25 19:10:03 Job submitted from host: <128.105.146.14:1816>...001 (0001.000.000) 05/25 19:12:17 Job executing on host: <128.105.146.14:1026>...005 (0001.000.000) 05/25 19:13:06 Job terminated.

(1) Normal termination (return value 0)...

Page 28: Using Condor  An Introduction ICE 2011

28http://www.cs.wisc.edu/condor

Example Submit Description File With

Logging# Example condor_submit input file# (Lines beginning with # are comments)# NOTE: the words on the left side are not# case sensitive, but filenames are!Universe = vanillaExecutable = /home/frieda/condor/my_job.condorLog = my_job.log ·Job log (from Condor)Input = my_job.in ·Program’s standard inputOutput = my_job.out ·Program’s standard outputError = my_job.err ·Program’s standard errorArguments = -a1 -a2 ·Command line argumentsInitialDir = /home/frieda/condor/runQueue

Page 29: Using Condor  An Introduction ICE 2011

29http://www.cs.wisc.edu/condor

Let’s run a job› First, need a terminal emulator

http://www.putty.org• (or similar)

› Login to chopin.cs.wisc.edu as cguserXX, and the given password

Page 30: Using Condor  An Introduction ICE 2011

30http://www.cs.wisc.edu/condor

Logged In?source /scratch/setup.shmkdir /scratch/your_namecd /scratch/your_name

› condor_q› condor_status

Page 31: Using Condor  An Introduction ICE 2011

31http://www.cs.wisc.edu/condor

Create submit file› nano submit.your_initials

• universe = vanilla• executable = /bin/echo• Arguments = hello world• Should_transfer_files = yes• When_to_transfer_output = on_exit• Output = out• Log = log• queue

Page 32: Using Condor  An Introduction ICE 2011

32http://www.cs.wisc.edu/condor

And submit it…› condor_submit submit.your_initials

› (wait… remember the HTC bit?)

› Condor_q xx› cat output

Page 33: Using Condor  An Introduction ICE 2011

33http://www.cs.wisc.edu/condor

A matlab example› #!/s/std/bin/octave –qf

› printf “Hello World\n”;

› Save as Hello.o› Chmod 0755 Hello.o› ./Hello.o

Page 34: Using Condor  An Introduction ICE 2011

34http://www.cs.wisc.edu/condor

submit file› nano submit.your_initials

• universe = vanilla• executable = Hello.o• Should_transfer_files = yes• When_to_transfer_output = on_exit• Output = out• Log = log• queue

Page 35: Using Condor  An Introduction ICE 2011

35http://www.cs.wisc.edu/condor

“Clusters” and “Processes”› If your submit file describes multiple jobs, we call

this a “cluster”› Each cluster has a unique “cluster number”› Each job in a cluster is called a “process”

Process numbers always start at zero› A Condor “Job ID” is the cluster number, a period,

and the process number (i.e. 2.1) A cluster can have a single process

• Job ID = 20.0 ·Cluster 20, process 0 Or, a cluster can have more than one process

• Job ID: 21.0, 21.1, 21.2 ·Cluster 21, process 0, 1, 2

Page 36: Using Condor  An Introduction ICE 2011

36http://www.cs.wisc.edu/condor

Submit File for a Cluster# Example submit file for a cluster of 2 jobs

# with separate input, output, error and log filesUniverse = vanillaExecutable = my_jobArguments = -x 0log = my_job_0.logInput = my_job_0.inOutput = my_job_0.outError = my_job_0.errQueue ·Job 2.0 (cluster 2, process 0)Arguments = -x 1log = my_job_1.logInput = my_job_1.inOutput = my_job_1.outError = my_job_1.errQueue ·Job 2.1 (cluster 2, process 1)

Page 37: Using Condor  An Introduction ICE 2011

37http://www.cs.wisc.edu/condor

% condor_submit my_job.submit-file

Submitting job(s).

2 job(s) submitted to cluster 2.% condor_q-- Submitter: perdita.cs.wisc.edu : <128.105.165.34:1027> :

ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD 1.0 frieda 4/15 06:52 0+00:02:11 R 0 0.0 my_job –a1 –a2

2.0 frieda 4/15 06:56 0+00:00:00 I 0 0.0 my_job –x 0 2.1 frieda 4/15 06:56 0+00:00:00 I 0 0.0 my_job –x 13 jobs; 2 idle, 1 running, 0 held

%

Submitting The Job

Page 38: Using Condor  An Introduction ICE 2011

38http://www.cs.wisc.edu/condor

Organize your files and directories for big runs

› Create subdirectories for each “run” run_0, run_1, … run_599

› Create input files in each of these run_0/simulation.in run_1/simulation.in … run_599/simulation.in

› The output, error & log files for each job will be created by Condor from your job’s output

Page 39: Using Condor  An Introduction ICE 2011

39http://www.cs.wisc.edu/condor

Submit Description File for 600 Jobs

# Cluster of 600 jobs with different directoriesUniverse = vanillaExecutable = simLog = simulation.log...Arguments = -x 0InitialDir = run_0 ·Log, input, output & error files -> run_0Queue ·Job 3.0 (Cluster 3, Process 0)

Arguments = -x 1InitialDir = run_1 ·Log, input, output & error files -> run_1Queue ·Job 3.1 (Cluster 3, Process 1)

·Do this 598 more times…………

Page 40: Using Condor  An Introduction ICE 2011

40http://www.cs.wisc.edu/condor

Submit File for a Big Cluster of Jobs

› We just submitted 1 cluster with 600 processes

› All the input/output files will be in different directories

› The submit file is pretty unwieldy (over 1200 lines)

› Isn’t there a better way?

Page 41: Using Condor  An Introduction ICE 2011

41http://www.cs.wisc.edu/condor

Submit File for a Big Cluster of Jobs (the better

way) #1› We can queue all 600 in 1 “Queue” command Queue 600

› Condor provides $(Process) and $(Cluster) $(Process) will be expanded to the

process number for each job in the cluster• 0, 1, … 599

$(Cluster) will be expanded to the cluster number• Will be 4 for all jobs in this cluster

Page 42: Using Condor  An Introduction ICE 2011

42http://www.cs.wisc.edu/condor

Submit File for a Big Cluster of Jobs (the better

way) #2› The initial directory for each job can

be specified using $(Process) InitialDir = run_$(Process) Condor will expand these to “run_0”,

“run_1”, … “run_599” directories› Similarly, arguments can be variable

Arguments = -x $(Process) Condor will expand these to “-x 0”, “-x 1”, … “-x 599”

Page 43: Using Condor  An Introduction ICE 2011

43http://www.cs.wisc.edu/condor

Better Submit File for 600 Jobs

# Example condor_submit input file that defines# a cluster of 600 jobs with different directoriesUniverse = vanillaExecutable = my_jobLog = my_job.logInput = my_job.inOutput = my_job.outError = my_job.errArguments = –x $(Process) ·–x 0, -x 1, … -x 599InitialDir = run_$(Process) ·run_0 … run_599Queue 600 ·Jobs 4.0 … 4.599

Page 44: Using Condor  An Introduction ICE 2011

44http://www.cs.wisc.edu/condor

Now, we submit it…$ condor_submit my_job.submitSubmitting

job(s) ...............................................................................................................................................................................................................................................................

Logging submit event(s) ...............................................................................................................................................................................................................................................................

600 job(s) submitted to cluster 4.

Page 45: Using Condor  An Introduction ICE 2011

45http://www.cs.wisc.edu/condor

And, Check the queue$ condor_q-- Submitter: x.cs.wisc.edu : <128.105.121.53:510> : x.cs.wisc.eduID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD4.0 frieda 4/20 12:08 0+00:00:05 R 0 9.8 my_job -arg1 –x 04.1 frieda 4/20 12:08 0+00:00:03 I 0 9.8 my_job -arg1 –x 14.2 frieda 4/20 12:08 0+00:00:01 I 0 9.8 my_job -arg1 –x 24.3 frieda 4/20 12:08 0+00:00:00 I 0 9.8 my_job -arg1 –x 3...4.598 frieda 4/20 12:08 0+00:00:00 I 0 9.8 my_job -arg1 –x 5984.599 frieda 4/20 12:08 0+00:00:00 I 0 9.8 my_job -arg1 –x 599

600 jobs; 599 idle, 1 running, 0 held

Page 46: Using Condor  An Introduction ICE 2011

46http://www.cs.wisc.edu/condor

Removing jobs› If you want to remove a job from

the Condor queue, you use condor_rm

› You can only remove jobs that you own

› Privileged user can remove any jobs “root” on UNIX “administrator” on Windows

Page 47: Using Condor  An Introduction ICE 2011

47http://www.cs.wisc.edu/condor

Removing jobs (continued)

› Remove an entire cluster: condor_rm 4 ·Removes the whole

cluster

› Remove a specific job from a cluster: condor_rm 4.0 ·Removes a single job

› Or, remove all of your jobs with “-a” condor_rm -a ·Removes all jobs /

clusters

Page 48: Using Condor  An Introduction ICE 2011

48http://www.cs.wisc.edu/condor

Submit cluster of 10 jobs

› nano submit• universe = vanilla• executable = /bin/echo• Should_transfer_files = yes• When_to_transfer_output = on_exit• Arguments = hello world $(PROCESS)• Output = out.$(PROCESS)• Log = log• Queue 10

Page 49: Using Condor  An Introduction ICE 2011

49http://www.cs.wisc.edu/condor

And submit it…› condor_submit submit

› (wait…)› Condor_q xx› cat log› cat output.yy

Page 50: Using Condor  An Introduction ICE 2011

50http://www.cs.wisc.edu/condor

My new jobs run for 20 days…

› What happens when a job is forced off it’s CPU? Preempted by higher priority

user or job Vacated because of user

activity› How can I add fault

tolerance to my jobs?

Page 51: Using Condor  An Introduction ICE 2011

51http://www.cs.wisc.edu/condor

Condor’s Standard Universe to the rescue!› Support for transparent process

checkpoint and restart› Remote system calls (remote

I/O)Your job can read / write files as if they were local

Page 52: Using Condor  An Introduction ICE 2011

52http://www.cs.wisc.edu/condor

Remote System Calls inthe Standard Universe

› I/O system calls are trapped and sent back to the submit machineExamples: open a file, write to a file

› No source code changes typically required

› Programming language independent

Page 53: Using Condor  An Introduction ICE 2011

53http://www.cs.wisc.edu/condor

Process Checkpointing in the

Standard Universe› Condor’s process checkpointing provides a mechanism to automatically save the state of a job

› The process can then be restarted from right where it was checkpointed After preemption, crash, etc.

Page 54: Using Condor  An Introduction ICE 2011

54http://www.cs.wisc.edu/condor

Checkpointing:Process Starts

checkpoint: the entire state of a program, saved in a file CPU registers, memory image, I/O

time

Page 55: Using Condor  An Introduction ICE 2011

55http://www.cs.wisc.edu/condor

Checkpointing:Process Checkpointed

time

1 2 3

Page 56: Using Condor  An Introduction ICE 2011

56http://www.cs.wisc.edu/condor

Checkpointing:Process Killed

time

3

3

Killed!

Page 57: Using Condor  An Introduction ICE 2011

57http://www.cs.wisc.edu/condor

Checkpointing:Process Resumed

time

3

3

goodput badput goodput

Page 58: Using Condor  An Introduction ICE 2011

58http://www.cs.wisc.edu/condor

When will Condor checkpoint your job?

› Periodically, if desired For fault tolerance

› When your job is preempted by a higher priority job

› When your job is vacated because the execution machine becomes busy

› When you explicitly run condor_checkpoint, condor_vacate, condor_off or condor_restart command

Page 59: Using Condor  An Introduction ICE 2011

59http://www.cs.wisc.edu/condor

Making the Standard Universe Work

› The job must be relinked with Condor’s standard universe support library

› To relink, place condor_compile in front of the command used to link the job:% condor_compile gcc -o myjob myjob.c

- OR -% condor_compile f77 -o myjob filea.f fileb.f

- OR -% condor_compile make –f MyMakefile

Page 60: Using Condor  An Introduction ICE 2011

60http://www.cs.wisc.edu/condor

Limitations of the Standard Universe

› Condor’s checkpointing is not at the kernel level. Standard Universe the job may not:

• Fork()• Use kernel threads• Use some forms of IPC, such as pipes and shared

memory› Must have access to source code to

relink› Many typical scientific jobs are OK

Page 61: Using Condor  An Introduction ICE 2011

61http://www.cs.wisc.edu/condor

Submitting Std uni job› #include <stdio.h>› int main(int argc, char **argv) {› int i;

for(i = 0 ; i < 10000000; i++) {}

› }

Page 62: Using Condor  An Introduction ICE 2011

62http://www.cs.wisc.edu/condor

And submit…› condor_compile gcc –o foo foo.c

-- Change "vanilla" to "standard" -- Change "/bin/echo" to "foo" (or

above)

Page 63: Using Condor  An Introduction ICE 2011

63http://www.cs.wisc.edu/condor

My jobs have have dependencies…

Can Condor help solve my dependency problems?

Page 64: Using Condor  An Introduction ICE 2011

64http://www.cs.wisc.edu/condor

Condor Universes:Scheduler and Local

› Scheduler Universe Plug in a meta-scheduler Developed for DAGMan (more later) Similar to Globus’s fork job manager

› Local Very similar to vanilla, but jobs run on

the local host Has more control over jobs than

scheduler universe

Page 65: Using Condor  An Introduction ICE 2011

65http://www.cs.wisc.edu/condor

DAGMan› Directed Acyclic Graph

Manager› DAGMan allows you to specify the

dependencies between your Condor jobs, so it can manage them automatically for you.

› (e.g., “Don’t run job “B” until job “A” has completed successfully.”)

Page 66: Using Condor  An Introduction ICE 2011

66http://www.cs.wisc.edu/condor

What is a DAG?› A DAG is the data structure

used by DAGMan to represent these dependencies.

› Each job is a “node” in the DAG.

› Each node can have any number of “parent” or “children” nodes – as long as there are no loops!

Job A

Job B

Job C

Job D

Page 67: Using Condor  An Introduction ICE 2011

67http://www.cs.wisc.edu/condor

Defining a DAG› A DAG is defined by a .dag file, listing each of

its nodes and their dependencies:# diamond.dagJob A a.subJob B b.subJob C c.subJob D d.subParent A Child B CParent B C Child D

› each node will run the Condor job specified by its accompanying Condor submit file

Job A

Job B Job C

Job D

Page 68: Using Condor  An Introduction ICE 2011

68http://www.cs.wisc.edu/condor

Submitting a DAG› To start your DAG, just run condor_submit_dag with your .dag file, and Condor will start a personal DAGMan daemon which to begin running your jobs:% condor_submit_dag diamond.dag

› condor_submit_dag is run by the schedd DAGMan daemon itself is “watched” by

Condor, so you don’t have to

Page 69: Using Condor  An Introduction ICE 2011

69http://www.cs.wisc.edu/condor

DAGMan

Running a DAG› DAGMan acts as a “meta-scheduler”,

managing the submission of your jobs to Condor based on the DAG dependencies.

CondorJobQueue

B C

D

A

A.dagFile

Page 70: Using Condor  An Introduction ICE 2011

70http://www.cs.wisc.edu/condor

DAGMan

Running a DAG (cont’d)› DAGMan holds & submits jobs to the

Condor queue at the appropriate times.

CondorJobQueue D

B

C

B

A

C

Page 71: Using Condor  An Introduction ICE 2011

71http://www.cs.wisc.edu/condor

Running a DAG (cont’d)› In case of a job failure, DAGMan continues until

it can no longer make progress, and then creates a “rescue” file with the current state of the DAG.

CondorJobQueue DAGMan

X

D

A

BRescue

File

Page 72: Using Condor  An Introduction ICE 2011

72http://www.cs.wisc.edu/condor

Recovering a DAG› Once the failed job is ready to be re-run,

the rescue file can be used to restore the prior state of the DAG.

CondorJobQueue

RescueFile

CDAGMan D

A

B C

Page 73: Using Condor  An Introduction ICE 2011

73http://www.cs.wisc.edu/condor

DAGMan

Recovering a DAG (cont’d)

› Once that job completes, DAGMan will continue the DAG as if the failure never happened.

CondorJobQueue

C

D

A

B

D

Page 74: Using Condor  An Introduction ICE 2011

74http://www.cs.wisc.edu/condor

DAGMan

Finishing a DAG› Once the DAG is complete, the DAGMan

job itself is finished, and exits.

CondorJobQueue

C

D

A

B

Page 75: Using Condor  An Introduction ICE 2011

75http://www.cs.wisc.edu/condor

Additional DAGMan Features

› Provides other handy features for job management… nodes can have PRE & POST scripts failed nodes can be automatically re-

tried a configurable number of times job submission can be “throttled”

Page 76: Using Condor  An Introduction ICE 2011

76http://www.cs.wisc.edu/condor

What about Licensed Jobs?

› e.g. matlab Site license? matlab compiler Octave

Page 77: Using Condor  An Introduction ICE 2011

77http://www.cs.wisc.edu/condor

Chirp› condor_chirp get_file remote local

› condor_chirp put_file local remote

Page 78: Using Condor  An Introduction ICE 2011

78http://www.cs.wisc.edu/condor

General User Commands› condor_status View Pool Status

› condor_q View Job Queue› condor_submit Submit new Jobs› condor_rm Remove Jobs› condor_prio Intra-User Prios› condor_history Completed Job Info› condor_submit_dag Submit new DAG› condor_checkpoint Force a checkpoint› condor_compile Link Condor library

Page 79: Using Condor  An Introduction ICE 2011

79http://www.cs.wisc.edu/condor

Statistical Bootstrap› Build up from the worker side out› The matlab/octave worker:› worker.m:

#!/s/octave/bin/octave -qload "subset" subset;subset = subset(floor(rand(10,1) .* 1000));

printf("%f ", mean(subset));

Page 80: Using Condor  An Introduction ICE 2011

80http://www.cs.wisc.edu/condor

Run the worker alone› (won’t work – why?)› chmod 0755 worker.m› ./worker.m

Page 81: Using Condor  An Introduction ICE 2011

81http://www.cs.wisc.edu/condor

Create the initial datadriver.m

#!/s/octave/bin/octave –qfdist_size = 100000;d = rand(dist_size, 1) .* 500;subset = d(floor(rand(1000,1) .*

100000));save "subset" subset;

Page 82: Using Condor  An Introduction ICE 2011

82http://www.cs.wisc.edu/condor

Submit fileuniverse = vanillaexecutable = worker.mshould_transfer_files = truewhen_to_transfer_output = on_exittransfer_input_files = subsetoutput = mean.$(PROCESS)error = foolog = logqueue 10

Page 83: Using Condor  An Introduction ICE 2011

83http://www.cs.wisc.edu/condor

And submit the job…› condor_submit submit

Page 84: Using Condor  An Introduction ICE 2011

84http://www.cs.wisc.edu/condor

Add the submission tothe driver script…

#!/s/octave/bin/octave –qfdist_size = 100000;d = rand(dist_size, 1) .* 500;subset = d(floor(rand(1000,1) .* 100000));save "subset" subset;system("condor_submit submit");system("condor_wait log");

Page 85: Using Condor  An Introduction ICE 2011

85http://www.cs.wisc.edu/condor

And run the driver!› ./driver.m

Page 86: Using Condor  An Introduction ICE 2011

86http://www.cs.wisc.edu/condor

Master – Worker:Many very short jobs

› Condor doesn’t run short jobs well.› time needed to transmit the executable/data/results.› Condor doesn’t deal directly with parallel algorithms.› Can have the process on the user’s workstation generating› waves of “worker” jobs to run in parallel, but› each worker job must be scheduled anew in the Condor› pool, and› the master application has to handle all the details of› scheduling, rescheduling after faults, managing input and› outputs to workers, etc.› Master-Worker (MW) addresses these issues!

Page 87: Using Condor  An Introduction ICE 2011

87http://www.cs.wisc.edu/condor

Master – Worker:› Master assigns tasks to the workers› Workers perform tasks, and report

results back to master› Workers do not communicate

(except through the master)› Simple!› Fault-tolerant› Dynamic› Programming model reusable

across many applications.

Page 88: Using Condor  An Introduction ICE 2011

88http://www.cs.wisc.edu/condor

Master – Worker:

› Data common to all tasks is sent to workers only once

› (Try to) Retain workers until the whole computation is

› complete—don’t release them after a single task is done.

› These features make for much higher parallel efficiency.

› We now need to transmit much less data between master

› and workers.› We avoid the overhead of putting each task on the

condor› queue and waiting for it to be allocated to a

processor.

Page 89: Using Condor  An Introduction ICE 2011

89http://www.cs.wisc.edu/condor

› Three abstractions in the master-worker paradigm: Master,Worker, and Task.

› The MW package encapsulates these abstractions› C++ abstract classes› User writes 10 functions (Templates and skeletons supplied› in distribution)› The MWized code will adapt transparently to the dynamic› and heterogeneous environment› The back side of MW interfaces to resource management

Page 90: Using Condor  An Introduction ICE 2011

90http://www.cs.wisc.edu/condor

MW FunctionsMWMaster

get_userinfo()setup_initial_tasks()

› pack_worker_init_data()› act_on_completed_task()MWTask› (un)pack_work› (un)pack_result]MWWorker› unpack_worker_init_data()› execute_task()

Page 91: Using Condor  An Introduction ICE 2011

91http://www.cs.wisc.edu/condor

But Wait, there’s more..› User-defined checkpointing of master. (Don’t lose the whole run

if the master crashes.)› (Rudimentary) Task Scheduling› MW assigns first task to first idle worker› Lists of tasks and workers can be arbitrarily ordered and

reordered› User can set task rescheduling policies› User-defined benchmarking› A (user-defined) task is sent to each worker upon initialization› By accumulating normalized task CPU time, MW computes› a performance statistic that is comparable between runs,› though the properties of the pool may differ between runs.

Page 92: Using Condor  An Introduction ICE 2011

92http://www.cs.wisc.edu/condor

There’s an App for that..› MWFATCOP (Chen, Ferris, Linderoth) – A branch and cut code

› for linear integer programming› MWQAP (Anstreicher, Brixius, Goux, Linderoth) – A› branch-and-bound code for solving the quadratic assignment

problem› MWATR (Linderoth, Shapiro, Wright) – A trust-region-enhanced› cutting plane code for two-stage linear stochastic programming› and statistical verification of solution quality.› MWKNAP (Glankwamdee, Linderoth) – A simple branch-and-

bound knapsack solver› MWAND (Linderoth, Shen) – A nested decomposition-based› solver for multistage stochastic linear programming› MWSYMCOP (Linderoth, Margot, Thain) – An LP-based› branch-and-bound solver for symmetric integer programs

Page 93: Using Condor  An Introduction ICE 2011

93http://www.cs.wisc.edu/condor

Other frameworks› CCTools group at Notre Dame

All Pairs WaveFront Makeflow

Page 94: Using Condor  An Introduction ICE 2011

94http://www.cs.wisc.edu/condor

Condor and Big Data› Big Data driving web development› Web developments driving Big Data

› Big Data: Definition

› Like Condor for disks

Page 95: Using Condor  An Introduction ICE 2011

95http://www.cs.wisc.edu/condor

In 2003…

http://labs.google.com/papers/gfs.html

http://labs.google.com/papers/mapreduce.html

Page 96: Using Condor  An Introduction ICE 2011

96http://www.cs.wisc.edu/condor

Page 97: Using Condor  An Introduction ICE 2011

97http://www.cs.wisc.edu/condor

Page 98: Using Condor  An Introduction ICE 2011

98http://www.cs.wisc.edu/condor

Shortly thereafter…

Page 99: Using Condor  An Introduction ICE 2011

99http://www.cs.wisc.edu/condor

Two main Hadoop parts

Page 100: Using Condor  An Introduction ICE 2011

100http://www.cs.wisc.edu/condor

For more detailCondorWeek 2009 talk

Dhruba Borthakur

http://www.cs.wisc.edu/condor/CondorWeek2009/condor_presentations/borthakur-hadoop_univ_research.ppt

Page 101: Using Condor  An Introduction ICE 2011

101http://www.cs.wisc.edu/condor

Page 102: Using Condor  An Introduction ICE 2011

102http://www.cs.wisc.edu/condor

HDFS overview› Making POSIX distributed file

system go fast is easy…

Page 103: Using Condor  An Introduction ICE 2011

103http://www.cs.wisc.edu/condor

HDFS overview› …If you get rid of the POSIX part› Remove

Random access Support for small files authentication In-kernel support

Page 104: Using Condor  An Introduction ICE 2011

104http://www.cs.wisc.edu/condor

HDFS Overview› Add in

Data replication • (key for distributed systems)

Command line utilities

Page 105: Using Condor  An Introduction ICE 2011

105http://www.cs.wisc.edu/condor

HDFS Architecture

Page 106: Using Condor  An Introduction ICE 2011

106http://www.cs.wisc.edu/condor

HDFS Condor Integration

› HDFS Daemons run under master Management/control

› Input/Output files can be in hdfs:› Input = hdfs://some/pathname

Page 107: Using Condor  An Introduction ICE 2011

107http://www.cs.wisc.edu/condor

Parallel convergence checking:

Another DAGman example› Evaluating a function at many

points

› Check for convergence -> retry

› Particle Swarm Optimization

Page 108: Using Condor  An Introduction ICE 2011

108http://www.cs.wisc.edu/condor

Prepare

Compute Compute Compute Compute

Converge?

Done

Yes!No

Page 109: Using Condor  An Introduction ICE 2011

109http://www.cs.wisc.edu/condor

Any Guesses?› Who has thoughts?

› Best to work from “inside out”

109

Page 110: Using Condor  An Introduction ICE 2011

110http://www.cs.wisc.edu/condor

The job itself.#!/bin/sh###### random.sh

echo $RANDOMexit 0

110

Page 111: Using Condor  An Introduction ICE 2011

111http://www.cs.wisc.edu/condor

The submit file› Any guesses?

111

Page 112: Using Condor  An Introduction ICE 2011

112http://www.cs.wisc.edu/condor

The submit file# submitRandomuniverse = vanillaexecutable = random.shShould_transfer_files = yesWhen_to_transfer_output = on_exitoutput = outlog = logqueue

112

Page 113: Using Condor  An Introduction ICE 2011

113http://www.cs.wisc.edu/condor

Next step: the inner DAG

113

First Last Node

Node0

Node1 Node2 Node3 Node4

Node11

Page 114: Using Condor  An Introduction ICE 2011

114http://www.cs.wisc.edu/condor

The DAG file› Any guesses?

114

Page 115: Using Condor  An Introduction ICE 2011

115http://www.cs.wisc.edu/condor

The inner DAG fileJob Node0 submitRandomJob Node1 submitRandomJob Node2 submitRandomJob Node3 submitRandomPARENT Node0 CHILD Node1PARENT Node0 CHILD Node2PARENT Node0 CHILD Node3Job Node11 submitRandomPARENT Node1, Node2, Node3 CHILD Node11

115

Page 116: Using Condor  An Introduction ICE 2011

116http://www.cs.wisc.edu/condor

Inner DAG› Does this work?

› At least one iteration?

116

Page 117: Using Condor  An Introduction ICE 2011

117http://www.cs.wisc.edu/condor

How to iterate› DAGman has simple control

structures (Makes it reliable)

› SUBDAGs!› Remember what happens if post

fails?117

Page 118: Using Condor  An Introduction ICE 2011

118http://www.cs.wisc.edu/condor

The Outer Dag› Another Degenerate Dag

(But Useful!)

118

Post Script (with exit value)

SubDag (with retry)t

Page 119: Using Condor  An Introduction ICE 2011

119http://www.cs.wisc.edu/condor

This one is easy!› Can you do it yourself?

119

Page 120: Using Condor  An Introduction ICE 2011

120http://www.cs.wisc.edu/condor

The outer DAG file####### Outer.dag #############SUBDAG EXTERNAL A inner.dagSCRIPT POST A converge.shRETRY A 10#### converge.sh could look like

#!/bin/sh

echo "Checking convergence" >> convergeexit 1

120

Page 121: Using Condor  An Introduction ICE 2011

121http://www.cs.wisc.edu/condor

Let’s run that…› condor_submit_dag outer.dag

› Does it work? How can you tell?

121

Page 122: Using Condor  An Introduction ICE 2011

122http://www.cs.wisc.edu/condor

DAGman a bit verbose…$ condor_submit_dag outer.dag

-----------------------------------------------------------------------

File for submitting this DAG to Condor : submit.dag.condor.sub

Log of DAGMan debugging messages : submit.dag.dagman.out

Log of Condor library output : submit.dag.lib.out

Log of Condor library error messages : submit.dag.lib.err

Log of the life of condor_dagman itself : submit.dag.dagman.log

-no_submit given, not submitting DAG to Condor. You can do this with:

"condor_submit submit.dag.condor.sub"

-----------------------------------------------------------------------

-----------------------------------------------------------------------

File for submitting this DAG to Condor : outer.dag.condor.sub

Log of DAGMan debugging messages : outer.dag.dagman.out

Log of Condor library output : outer.dag.lib.out

Log of Condor library error messages : outer.dag.lib.err

Log of the life of condor_dagman itself : outer.dag.dagman.log

Submitting job(s).

Logging submit event(s).

1 job(s) submitted to cluster 721.

-----------------------------------------------------------------------

122

Page 123: Using Condor  An Introduction ICE 2011

123http://www.cs.wisc.edu/condor

Debugging helps› Look in the user log file, “log”

› Look in the DAGman debugging log

› “foo”.dagman.out

123

Page 124: Using Condor  An Introduction ICE 2011

124http://www.cs.wisc.edu/condor

What does converge.sh need

› Note the output files?

› How to make them unique?

› Add DAG variables to inner dag And submitRandom file

124

Page 125: Using Condor  An Introduction ICE 2011

125http://www.cs.wisc.edu/condor

The submit file (again)# submitRandomuniverse = vanillaexecutable = random.shoutput = outlog = logqueue

125

Page 126: Using Condor  An Introduction ICE 2011

126http://www.cs.wisc.edu/condor

The submit file# submitRandomuniverse = vanillaexecutable = random.shoutput = out.$(NodeNumber)log = logqueue

126

Page 127: Using Condor  An Introduction ICE 2011

127http://www.cs.wisc.edu/condor

The inner DAG file (again)

Job Node0 submit_preJob Node1 submitRandomJob Node2 submitRandomJob Node3 submitRandomPARENT Node0 CHILD Node1PARENT Node0 CHILD Node2PARENT Node0 CHILD Node3Job Node11 submit_postPARENT Node1 CHILD Node11PARENT Node2 CHILD Node11PARENT Node3 CHILD Node11

127

Page 128: Using Condor  An Introduction ICE 2011

128http://www.cs.wisc.edu/condor

The inner DAG file (again)

Job Node0 submit_preJob Node1 submitRandomJob Node2 submitRandomJob Node3 submitRandom…VARS Node1 NodeNumber=“1”VARS Node2 NodeNumber=“2”VARS Node3 NodeNumber=“3”…

128

Page 129: Using Condor  An Introduction ICE 2011

129http://www.cs.wisc.edu/condor

Then converge.sh sees:$ ls out.*out.1 out.10 out.2 out.3 out.4 out.5 out.6 out.7 out.8 out.9

$

› And can act accordingly…

129

Page 130: Using Condor  An Introduction ICE 2011

130http://www.cs.wisc.edu/condor

Thank you!Check us out on the Web:

http://www.condorproject.org

Email:[email protected]