71
Condor Project Computer Sciences Department University of Wisconsin-Madison Extend/alter Condor via developer APIs/plugins CERN Feb 14 2011 Todd Tannenbaum

Extend/alter Condor via developer APIs/plugins CERN Feb 14 2011

  • Upload
    tommy

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

Todd Tannenbaum. Extend/alter Condor via developer APIs/plugins CERN Feb 14 2011. Some classifications. Application Program Interfaces (APIs) Job Control Operational Monitoring Extensions. Job Control APIs. The biggies: Command Line Tools DRMAA Condor DBQ Web Service Interface (SOAP) - PowerPoint PPT Presentation

Citation preview

Page 1: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

Condor ProjectComputer Sciences DepartmentUniversity of Wisconsin-Madison

Extend/alter Condor via developer

APIs/plugins

CERN Feb 14 2011

Todd Tannenbaum

Page 2: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

2www.cs.wisc.edu/Condor

Some classifications

Application Program Interfaces

(APIs)

› Job Control

› Operational Monitoring

Extensions

Page 3: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

3www.cs.wisc.edu/Condor

Job Control APIs

The biggies:

› Command Line Tools

› DRMAA

› Condor DBQ

› Web Service Interface (SOAP)http://condor-wiki.cs.wisc.edu/index.cgi/wiki?

p=SoapWisdom

Page 4: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

4www.cs.wisc.edu/Condor

Command Line Tools› Don’t underestimate them!

› Your program can create a submit file on disk and simply invoke condor_submit:system(“echo universe=VANILLA > /tmp/condor.sub”);

system(“echo executable=myprog >> /tmp/condor.sub”);

. . .

system(“echo queue >> /tmp/condor.sub”);

system(“condor_submit /tmp/condor.sub”);

Page 5: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

5www.cs.wisc.edu/Condor

Command Line Tools

› Your program can create a submit file and give it to condor_submit through stdin:PERL: fopen(SUBMIT, “|condor_submit”);

print SUBMIT “universe=VANILLA\n”;

. . .

C/C++: int s = popen(“condor_submit”, “r+”);

write(s, “universe=VANILLA\n”, 17/*len*/);

. . .

Page 6: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

6www.cs.wisc.edu/Condor

Command Line Tools

› Using the +Attribute with condor_submit:universe = VANILLA

executable = /bin/hostname

output = job.out

log = job.log

+webuser = “zmiller”

queue

Page 7: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

7www.cs.wisc.edu/Condor

Command Line Tools

› Use -constraint and –format with condor_q:% condor_q -constraint 'webuser=="zmiller"' -- Submitter:

bio.cs.wisc.edu : <128.105.147.96:37866> : bio.cs.wisc.edu ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD 213503.0 zmiller 10/11 06:00 0+00:00:00 I 0 0.0 hostname

% condor_q -constraint 'webuser=="zmiller"' -format "%i\t" ClusterId -format "%s\n" Cmd

213503 /bin/hostname

Page 8: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

8www.cs.wisc.edu/Condor

Command Line Tools

› condor_wait will watch a job log file and wait for a certain (or all) jobs to complete:

system(“condor_wait job.log”);

› can specify a timeout

Page 9: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

9www.cs.wisc.edu/Condor

Command Line Tools› condor_q and condor_status –xml

option› So it is relatively simple to build on

top of Condor’s command line tools alone, and can be accessed from many different languages (C, PERL, python, PHP, etc).

› However…

Page 10: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

10www.cs.wisc.edu/Condor

DRMAA

› DRMAA is a OGF standardized job-submission API› Has C (and now Java) bindings› Is not Condor-specific › SourceForge Project http://sourceforge.net/projects/condor-ext

Page 11: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

11www.cs.wisc.edu/Condor

DRMAA

› Unfortunately, the DRMAA 1.x API does not support some very important features, such as: Fault tolerance Transactions

Page 12: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

12www.cs.wisc.edu/Condor

Condor Database Queue (Condor DBQ)

› Layer on top of Condor

› Relational database interface to Submit work to Condor Monitor status of submission Monitor status of individual jobs

› Perfect for applications that Submit jobs to Condor Already use a database

