Job Management

Download Report

Transcript Job Management

REST interface
DIRAC Workshop
29-31 October
Marseille
Overview

Why do we need yet another interface?

How does it work?

When’s the release date?
2
DIRAC Workshop
29-31 October
Today interfaces
How can users interact with DIRAC?


CLI (dirac-wms-job-submit, dirac-proxy-init,… )

Python API

Web interface
How can other applications interact with DIRAC?

3

CLI

Python API
DIRAC Workshop
29-31 October
I want to use DIRAC but…
CLI


Parsing hell for the application

Log messages shouldn’t change…

Consistent exit codes?
Python API


4
What if I can’t use python?
DIRAC Workshop
29-31 October
My App wants to talk to DIRAC!
Apps today are no longer bound to the console!


Mobile apps, web pages, libraries…
X509 Certificates are not the most fun-and-friendly
thing out there


5
Even worse for grid certificates…
DIRAC Workshop
29-31 October
We need a new API

We need a new API to accommodate this new use
cases

Has to be:

Extensible by <InsertYourNameHere>DIRAC

Language agnostic


6
Based on standards
Easy to use
DIRAC Workshop
29-31 October
How do we do that?
Need to provide solutions for:


Query protocol


Codification of requests and responses


7
Which “language” do we talk?
How is the data serialized?
Credentials delegation

How does DIRAC know which user or on behalf of which user
the request is being made?

X509 cannot easily cover all use-cases
DIRAC Workshop
29-31 October
Query protocol
Rules:


Language agnostic

Has to be a standard

And simple to use!

8
Have you seen SOAP or XMPP stanza? Somebody was on a
drugs….
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soapenvelope">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetStockPrice xmlns:m="http://www.example.org/stock">
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
GetStockPrice( StockName = ‘IBM’
</soap:Body>
</soap:Envelope>
DIRAC Workshop
)
29-31 October
Query protocol: REST
HTTP requests as the protocol


GET  get resource info

POST  send a new entry

PUT  Modify a resource

DELETE  delete a resource
For instance:

9

GET /jobs/628  Get info for job 628

GET /jobs/628/manifest  Get manifest for job 628

DELETE /jobs/628  Kill job 628
DIRAC Workshop
29-31 October
JSON as data serialization

Many different possibilities

XML is not an option

See slide about SOAP crap

Wanted something human readable

Libs in as many languages as possible

JSON serialized data looks like python native code
10
DIRAC Workshop
29-31 October
Example request
Request URL: http://localhost:2379/jobs/38373708
Request Method: GET
Status Code: 200 OK
{u'appStatus': u'Application failed with error: 232',
u'cpuTime': 0,
u'jid': 38373708,
u'owner': u'acasajus',
u'ownerDN': u'0',
u'ownerGroup': u'lhcb_user',
u'priority': 0,
...
u'times': {u'lastSOL': u'2012-10-26 04:38:09',
u'lastUpdate': u'2012-10-26 04:38:09',
u'reschedule': u'2012-10-26 02:36:13',
u'submission': u'2012-10-25 16:18:51'}}
…
}
11
DIRAC Workshop
29-31 October
Credentials

We need to know on on behalf of which user the request
is coming from

Not all applications will have access to the user certificate


Web portals
X509 can’t be used
Delegate
credential
12
Application
Request on
behalf of the
user
DIRAC Workshop
DIRAC
29-31 October
OAuth2

Summary: Generate a token that will act as the user
credentials
1. Apps redirect user to DIRAC portal to generate a
code
2. User grants privileges to the code
3. App exchange the code for an access token

Access token bears the user credentials + granted
privileges
13
DIRAC Workshop
29-31 October
OAuth2 flow
7. Forward request
to required DIRAC
component
1.- Request code
REST
Server
Application
DIRAC
Credentials
store
5. Get access token
and send requests
6. Check
privileges
granted
4. Notify of
grant
2. Grant privileges to code
Web Portal
3. Store privileges
granted to token
14
User
DIRAC Workshop
29-31 October
OAuth2

Apps only need to do two steps to get a token

One for apps that have access to the client credentials

From then on, just add the token to the HTTP request
header

Token is associated to:

DN

Group

Setup

Privileges
15
DIRAC Workshop
29-31 October
When will it be available?

Not yet in an official release 

Can be installed by hand 

Basic functionality is there 


No docs yet 


Will write them after the user forum
Ask me how to install it!


Submit job, retrieve job info, manifest….
Requires DIRAC web
There’s also an experimental app for Android 
16
DIRAC Workshop
29-31 October
Summary

New API

REST + JSON + OAuth2

Language agnostic

Web portals, mobile apps… can use it

Not yet released


Head to https://github.com/acasajus/RESTDIRAC
Ready for daring installations
17
DIRAC Workshop
29-31 October