Classad Tutorial Greg Thain Classads 3 uses Description
- Slides: 71
Classad Tutorial Greg Thain
Classads: 3 uses Description of entities in Condor describes machines, jobs, services Query language to select entities in Condor “show me all the busy machines” “show me idle jobs needing > 32 Gb ram” 2 way matching Given jobs & machines, find matches 2
Classads describe all Entities › › › Jobs Machines Users Accounting Etc. 3
Sometimes behind the scenes… “Send m e all my $ jobs as c lassads” condor_q “ Here ’s c jobs No options, so 95, 96 lassads fo r , 98 a pretty-print nd 99 ” ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD 95 96 98 99 gthain 4/25 14: 31 0+00: 00: 11 0+00: 00 R R R I 0 0 0. 0 calculate Job 1 Job 2 Job 3 Job Scheduler (schedd)
Sometimes behind the scenes… “Send m e all $condor_s machine s as tatus cleassads “H re’s ” mach class No options, soads” ine s lot pretty-print Name Op. Sys Arch State s 1@c s 2@c s 3@c LINUX X 86_64 Claimed Activit Mem Busy 2048 Actvty. Time 0+00: 30: 23 Classad databa (collector)
Other times, explicitly… › “In addition to the usual stuff, add to the machine description classad the following site-specific information…”
Classads$ Describe all entities condor_q –l Entity How to display full classad Active Jobs Terminated Jobs $ condor_history –l Machines (slots) $ condor_status –l Finished jobs on machine $ condor_history –l –file $(condor_config_val STARTD_HISTORY) Active submitters $ condor_status -submitter -l Accounting records $ condor_userprio -l Schedd service $ condor_status –schedd -l All services $ condor_status –any 7 -l
Classads as Job Description Set of Attributes Attribute: Key = Value Key is a name Value has a type $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 8
Classads as Job Description Units by context Seconds Kilobytes $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 9
Manual lists all* attributes http: //htcondor. readthedocs. io Appendix: Lists all HTCondor-defined attributes And Units (if any) and how used *Admins and users can add their own!** **(Classads was No-SQL before it was cool) 10
11
Attribute Names (before the =) Attribute. Name = Attribute. Value › Are like “C” (Python, R, Matlab…) identifiers h. Must start with letter, then letters, numbers, _ h. No limit on length, but be reasonable h. Case insensitive, but Camel. Case is traditional 12
Attribute Values (after the =) Attribute. Name = Attribute. Value › Are like “C” (Python, R, Matlab…) identifiers h. Must start with letter, then letters, numbers, _ h. No limit on length, but be reasonable h. Case insensitive, but Camel. Case is traditional 13
Main Class. Ad types Type Boolean Integers Reals Strings Reference Description true, false 64 bit signed 64 bit IEEE 754 Double "quoted" Lookup another attribute 14
Booleans can be htrue hfalse Case-insensitive h(True, TRUE) Note – NO QUOTES $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 15
Class. Ad Integers 64 bit h Even on 32 bit binaries Always signed Overflow -> wrap quietly $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 16
Class. Ad Reals › IEEE 64 bit h And all the oddities › Scientific Notation h -5. 6 e-5 › Overflow -> Infinity › 1 e 990 -> real("INF") › Na. Ns -> real("Nan") $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 17
Class. Ad Strings Must be quoted with " Escape with backslash: "foo"bar" No Other Escapes! Hard to get newlines in strings $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 18
Class. Ad References › Like variable lookup › What is Request. Disk? › Lookup Disk. Usage › Return 100 $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = false QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 19
Undefined › Very Important to Grok › Anything can be › › › $ condor_q –l 180. 0 Cluster. Id = 180 undefined Cmd = "sleep" Like null in SQL Disk. Usage = 100 Exit. By. Signal = undefined Rarely explicit h Exit. By. Signal -> undefined QDate = 1535384632 Missing. Attr -> undefined Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage Means “Don’t Know” … (many attributes removed) Could mean “missing” 20
More Undefined › Allows decisions when › information missing Context determines trueness or falseness: *Missing vs undefined* No difference! $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = undefined QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 21
More Undefined › What does missing $ condor_q –l 180. 0 Exit. By. Signal mean? Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Neither true nor false Exit. By. Signal = undefined QDate = 1535384632 Job hasn’t exited (yet)? Remote. User. Cpu = 12. 7 Remote Site didn’t tell us? Request. Disk = Disk. Usage ? ? ? … (many attributes removed) 22
Class. Ad Expressions combine values C/Java/Python-like: Logical: evaluate to boolean Math: +, -, /, *, <<, >>, % evaluate to number Functions (builtins) depends on function 23
Logical Expressions Expression Meaning > Greater Than < Less Than >= Greater Than or equal <= Less Than or equal && Logical And (short circuited) || Logical Or (short circuited) == Equality Test != Inequality Test 24
Examples with Logicals Is. ASleep. Job -> true $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = undefined QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk =Cmd = Disk. Usage Is. ASleep. Job == “sleep” … (many attributes removed) 25
Examples with Logicals Uses. Some. Disk -> false $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = undefined QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk ==Disk. Usage Uses. Some. Disk. Usage > … (many attributes removed) 100 26
Math Expressions Expression + / Meaning Addition Subtraction (or unary minus) Division % * Modulus Multiplication 29
Examples with Math Disk. In. Bytes -> 102400 $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = undefined QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage * Disk. In. Bytes … (many attributes removed) 1024 30
Math + Logical for sorting › Need Single Number for sorting › Have several sort criteria: h. All jobs with small disk requests high prio h. Otherwise, sort by Cluster. Id 31
Booleans expand to integers ((Disk. Usage < 100) * 1000000) + Cluster. Id C T H n o a r a p r o d on ! m dig m m Co 32
Classad Builtin Functions Expression time() substr(str, offset, len) regexp(pattern, str) Returns Current time in seconds from epoch Extract substring Regexp match (pcre based) random(x) Random number from 0 to x Is. Undefined(expr) True if expr is undefined String. List. Member(s, l) Is s in list l, where l like "a, b, c" to. Upper(s) Upper-case s 34
Examples with Functions (QDate + 3600) > time() -> true (maybe) regexp("^s", Cmd) -> true Is. Undefined(foo) -> true $ condor_q –l 180. 0 Cluster. Id = 180 Cmd = "sleep" Disk. Usage = 100 Exit. By. Signal = undefined QDate = 1535384632 Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 35
Replace Examples New in 8. 9! replace("[A-Z]", Args, "C") -> "Cob Bob” replaceall("[A-Z]", Args, "C") -> "Cob Cob” $ condor_q –l 180. 0 Cluster. Id = 180 "sleep" Cmd = "names" Disk. Usage = Bob" 100 Args = "Rob Exit. By. Signal = undefined Disk. Usage = 100 QDate = 1535384632 Exit. By. Signal = undefined Remote. User. Cpu = 12. 7 Request. Disk = Disk. Usage … (many attributes removed) 36
Control Flow › Expr ? t. Expr : f. Expr h. If expr evals to True, use t. Expr, else f. Expr › If. Then. Else(expr, t. Expr, f. Expr) hditto › (Expr ? : Use. This. If. Expr. Was. Undefined) 39
Greg’s Favorite Function: Debug() › Debug(any. Expression) -> any. Expression › Thus Debug is a no-op › Has a side effect: h. Daemon. Log traces expression evaluation 40
Requirements = Want. Gluster && (1024 > Memory) Requirements = debug(Want. Gluster && (1024 > Memory)) Negotiator Log shows: 13: 32: 12 Classad debug: Want. Gluster --> UNDEFINED 13: 32: 12 Classad debug: 409600 --> 409600 13: 32: 12 Classad debug: [0. 01001 ms] Memory --> 409600 13: 32: 12 Classad debug: [0. 03791 ms] Want. Gluster && (1024 > Memory) --> FALSE 41
condor_status -json Name = "fastmachine" Child. Slot =[ Name = "slot 1" Cpus = 4 ] Cpus = 40 Child. Cpus = {1, 2, 3, 4} slot. Id = 3 { "Name": "fastmachine", "Child. Slot": { "Name": "slot 1” "Cpus": 4, }, "Cpus": 40, "Child. Cpus": [ 1, 2, 3, 4 ], "slot. Id": 3 } 44
Testing and debugging exprs $ condor_status –limit 1 › <just one ad> $ condor_status –limit 1 –af “ 1+1” 2 $ condor_status –limit 1 –af ‘regexp(“foo”, ”f. *”)
Classads: On to 2 nd use Description of entities in Condor describes machines, jobs, services Query language to select entities in Condor “show me all the busy machines” “show me idle jobs needing > 32 Gb ram” 2 way matching Given jobs & machines, find matches 47
Query language › Users can write expressions as queries › These select a subset of ads from a larger set › If condor evaluates expression to TRUE 48
Query Language example $ condor_status -const 'some classad expr' $ condor_q -const 'some classad expr' 49
Classad expression in a submit file Universe = vanilla Executable = gronkulate Requirements = has_avx && Floor. Number > 4 queue 50
Classad expression in a config file EXECUTE = /var/condor/execute START = cmd == “foo” PREEMPT = Entered. Current. State > 600 queue 51
Example query $ condor_status –const 'Activity == "Busy"' $ condor_status –const 'Activity != "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage = 1024 *** Machine. Name = "Machine 2" Activity = "Idle" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 52
Example query $ condor_status –const 'Activity == "Busy"' $ condor_status –const 'Activity != "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage = 1024 *** Machine. Name = "Machine 2" Activity = "Idle" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 53
Example query $ condor_status –const 'Activity == "Busy"' $ condor_status –const 'Activity != "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage = 1024 *** Machine. Name = "Machine 2" Activity = "Idle" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 54
Example query $ condor_status –const 'Memory. Usage > 2000' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage = 1024 *** Machine. Name = "Machine 2" Activity = "Idle" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 55
Example query $ condor_status –const 'Memory. Usage > 2000' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage = 1024 *** Machine. Name = "Machine 2" Activity = "Idle" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 56
Strict Equality Operators › What does the expression "Some String" == undefined Or "Some String" == Missing. Attribute Evaluate to? 57
› "foo" == undefined -> undefined › "foo" != undefined -> undefined › Sometimes you want › "foo" != undefined to mean false. 58
Strict Equality Operators › › › =? = and =!= are Strict Equality comparisons “exactly equal” or “exactly not equal” And NEVER return undefined: "Some String" =? = undefined -> false "Some String" =!= undefined -> true 59
Example Strict Equality $ condor_status –const 'Activity != "Busy"' $ condor_status –const 'Activity =!= "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage 1024 *** Machine. Name = "Machine 2" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 60
Example Strict Equality $ condor_status –const 'Activity != "Busy"' $ condor_status –const 'Activity =!= "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage 1024 *** Machine. Name = "Machine 2" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 61
Example Strict Equality $ condor_status –const 'Activity != "Busy"' $ condor_status –const 'Activity =!= "Busy"' Machine. Name = "Machine 1" Activity = "Busy" Memory. Usage 1024 *** Machine. Name = "Machine 2" *** Machine. Name = "Machine 3" Activity = "Busy" Memory. Usage = 2048 62
More On Strict Equality › Undefined is just another value h. Undefined == undefined -> undefined h. Undefined =? = undefined -> true 63
More On Strict Equality › String == is case INsensitive › String =? =, =!= is case sensitive (!) › No conversion between types h 42 == 42. 0 -> true h 42 =? = 42. 0 -> false 64
Classads: 3 rd use Description of entities in Condor describes machines, jobs, services Query language to select entities in Condor “show me all the busy machines” “show me idle jobs needing > 32 Gb ram” 2 way matching Given jobs & machines, find matches 65
Matchmaking Requires TWO ads, returns true or false “In the context of ad 1 and ad 2” With a selection expression in the Requirements value of both ads Commonly used to match jobs and machines 66
For 2 ads to match, both Requirements -> true › Evaluate Requirements of one, if true › Evaluate Requirements of other. › Note My and Target are relative 67
Slot Ad Job Ad Type = "Machine" Cpus = 40 Memory = 2048 Requirements = (Owner == "gthain") && (TARGET. Num. Job. Starts <= MY. Max. Tries) Has. Matlab. License = true Max. Tries = 4 Type = "Job" Requirements = Has. Matlab. License =? = True Cmd= "/bin/sleep" Args = "3600" Owner = "gthain" Num. Job. Starts = 8 68
References when matching Is. Good = true Is. Not. Good = false Run. Time = 123 e. g. Some. Name -> "Foo" Name = "Foo" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Reference: lookup 69
References when matching Is. Good = true Is. Not. Good = false Run. Time = 123 e. g. Some. Name -> "Foo" Name = "Foo" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Reference: lookup 70
References when matching Is. Good = true Run. Time = 123 Name = "Foo" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Price = 23. 45 Foo = undefined U = Missing What does Some. Name return now? 71
References when matching Is. Good = true Run. Time = 123 Name = "Foo" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Price = 23. 45 Foo = undefined U = Missing What does Some. Name return now? 72
References when matching › Ads are checked in order › Lookup first in the local ad › Then the other ad 73
References with My and Target › Prefix reference with “My. ” or “Target. ” › To force lookup in one side or the other › Rarely used, but good idea 74
References when matching Is. Good = true Run. Time = 123 Name = "Foo" Some. Name = TARGET. Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Price = 23. 45 Foo = undefined U = Missing What does Old. Name return now? 75
References when matching Is. Good = true Run. Time = 123 Name = "Foo" Some. Name = TARGET. Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Price = 23. 45 Foo = undefined U = Missing What does Old. Name return now? 76
References when matching Is. Good = true Run. Time = 123 Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing What does Some. Name return now? 77
References when matching Is. Good = true Run. Time = 123 Some. Name = Name Price = 23. 45 Foo = undefined U = Missing Is. Good = true Run. Time = 123 Name = "Bar" Some. Name = Name Price = 23. 45 Foo = undefined U = Missing What does Some. Name return now? 78
Questions? Thank You! 79
- Jenny thain
- Kesden cmu
- Teseq esd gun
- Gregory reznik
- Where are liver flukes found
- Greg camm
- Greg gordon md
- Greg godzik
- Dave provenzano
- Kentucky physicians health foundation
- Greg tielke
- Greg ashman
- Greg dudkin ppl
- Gstitt
- Greg stitt
- Eienskappe van n jeugroman
- Greg kuperberg
- Greg michaelson
- Greg thomson missing
- Greg whalley enron
- When creating an ad how does greg
- Greg blumenthal
- Greg hoglund
- Greg kelly calculus
- Diary of a wimpy kid hard luck rowley and abigail
- Greg clevenger
- Greg worms
- Which item is part of lemon brown’s treasure?
- Dr greg bosshardt
- Greg moore physics
- Greg cibuzar
- Garth gibson
- Greg baldini
- Greg scagliotti
- Seopr
- Greg mossop
- Greg tang math ten frame mania
- Greg crooks
- Greg levinson
- Greg mears md
- Telia estonia
- Gregory ahearn
- Greg nickless hcd
- Greg filbeck
- Caia level 2 exam weights
- Greg bronevetsky
- Greg needel
- Allavert
- Greg sakall
- Greg plaxton
- Greg quirk
- Greg & steve we all live together, volume 2
- Greg teixeira
- Dr greg saville
- Dr gregory bernstein
- Greg knap
- Greg bloom open referral
- Greg partyka
- Greg craola simkins
- Greg blatt
- Dr. kristi winters
- Fat land greg critser
- Peel community legal services
- Greg faust
- Greg stoner penn state
- Greg veramendi
- Greg hisey
- Verilog-xl
- Greg goslin
- Greg schillo
- Greg nassar
- Greg buckles