Page 13: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

13www.cs.wisc.edu/Condor

Web App Before Condor DBQ

WebApplication

WebApplication

CondorPool

CondorPool

ScheddSchedd

DBMS

R/W appdata

R/W appdata

Submit Job(SOAP or cmd line interface)

Submit Job(SOAP or cmd line interface)

Check Status(job log file, SOAP,

or cmd line interface)

Check Status(job log file, SOAP,

or cmd line interface)

Non- Trivial Code

Non- Trivial Code

User log

ApptablesApp

tables

Crash!!!You did implement two phase commit

and recovery, to get run once semantics,

right?

Crash!!!You did implement two phase commit

and recovery, to get run once semantics,

right?

Page 14: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

14www.cs.wisc.edu/Condor

Web App After Condor DBQ

WebApplication

WebApplication

CondorPool

CondorPool

ScheddSchedd

DBMSUser log

R/W appdata

R/W appdata

Submit Job

Submit Job

Check StatusCheck Status

condor_dbqcondor_dbq

Submit Job(cmd line)Submit Job(cmd line)

Get Job UpdatesGet Job Updates

Check New WorkUpdate Status

Check New WorkUpdate Status

• Single SQL statements

• Transactional

• Single SQL statements

• Transactional

ApptablesApp

tablesworktableworktable

jobtablejob

table

Page 15: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

15www.cs.wisc.edu/Condor

Benefits of Condor DBQ› Natural simple SQL API

Submit workinsert into work values(condor-submit-file)

Check statusselect * from jobs where work_id = id

› Transactions/Consistency comes for free

› DBMS performs crash recovery

Page 16: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

16www.cs.wisc.edu/Condor

Condor DBQ Limitations

› Overrides log file location

› All jobs submitted as same user

› Dagman not supported

› Only Vanilla and Standard universe jobs supported (others are unknown)

› Currently only supports PostgreSQL

Page 17: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

17www.cs.wisc.edu/Condor

Web Service Interface

› Simple Object Access Protocol Mechanism for doing RPC using XML

(typically over HTTP or HTTPS) A World Wide Web Consortium (W3C)

standard

› SOAP Toolkit: Transform a WSDL to a client library

Page 18: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

18www.cs.wisc.edu/Condor

Benefits of a Condor SOAP API

› Can be accessed with standard web service tools

› Condor accessible from platforms where its command-line tools are not supported

› Talk to Condor with your favorite language and SOAP toolkit

Page 19: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

19www.cs.wisc.edu/Condor

Condor SOAP API functionality

› Get basic daemon info (version, platform)

› Submit jobs

› Retrieve job output

› Remove/hold/release jobs

› Query machine status

› Advertise resources

› Query job status

Page 20: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

20www.cs.wisc.edu/Condor

Getting machine status via SOAP

Your program

SOAP library

queryStartdAds()

condor_collector

Machine List

SOAP over HTTP

Page 21: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

21www.cs.wisc.edu/Condor

Some classifications

Application Program Interfaces

(APIs)

› Job Control

› Operational Monitoring

Extensions

Page 22: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

22www.cs.wisc.edu/Condor

Operational Monitoring APIs

› Via Web Services (SOAP)› Via Relational Database: Quill

Job, Machine, and Matchmaking data echoed into PostgreSQL RDBMS

› Via a file: the Event Log Just like the job log, but has events for all jobs

submitted to a schedd. Structured journal of job events Sample code in C++ to read/parse these

events› Via Enterprise messaging: Condor AMQP

Event Log events echoed into Qpid, an AMQP message broker in a highly reliable manner

https://condor-wiki.cs.wisc.edu/index.cgi/wiki?p=CondorPigeon

Page 23: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

23www.cs.wisc.edu/Condor

Some classifications

Application Program Interfaces

(APIs)

› Job Control

› Operational Monitoring

Extensions

Page 24: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

24www.cs.wisc.edu/Condor

Extending Condor› APIs: How to

interface w/ Condor

› Extensions: Changing Condor’s behavior Hooks Plugins

Page 25: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

25www.cs.wisc.edu/Condor

