23.06.2006gat1 alexander beck-ratzka offis, 23.06.06
TRANSCRIPT
23.06.2006 GAT 1
GAT
Alexander Beck-Ratzka
OFFIS, 23.06.06
23.06.2006 GAT 2
GAT: Agenda
• Einführung– Wieso eine neue Grid-API?– Was bietet GAT, was nicht?– Einfache Beispiele– Architektur
• Die einzelnen API-Gruppen– File (-Stream)-Management, Logical File-Management, – AdvertService-Management, – Job-Management
• Adapter• Zusammenfassung
23.06.2006 GAT 3
Wieso eine neue Grid-API?
GAT als einheitliche API für Zugriff auf heterogene Gridtechnologien /Gridmiddleware.
GAT ist nur ein Framework; die eigentlichen Operationen müssendurch Adapter erledigt werden. GAT bietet die Möglichkeit desAdapter-Einsatzes.
Neue Grid-Technologien müssen nur via Adapter mit ans GATgekoppelt werden -> Keine Änderungen mehr im Programm-Codenötig, auch nicht bei neuer Grid-Technologie.
GAT ermöglicht einen einfachen Zugriff auf Grid-Technologien.
GAT verwendet die Grid-Middleware, welche gerade zur Verfügung steht, und das bei nur einem GAT_JobSubmit oder GATFileCopy...
23.06.2006 GAT 4
File copy: CoG/RFTpackage org.globus.ogsa.gui;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import java.util.Date;
import java.util.Vector;
import javax.xml.rpc.Stub;
import org.apache.axis.message.MessageElement;
import org.apache.axis.utils.XMLUtils;
import org.globus.*
import org.gridforum.ogsi.*
import org.gridforum.ogsi.holders.TerminationTimeTypeHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class RFTClient {
public static void copy (String source_url, String target_url) {
try {
File requestFile = new File (source_url);
BufferedReader reader = null;
try {
reader = new BufferedReader (new FileReader (requestFile));
} catch (java.io.FileNotFoundException fnfe) { }
Vector requestData = new Vector ();
requestData.add (target_url);
TransferType[] transfers1 = new TransferType[transferCount];
RFTOptionsType multirftOptions = new RFTOptionsType ();
multirftOptions.setBinary (Boolean.valueOf (
(String)requestData.elementAt (0)).booleanValue ());
multirftOptions.setBlockSize (Integer.valueOf (
(String)requestData.elementAt (1)).intValue ());
multirftOptions.setTcpBufferSize (Integer.valueOf (
(String)requestData.elementAt (2)).intValue ());
multirftOptions.setNotpt (Boolean.valueOf (
(String)requestData.elementAt (3)).booleanValue ());
multirftOptions.setParallelStreams (Integer.valueOf (
(String)requestData.elementAt (4)).intValue ());
multirftOptions.setDcau(Boolean.valueOf(
(String)requestData.elementAt (5)).booleanValue ());
int i = 7;
for (int j = 0; j < transfers1.length; j++)
{
transfers1[j] = new TransferType ();
transfers1[j].setTransferId (j);
transfers1[j].setSourceUrl ((String)requestData.elementAt (i++));
transfers1[j].setDestinationUrl ((String)requestData.elementAt (i++));
transfers1[j].setRftOptions (multirftOptions);
}
TransferRequestType transferRequest = new TransferRequestType ();
transferRequest.setTransferArray (transfers1);
int concurrency = Integer.valueOf
((String)requestData.elementAt(6)).intValue();
if (concurrency > transfers1.length)
{
System.out.println ("Concurrency should be less than the number"
"of transfers in the request");
System.exit (0);
}
transferRequest.setConcurrency (concurrency);
TransferRequestElement requestElement = new TransferRequestElement ();
requestElement.setTransferRequest (transferRequest);
ExtensibilityType extension = new ExtensibilityType ();
extension = AnyHelper.getExtensibility (requestElement);
OGSIServiceGridLocator factoryService = new OGSIServiceGridLocator ();
Factory factory = factoryService.getFactoryPort (new URL (source_url));
GridServiceFactory gridFactory = new GridServiceFactory (factory);
LocatorType locator = gridFactory.createService (extension);
System.out.println ("Created an instance of Multi-RFT");
MultiFileRFTDefinitionServiceGridLocator loc
= new MultiFileRFTDefinitionServiceGridLocator();
RFTPortType rftPort = loc.getMultiFileRFTDefinitionPort (locator);
((Stub)rftPort)._setProperty (Constants.AUTHORIZATION,
NoAuthorization.getInstance());
((Stub)rftPort)._setProperty (GSIConstants.GSI_MODE,
GSIConstants.GSI_MODE_FULL_DELEG);
((Stub)rftPort)._setProperty (Constants.GSI_SEC_CONV,
Constants.SIGNATURE);
((Stub)rftPort)._setProperty (Constants.GRIM_POLICY_HANDLER,
new IgnoreProxyPolicyHandler ());
int requestid = rftPort.start ();
System.out.println ("Request id: " + requestid);
}
catch (Exception e)
{
System.err.println (MessageUtils.toString (e));
}
}
23.06.2006 GAT 5
File copy: Java-GAT
import org.gridlab.gat.*;import org.gridlab.gat.io.File;
public class RemoteCopy {
public static void main(String[] args) throws Exception{
GATContext context = new GATContext();URI src = new URI(args[0]);URI dest = new URI(args[1]);File file = GAT.createFile(context, src); // create file objectfile.copy(dest); // and copy itGAT.end();
}}
23.06.2006 GAT 6
Was bietet GAT? (1)
GAT will nicht die Grid-Infrastruktur ersetzen.
GAT erlaubt einen einfachen Zugang zu vielen unterschiedlichen Grid-Infrastrukturen.
• GRAM• Condor• Unicore• GridFTP• ...
GAT ist ein OpenSource-Projekt.
23.06.2006 GAT 7
Was bietet GAT? (2)
• Applikationen rufen die GAT-API für Grid-Operationen auf. Applikationen werden gegen das GAT gelinkt.
• Applikationen unabhängig von der vorhandenen Infrastruktur.
GAT Engine lädt verfügbare Adapter zur Laufzeit Während eines Calls zur GAT-API entscheidet die Engine, welcher Adapter die Grid-Operation ausführt. Bei einem Fehler in der „Grid-Operation“, Aufruf eines anderen Adapter.
• Default-Adapter stellen lokale Operationen zur Verfügung Grid-Applikationen können ohne Grid-Services übersetzt, gelinkt und getestet werden. Die gleiche Applikation kann in einer „vollen Grid-Umgebung“ laufen: ohne erneutes build.
23.06.2006 GAT 8
Was bietet GAT? (3)
Die GAT-API ändert sich nicht. Veränderung in Globus Job submit beispielsweise werden im GAT-Globus-Adapter nachvollzogen.
GAT bietet Ausfallsicherheit: ist ein Grid-Service gerade nicht verfügbar, so wird ein anderer verfügbarer Grid-Service verwendet.
GAT ist wesentlich leichter zu installieren als z.B. Globus.
GAT bietet Grid mit minimalen Aufwand für Endanwender.
23.06.2006 GAT 9
Was bietet GAT nicht?
GAT ersetzt keine Funktionen der Grid-Middleware.
Ohne entsprechende Adapter wird eine Grid-Middleware nicht unterstützt.
GAT bietet keinen ResourceBroker.
23.06.2006 GAT 10
GAT API Übersicht
Dateioperationen
(Monitoring und Events)
Resourcen, Jobs
(Utility-Klassen: Fehlerbehandlung, Security, Preferences)
(Informationsaustausch)
23.06.2006 GAT 11
API Sub-SystemeFile Subsystem
GATFile GATFilestream GATLogicalFileGATEndpoint GATPipeListener GATPipe
Monitoring und Event Subsystem
GATRequestListener GATRequestNotifier GATActionGATMetricListener GATMetric GATMetricEvent
Informations-Austausch Subsystem
GATAdvertisable GATAdvertService
Resource Management Subsystem
GATSoftwareDescription GATResourceDescription GATResoureGATJobDescription GATResourceBroker GATReservationGATJob
Utility Subsystem
GATSelf GATContext GATSecurityContextGATStatus GATPreferences URL,Time, ...
23.06.2006 GAT 12
Beispiele (Java-GAT)
Fileoperationen
Job-Submit
23.06.2006 GAT 13
File Write (Java-GAT)import java.io.PrintWriter;
import org.gridlab.gat.GAT.*;import org.gridlab.gat.io.FileOutputStream;
public class FileStreamSimple { public static void main(String[] args) {
GATContext context = new GATContext(); URI src = null; FileOutputStream stream = null; PrintWriter p;
src = new URI(args[0]); stream = GAT.createFileOutputStream(context, null, src); p = new PrintWriter(stream);
String toBeStreamed = "hello world\n"; p.println(toBeStreamed); p.close(); GAT.end(); }}
23.06.2006 GAT 14
Job Submit (Java-GAT)public class SubmitJobToHost { public static void main(String[] args) { GATContext context = new GATContext(); Preferences prefs = new Preferences(); prefs.put("ResourceBroker.adaptor.name", "globus"); prefs.put("ResourceBroker.jobmanager", "sge");
URI exe = null; File outFile = null; File errFile = null; File pre1 = null; File pre1Dest = null;
try { exe = new URI("file:////bin/hostname");
outFile = GAT.createFile(context, prefs, new URI( "any://fs0.das2.cs.vu.nl/out"));
errFile = GAT.createFile(context, prefs, new URI( "any://fs0.das2.cs.vu.nl/err"));
pre1 = GAT.createFile(context, prefs, new URI( "any://fs0.das2.cs.vu.nl//bin/echo"));
pre1Dest = GAT.createFile(context, prefs, new URI( "any://fs0.das2.cs.vu.nl//home/rob/my_temp_file")); } catch (Exception e) { System.err.println("error: " + e); System.exit(1); }
SoftwareDescription sd = new SoftwareDescription(); sd.setLocation(exe); sd.setStdout(outFile); sd.setStderr(errFile); sd.addPreStagedFile(pre1, pre1Dest); Hashtable hardwareAttributes = new Hashtable(); hardwareAttributes.put("machine.node", "fs0.das2.cs.vu.nl");
ResourceDescription rd = new HardwareResourceDescription( hardwareAttributes);
JobDescription jd = null; ResourceBroker broker = null;
try { jd = new JobDescription(sd, rd); broker = GAT.createResourceBroker(context, prefs); } catch (Exception e) { System.err.println("Could not create Job description: " + e); System.exit(1); }
Job job = null;
try { job = broker.submitJob(jd); } catch (Exception e) { System.err.println("submission failed: " + e); e.printStackTrace(); System.exit(1); }
23.06.2006 GAT 15
GAT Architektur
API flache Schicht; nur ein Frame.
Adapter implementieren “Grid-Funktionalität” entsprechend der Anforderung durch API
Engine vermittelt Zwischen API u. Adapter:die Adapter werden zur Laufzeit angesprungen
error tracing und “Fallback” (default lokale Adapter)
CPI für Implementation einzelner Adaptoren.
23.06.2006 GAT 16
GAT Architektur
GAT Adapter
SGE
PBSGTK4
Globus 2/3.xUnicore
DRMAA
Applikation
Applikations-Layer
GAT API GAT Engine
GAT-Layer
User S
pace
„Grid
“ Sp
ace
23.06.2006 GAT 17
Implementation (Engine)
C-Version voll implementiert
C++-Wrapper voll implementiert
Python-Wrapper voll implementiert
JAVA-Version voll implementiert
23.06.2006 GAT 18
Implementation (Adapter) C-GAT
Globus:• gram, gridftp, RLS, gsiscp, gsissh
Unicore:• Job Submit, Job Monitoring
DRMAA (Distributed Resource Management Application API)
SGE (Sun Grid Engine)
PBS (Portable Batch System)
23.06.2006 GAT 19
Implementation (Adapter) Java-GAT
Globus:• Über Java Cog Paket alles für Globus 3.y; GTK 4 bisher nur ohne WebServices.
Unicore:• In Arbeit
SGE
PBS
23.06.2006 GAT 20
Implementation (Adapter) Java-GAT und C-GAT
Lokale Adpapter:• ssh, scp, ftp, sftp,
• File-Adapter: (cp, mv, read, write, etc...)
• Job-Adapter: fork, exec, auch über ssh...
23.06.2006 GAT 21
File.copy: prinzipieller Ablauf
File.copy(dest)
FileCPI.copy(dest)
Adapter1 copy
Adapter2 copy
Adapter3 copy
23.06.2006 GAT 22
File Sub-SystemGATFile-Klasse
GATFile
CreateDestroy
CopyMoveDelete
IsReadableIsWritableGetLength
LastWriteTimeGetLocation
GATObject
23.06.2006 GAT 23
File Sub-SystemGATFileStream-Klasse
GATFileStream
CreateDestroyReadWriteSeek
GATObject
GAT_MetricGAT_Monitorable
23.06.2006 GAT 24
File Sub-SystemGATLogicalFile-Klasse
GATLogicalFile
CreateDestroyGetFiles
GetLocationsRemove
RemoveFileAddFile
AddLocationReplicate
GATObject
GAT_MetricGAT_Monitorable
GAT_AdvertService
23.06.2006 GAT 25
Advert Paket
Ziel: Verfügbarmachung wichtiger Infos an zentraler Stelle , z.B. Job fertig.
Realisiert über SQL-Adaptor in C-GAT.
23.06.2006 GAT 26
Advert-Paket
GATAdvertService
AddDelete
AddMetadataGetMetadata
GetAdertisableFind
SetPWDGetPWD
GATObject
GAT_Advertisable
23.06.2006 GAT 27
Job-ManagementKlassen
GATResourceBroker
ReserveResourceFindResources
SubmitJob
GATJob
UnscheduleCheckPointCloneJobMigrate
StopGetJobDescription
GetStateGetJobID
GetNativeID
23.06.2006 GAT 28
Job-ManagementVerfügbare Job-Stati
GATJobState Wert Bedeutung
GATJobState Unknown Status nicht ermittelbar
GATJobState Initial Im Initialisierungsstatus
GATJobState Scheduled z.B. Queued
GATJobState Running Job im executing
GATJobState Stopped Job fertig oder gestoppt
23.06.2006 GAT 29
Job-ManagementStrukturen
GATHardwareResourceDescription
Machine typeMemory
CPU-TimeNodes needed
GATSoftwareResourceDescription
ExecutableArguments
StdinStdoutStderr
Pre-Stage-FilesPost-Stage-Files
GATJobDescription
23.06.2006 GAT 30
Job-ManagementBeispiel (PBS-Adapter)
GATHardwareResourceDescription
machine.queue = destination (-q)jobname = jobname (-N)yeo = join (-j)memory.size = mem (-l)file.size = file (-l)cpu.walltime = walltime (-l)cpu.nodes = nodes (-l)
23.06.2006 GAT 31
Job-ManagementBeispiel (PBS-Adapter)
GATSoftwareResourceDescription
Stdin = stdin (exec < input)Stdout = stdout (-o)Stderr = stderr (-e)Executable = executableArguments = arglist[]
23.06.2006 GAT 32
Job-ManagementBeispiel (PBS-Adapter)
Umsetzung in QSUB-Skript
machine.queue = [email protected] = TestJobyeo = eomemory.size = 1Gfile.size = 2Gcpu.walltime = 12:00:00cpu.nodes = 8
stdin = inputstdout = out.testjobstderr = err.testjobexecutable = /bin/progarglist[0] = arg1arglist[1] = arg2arglist[2] = lastarg
#PBS -q [email protected]#PBS -l walltime=12:00:00, \ -mem=1G,file=2G,[email protected]#PBS -N testjob#PBS -o out.testjob#PBS -e err.testjob#PBS -j eo
/bin/prog arg1 arg2 lastarg < input..
23.06.2006 GAT 33
Job-ManagementMängel
Problem: Festlegung in HardwaresResourceDescription recht willkürlich.
Lösung:Anbindung an JSDL-Standard.
23.06.2006 GAT 34
Job-ManagementMängel
Problem: Zu wenig JOB-Stati.
Lösung:Anbindung an DRMAA.
23.06.2006 GAT 35
GAT Zukunft
C-GAT ist im Maintenance Modus
Java-GAT wird noch weiterentwickelt
SAGA (Simple API for Grid Applications) soll neuer GGF-Standard werden. Erste Engine mit GAT-Wrapper und GTK4-Adaptoren im Herbst
23.06.2006 GAT 36
AnwendungsbeispielProC MPA Garching
23.06.2006 GAT 37
SAGA
In Standard soll eingehen: GAT, Java-CoG, DRMAA, RealityGrid, JSDL, GridRPC, OSGA-BES, GridCPR, gLite, HDF5
An Entwicklung beteiligt: GAT, RealityGrid UK Science, OMII Grid UK Science, CCT Louisana, VU Netherlands, NAREGI Japan, Globus/CoG, GGF DRMAA, GGF GridRPC
Wichtig: Bedarf an Adaptern anmelden!
23.06.2006 GAT 38
GAT-Anwender
C-GAT
MPA in GarchingProC-Workflows aufs Grid
LSU in Baton RougeChemie-Projekt
AMOLF NLFourier Transform Mass Spectrometry (FTMS) Analyse. FTMS-Daten werden mit JavaGAT ins Grid übertragen (ssh, sftp, gridftp).
Multimedian Project NLStart paralleler Jobs
ZIB BerlinINRIA Frankreich
Java-GAT
SuperScalar (Univ. of Barcelona, ESP) SURA-Grid (63 partners, US) SCOOP project (LSU + 9 partners, US) UCOMS project (LSU + 4 partners, US) Cactus (LSU, US) Clusterix Project (PSNC, Univ. of Krakow, PL) Amolf (Vl-e, NL) Frank Seinstra (UvA, NL) Triana group (Cardiff, UK)
23.06.2006 GAT 39
Links für GAT
GAT allgemein: http://www.gridlab.org/WorkPackages/wp-1/
GAT CVS: cvs.gridlab.orgcvsroot: pserver:[email protected]:/cvs/gridlabPasswort: anonGAT-Quellen: wp-1/CodesGAT-Dokumente: wp-1/DocumentsNur GATEngine: wp-1/Codes/GATEngine
GAT Mailing-Liste: [email protected] (www.listserv.dfn.de)
Download tarball: http://www.gridlab.org/WorkPackages/wp-1/gatreleases.htmlhttp://www.gridlab.org/WorkPackages/wp-1/adaptorreleases.html