Download presentation
Presentation is loading. Please wait.
1
Writing GAT Adaptors Hartmut Kaiser hkaiser@cct.lsu.edu http://www.cct.lsu.edu/~gallen/Teaching
2
October 17th, 2005Writing GAT Adaptors2 What‘s a GAT Adaptor Piece of glue code connecting the GAT CPI with the concrete service API to use CPI: capability provider interface –Interface between the GAT and the adaptors Service API –Client side interface of a service (OS service, webservice, client library etc.) Maps the single CPI functions to the corresponding service API functions
3
October 17th, 2005Writing GAT Adaptors3 What‘s a GAT Adaptor
4
October 17th, 2005Writing GAT Adaptors4 What‘s a GAT Adaptor May (has to) implement more then one CPI (group of related functions):
5
October 17th, 2005Writing GAT Adaptors5 What‘s a GAT Adaptor Every of the CPI functions correspond to one of the GAT API functions, i.e. Engine dispatches the API call to a suitable adaptor (calls the CPI function implemented in the adaptor) But not all of the CPI functions have to be implemented, runtime provides the missing functions (C++ and Python) Runtime returns GAT_NOTIMPL for these (C++ and Python) API CPI GAT.File.Copy GAT.Adaptors.FileCPI.Copy
6
October 17th, 2005Writing GAT Adaptors6 File Transfer Adaptor File transfer CPI –CPI data Context this object was created with Location of this file –CPI functions: Copy(Location dest, CopyMode mode) –Copy the file to the specified destination Move(Location dest, MoveMode mode) –Move the file to the specified destination Delete() –Delete the file GetLength() –Return the current size of the file IsReadable() –Return, whether the file is readable IsWritable() –Return, whether the file is readable LastWriteTime() –Return the time of the last write access
7
October 17th, 2005Writing GAT Adaptors7 File Transfer Adaptor Application import GAT file = GAT.File("file://tmp/t") file.Copy("file://tmp/t2", Overwrite) file = GAT.File("file://tmp/t2") file.Move("file://tmp/t3", FailIfThere) Adaptor import shutil import GAT import GAT.Adaptors class filecpi(GAT.Adaptors.FileCPI): Copy(self, dest, mode): shutil.copyfile(self.location, dest) class filecpi: Move(self, dest, mode) shutil.move(self.location, dest)
8
October 17th, 2005Writing GAT Adaptors8 Service Discovery Adaptor ServiceResourceBroker CPI –CPI data Context this object was created with –CPI functions FindResources(ServiceDescription) –Return a list of suitable resources Reource CPI (ServiceResource) –CPI data Context this object was created with Resource Description –CPI functions GetResourceDescription –Return the resource description of this resource (GetReservation) –Does not apply here (is for HardwareResources only)
9
October 17th, 2005Writing GAT Adaptors9 Adaptor Selection GAT engine narrows down the list of available adaptors using supplied/default preferences GAT engine goes through the remaining list and tries to instantiate the object implementing the CPI The first adaptor found to return success gets associated with the GAT API object GAT.File GAT.Adaptors.FileCPI
10
October 17th, 2005Writing GAT Adaptors10 Preference Matching Adaptor registers its preferences (capabilities) during adaptor loading Application may specify its preferences (requirements) during object construction GAT engine matches these two preference sets to select suitable adaptors Preferences are a set of key/value pairs decribing a CPI implementation provided by a certain adaptor Look at the adaptor_instances example which prints the registered adaptor preferences
11
October 17th, 2005Writing GAT Adaptors11 CPI Instantiation GAT engine tries to instantiate the object which implements the CPI C++/Python: first the function IsApplicable is called to decide, whether this object will be able to support the request CPI object is instantiated only, when IsApplicable returns True Drawback: adaptors are ‚bound‘ to the API object at object creation time and it‘s not possible to change the adaptor during the object lifetime (early binding) SAGA will support late binding
12
October 17th, 2005Writing GAT Adaptors12 Demo File Transfer Adaptor –Local adaptor written in Python
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.