Job Wrapper Hook› Allows an administrator to specify a

“wrapper” script to handle the execution of all user jobs

› Set via condor_config “USER_JOB_WRAPPER”

› Wrapper runs as the user, command-line args are passed, machine & job ad is available.

› Errors can be propagated to the user.› Example: condor_limits_wrapper.sh

Page 26: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

26www.cs.wisc.edu/Condor

Job Fetch & Prepare Hooks

› Job Fetch hooks Call outs from the condor_startd Extend claiming Normally jobs are pushed from schedd to

startd – now jobs can be “pulled” from anywhere

› Job Running Hooks Call outs from the condor_starter Transform the job classad Perform any other pre/post logic

Page 27: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

35www.cs.wisc.edu/Condor

Sidebar: “Toppings” If work arrived via fetch

hook “foo”, then prepare hooks “foo” will be used.

What if an individual job could specify a job prepare hook to use???

Prepare hook to use can be alternatively specified in job classad via attribute “HookKeyword”

How cool is that???

Page 28: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

36www.cs.wisc.edu/Condor

Toppings: Simple Example› In condor_config:

ANSYS_HOOK_PREPARE_JOB= \ $(LIBEXEC)/ansys_prepare_hook.sh

› Contents of ansys_prepare_hook.sh:#!/bin/sh#Read and discard the job classadcat >/dev/nullecho'Cmd="/usr/local/bin/ansys"'

Page 29: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

37www.cs.wisc.edu/Condor

Topping Example, cont.

› In job submit file: universe=vanilla

executable=whatever arguments=… +HookKeyword=“ANSYS" queue

Page 30: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

39www.cs.wisc.edu/Condor

Configuration Hook

› Instead of reading from a file, run a program to generate Condor config settings

› Append “|” to CONDOR_CONFIG or LOCAL_CONFIG_FILE. Example:

LOCAL_CONFIG_FILE = \

/opt/condor/sbin/make_config

Page 31: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

› Allows the administrator to configure hooks for handling URLs during Condor's file transfer

› Enables transfer from third party directly to execute machine, which can offload traffic from the submit point

› Can be used in a number of clever ways

File Transfer Hooks

Page 32: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

File Transfer Hooks

› API is extremely simple

› Must support being invoked with the “-classad” option to advertise its abilities:

#!/bin/env perl

if ($ARGV[0] eq "-classad") { print "PluginType = \"FileTransfer\"\n"; print "SupportedMethods = \"http,ftp,file\"\n"; exit 0;}

Page 33: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

File Transfer Hooks

› When invoked normally, a plugin simply transfers the URL (first argument) into filename (second argument)# quoting could be an issue but this runs in user space

$cmd = "curl " . $ARGV[0] . " -o " . $ARGV[1];system($cmd);$retval = $?;

exit $retval;

Page 34: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

File Transfer Hooks› In the condor_config file, the

administrator lists the transfer hooks that can be used

› Condor invokes each one to find out its abilities

› If something that looks like a URL is added to the list of input files, the plugin is invoked on the execute machine

Page 35: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

File Transfer Hooks

› condor_config: FILETRANSFER_PLUGINS = curl_plugin,

hdfs_plugin, gdotorg_plugin, rand_plugin

› Submit file: transfer_input_files = normal_file,

http://cs.wisc.edu/~zkm/data_file, rand://1024/random_kilobyte

Page 36: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

File Transfer Hooks

› As you can see, the format of the URL is relatively arbitrary and is interpreted by the hook

› This allows for tricks like rand://, blastdb://, data://, etc.

Page 37: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

46www.cs.wisc.edu/Condor

Plugins

Page 38: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

47www.cs.wisc.edu/Condor

Plugins› Shared Library Plugins

Gets mapped right into the process space of the Condor Services! May not block! Must be thread safe!

General and ClassAd Functions

› Condor ClassAd Function Plugin Add custom built-in functions to the

ClassAd Language. Via condor_config “CLASSAD_LIB_PATH” Cleverly used by SAMGrid

Page 39: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

48www.cs.wisc.edu/Condor

General Plugins› In condor_config, use “PLUGINS” or

“PLUGIN_DIR”.› Very good idea to do:

