![]() |
||||||||||||||||||||||||
Cluster and Grid Computing (Practical Work)
| ||||||||||||||||||||||||
|
ResourceBroker Interface Your DAS resource broker will implement the ResourceBroker interface of the JavaGAT. This interface is found in the org.gridlab.gat.resources package, and looks like this (javadoc): package org.gridlab.gat.resources; interface ResourceBroker { Reservation reserveResource(ResourceDescription desc, TimePeriod period) throws ... Reservation reserveResource(Resource resource, TimePeriod period) throws ... List findResources(ResourceDescription desc) throws ... Job submitJob(JobDescription desc) throws ... } You do not have to implement all of these methods! Only the submitJob needs to be implemented. You can skip the others. The ResourceBroker CPI class can be found in org.gridlab.gat.resources.cpi.ResourceBrokerCPI. It consist of a default implementation of the ResourceBroker interface (that only throws Exceptions) and some helper functions: abstract class ResourceBrokerCpi implements ResourceBroker { Reservation reserveResource(ResourceDescription desc, TimePeriod period) throws .... { throw new UnsupportedOperationException("Not implemented"); } Reservation reserveResource(Resource resource, TimePeriod period) throws ... { // same as above } List findResources(ResourceDescription desc) throws ... { // same as above } Job submitJob(JobDescription desc) throws ... ... { // same as above } void preStageFiles(JobDescription desc, String host) throws ... { // Generic file prestage implementation!! } void postStageFiles(JobDescription desc, String host) throws ... { // Generic file poststage implementation!! } } The interesting thing about the ResourceBrokerCpi class is that it already contains a complete implementation of the pre and post staging of files! As a result, the ResourceBroker implementations do not have to worry about files. If you are interested, you can have a look at the JavaGAT engine source to see how the cpi class is implemented. All the JavaGAT sources (engine and adaptors) can be found in: $GAT_LOCATION/engine/src and $GAT_LOCATION/adaptors/src respectively, where $GAT_LOCATION is the one set by the /usr/local/VU/practicum/gridcomputing/environment script. The sources for the ResourceBrokerCpi are part of the JavaGAT engine, and can be found in: .../engine/src/org/gridlab/gat/resources/cpi/ResourceBrokerCpi.java As you might remember from the first assignment, the JavaGAT user can specify that a certain adaptor should be used at runtime (e.g., "globus", "local" or "amazon"), by setting the "ResourceBroker.adaptor.name" in the Preferences object to the respective adaptor name. On the opposite (i.e. the adaptor writer's) side, there needs to be a way to specify the binding between your adaptor and an adaptor name. This binding is done implicitly, by consistently naming the adaptor classes in the following manner: Adaptor_nameCPI_classAdaptor. For instance, the LocalFileAdaptor class is an adaptor for File, named "Local". Therefore, your adaptor class should be called AmazonResourceBrokerAdaptor and specified by the user with the name "Amazon". The TriLead SSH resource broker extends the ResourceBrokerCpi class, and implements the submitJob method. Since advanced reservation is not possible using ssh, the other methods are not implemented. The source of the SSH resource broker is part of the adaptor source tree. It can be found in: .../adaptors/SshTrilead/src/org/gridlab/gat/resources/cpi/sshtrilead/SshTrileadResourceBrokerAdaptor.java The actual implementation of the TriLead SSH resource broker is quite complicated, and will therefore not be explained here. Fortunately, you can simply re-use this complicated code by forwarding calls to the SshTrileadResourceBrokerAdaptor class. This will be explained in the Creating Adaptors section. |
|
|
|||||||
| phonebook |
|||||||
|
If you spot a mistake, please e-mail the maintainer of this page.
|
|||||||