SUBSYSTEM.PLUGIN or SUBSYSTEM.PLUGIN_DIR

› Implement C++ child class, and Condor will call methods at the appropriate times.

› Some general methods (initialize, shutdown), and then callbacks based on plugin type

› What’s available? Plugin Discovery…

Page 40: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

49www.cs.wisc.edu/Condor

Plugin Discoverycd src/dir /s Example*Plugin.cppYou will find: ExampleCollectorPlugin.cpp ExampleMasterPlugin.cpp ExampleNegotiatorPlugin.cpp ExampleClassAdLogPlugin.cpp ExampleScheddPlugin.cpp ExampleStartdPlugin.cppAnd a ClassAdLogPluginManager.cpp

Page 41: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

50www.cs.wisc.edu/Condor

Collector Pluginstruct ExampleCollectorPlugin : public

CollectorPlugin{

void initialize();

void shutdown();

void update(int command, const ClassAd &ad);

void invalidate(int command, const ClassAd &ad);

};

Page 42: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

51www.cs.wisc.edu/Condor

ClassAdLog Plugin Methods

virtual void newClassAd(const char *key) = 0;virtual void destroyClassAd(const char *key) = 0;virtual void setAttribute(const char *key,

const char *name, const char *value) = 0;

virtual void deleteAttribute(const char *key, const char *name) = 0;

Page 43: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

52www.cs.wisc.edu/Condor

Other Extending Ideas…

Page 44: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

53www.cs.wisc.edu/Condor

Custom ClassAd Attributes

› Job ClassAd +Name = Value in submit file SUBMIT_EXPRS in condor_config

› Machine ClassAd STARTD_EXPRS in condor_config for

static attributes STARTD_CRON_* settings in

condor_config for dynamic attributes

Page 45: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

54www.cs.wisc.edu/Condor

Thinking out of the box…

› MAIL in condor_config

› Green Computing Settings HIBERNATION_PLUGIN (called by the

startd) ROOSTER_WAKEUP_CMD

Page 46: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

55www.cs.wisc.edu/Condor

All else fails? Grab Source!

Condor is open source ya know…

Thank you! Questions?

Page 47: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

56www.cs.wisc.edu/Condor

Extra Slides

Page 48: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

57www.cs.wisc.edu/Condor

Lets get some SOAP details…

Page 49: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

58www.cs.wisc.edu/Condor

The API› Core API, described with WSDL, is

designed to be as flexible as possible File transfer is done in chunks Transactions are explicit

› Wrapper libraries aim to make common tasks as simple as possible Currently in Java and C# Expose an object-oriented interface

Page 50: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

59www.cs.wisc.edu/Condor

Things we will cover

› Condor setup

› Necessary tools

› Job Submission

› Job Querying

› Job Retrieval

› Authentication with SSL and X.509

Page 51: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

60www.cs.wisc.edu/Condor

Condor setup

› Start with a working condor_config

› The SOAP interface is off by default Turn it on by adding ENABLE_SOAP=TRUE

› Access to the SOAP interface is denied by default Set ALLOW_SOAP and DENY_SOAP, they

work like ALLOW_READ/WRITE/… Example: ALLOW_SOAP=*/*.cs.wisc.edu

Page 52: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

61www.cs.wisc.edu/Condor

Necessary tools› You need a SOAP toolkit

Apache Axis (Java) - http://ws.apache.org/axis/ Microsoft .Net - http://microsoft.com/net/ gSOAP (C/C++) - http://gsoap2.sf.net/ ZSI (Python) - http://pywebsvcs.sf.net/ SOAP::Lite (Perl) - http://soaplite.com/

› You need Condor’s WSDL files Find them in lib/webservice/ in your Condor release

› Put the two together to generate a client library $ java org.apache.axis.wsdl.WSDL2Java condorSchedd.wsdl

› Compile that client library $ javac condor/*.java

All our examples are in Java using Apache Axis

Page 53: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

62www.cs.wisc.edu/Condor

Client wrapper libraries› The core API has some complex spots› A wrapper library is available in Java and C#

Makes the API a bit easier to use (e.g. simpler file transfer & job ad submission)

Makes the API more OO, no need to remember and pass around transaction ids

› We are going to use the Java wrapper library for our examples You can download it from

http://www.cs.wisc.edu/condor/birdbath/birdbath.jar

Page 54: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

63www.cs.wisc.edu/Condor

Submitting a job› The CLI way…

universe = vanillaexecutable = /bin/cparguments = cp.sub cp.workedshould_transfer_files = yestransfer_input_files = cp.subwhen_to_transfer_output = on_exitqueue 1

$ condor_submit cp.sub

cp.sub:

Explicit bits

clusterid = Xprocid = Yowner = mattrequirements = Z

Implicit bits

Page 55: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

64www.cs.wisc.edu/Condor

Repeat to submit multiple jobs in a single cluster

Repeat to submit multiple clusters

• The SOAP way…1.Begin transaction2.Create cluster3.Create job4.Send files5.Describe job6.Commit transaction

Submitting a job

Page 56: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

65www.cs.wisc.edu/Condor

1. Begin transaction

2. Create cluster

3. Create job

4&5. Send files & describe job6. Commit transaction

Schedd schedd = new Schedd(“http://…”);Transaction xact =

schedd.createTransaction();xact.begin(30);int cluster = xact.createCluster();int job = xact.createJob(cluster);File[] files = { new File(“cp.sub”) };xact.submit(cluster, job, “owner”,

UniverseType.VANILLA, “/bin/cp”, “cp.sub cp.worked”, “requirements”, null, files);

xact.commit();

Submission from Java

Page 57: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

66www.cs.wisc.edu/Condor

Schedd’s location

Max time between calls (seconds)

Job owner, e.g. “matt”

Requirements, e.g. “OpSys==\“Linux\””

Extra attributes, e.g. Out=“stdout.txt” or Err=“stderr.txt”

Schedd schedd = new Schedd(“http://…”);Transaction xact =

schedd.createTransaction();xact.begin(30);int cluster = xact.createCluster();int job = xact.createJob(cluster);File[] files = { new File("cp.sub") };xact.submit(cluster, job, “owner”,

UniverseType.VANILLA, “/bin/cp”, “cp.sub cp.worked”, “requirements”, null, files);

xact.commit();

Submission from Java

Page 58: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

67www.cs.wisc.edu/Condor

Querying jobs

› The CLI way…$ condor_q

-- Submitter: localhost : <127.0.0.1:1234> : localhost ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD 1.0 matt 10/27 14:45 0+02:46:42 C 0 1.8 sleep 10000…

42 jobs; 1 idle, 1 running, 1 held, 1 unexpanded

Page 59: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

68www.cs.wisc.edu/Condor

Also, getJobAds given a constraint, e.g. “Owner==\“matt\””

String[] statusName = { “”, “Idle”, “Running”, “Removed”, “Completed”, “Held” };

int cluster = 1;

int job = 0;

Schedd schedd = new Schedd(“http://…”);

ClassAd ad = new ClassAd(schedd.getJobAd(cluster, job));

int status = Integer.valueOf(ad.get(“JobStatus”));

System.out.println(“Job is “ + statusName[status]);

Querying jobs

› The SOAP way from Java…

Page 60: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

69www.cs.wisc.edu/Condor

Retrieving a job

› The CLI way..

› Well, if you are submitting to a local Schedd, the Schedd will have all of a job’s output written back for you

› If you are doing remote submission you need condor_transfer_data, which takes a constraint and transfers all files in spool directories of matching jobs

Page 61: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

70www.cs.wisc.edu/Condor

Discover available files

Remote file

Local file

Retrieving a job

› The SOAP way in Java…int cluster = 1;

int job = 0;

Schedd schedd = new Schedd(“http://…”);

Transaction xact = schedd.createTransaction();

xact.begin(30);

FileInfo[] files = xact.listSpool(cluster, job);

for (FileInfo file : files) {

xact.getFile(cluster, job, file.getName(), file.getSize(), new File(file.getName()));

}

xact.commit();

Page 62: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

71www.cs.wisc.edu/Condor

Authentication for SOAP› Authentication is done via mutual SSL

authentication Both the client and server have certificates and

identify themselves

› It is not always necessary, e.g. in some controlled environments (a portal) where the submitting component is trusted

› A necessity in an open environment -- remember that the submit call takes the job’s owner as a parameter Imagine what happens if anyone can submit

to a Schedd running as root…

Page 63: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

72www.cs.wisc.edu/Condor

Details on settingup authenticated SOAP over HTTPS

Page 64: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

73www.cs.wisc.edu/Condor

Authentication setup› Create and sign some certificates› Use OpenSSL to create a CA

CA.sh -newca› Create a server cert and password-less key

CA.sh -newreq && CA.sh -sign mv newcert.pem server-cert.pem openssl rsa -in newreq.pem -out server-key.pem

› Create a client cert and key CA.sh -newreq && CA.sh -sign && mv

newcert.pem client-cert.pem && mv newreq.pem client-key.pem

Page 65: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

74www.cs.wisc.edu/Condor

Authentication config› Config options…

ENABLE_SOAP_SSL is FALSE by default <SUBSYS>_SOAP_SSL_PORT

• Set this to a different port for each SUBSYS you want to talk to over ssl, the default is a random port

• Example: SCHEDD_SOAP_SSL_PORT=1980 SOAP_SSL_SERVER_KEYFILE is required and has no

default• The file containing the server’s certificate AND

private key, i.e. “keyfile” after cat server-cert.pem server-key.pem > keyfile

Page 66: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

75www.cs.wisc.edu/Condor

Authentication config› Config options continue…

SOAP_SSL_CA_FILE is required• The file containing public CA certificates

used in signing client certificates, e.g. demoCA/cacert.pem

› All options except SOAP_SSL_PORT have an optional SUBSYS_* version For instance, turn on SSL for everyone

except the Collector with• ENABLE_SOAP_SSL=TRUE• COLLECTOR_ENABLE_SOAP_SSL=FALSE

Page 67: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

76www.cs.wisc.edu/Condor

One last bit of config› The certificates we generated have a principal name,

which is not standard across many authentication mechanisms

› Condor maps authenticated names (here, principal names) to canonical names that are authentication method independent

› This is done through mapfiles, given by SEC_CANONICAL_MAPFILE and SEC_USER_MAPFILE

› Canonical map: SSL .*emailAddress=(.*)@cs.wisc.edu.* \1

› User map: (.*) \1› “SSL” is the authentication method,

“.*emailAddress….*” is a pattern to match against authenticated names, and “\1” is the canonical name, in this case the username on the email in the principal

Page 68: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

77www.cs.wisc.edu/Condor

HTTPS with Java› Setup keys…

keytool -import -keystore truststore -trustcacerts -file demoCA/cacert.pem

openssl pkcs12 -export -inkey client-key.pem -in client-cert.pem -out keystore

› All the previous code stays the same, just set some properties javax.net.ssl.trustStore, javax.net.ssl.keyStore,

javax.net.ssl.keyStoreType, javax.net.ssl.keyStorePassword

Example: java -Djavax.net.ssl.trustStore=truststore -Djavax.net.ssl.keyStore=keystore -Djavax.net.ssl.keyStoreType=PKCS12 -Djavax.net.ssl.keyStorePassword=pass Example https://…

Page 69: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

78www.cs.wisc.edu/Condor

Quill› Condor

operational data mirrored into an RDBMS PostgreSQL

› Job, machine, historical info

› Read-only

QuillSchedd

Job Queue

log

RDBMS

Startd …

Master

Queue +

History Tables

Page 70: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

79www.cs.wisc.edu/Condor

Condor Perl Module

› Perl module to parse the “job log file”

› Can use instead of polling w/ condor_q

› Call-back event model

› (Note: job log can be written in XML)

Page 71: Extend/alter Condor via developer  APIs/plugins CERN Feb 14 2011

www.cs.wisc.edu/Condor

Event Logging Condor can generate an “Event Log”:

This is a log of significant events about the life of the jobs on a system.

Competing objectives: Limit the amount of space used by the

logging, so that event logging doesn’t become a problem itself

Never “drop” events C++ reader library