Research Article

Bandwidth-Aware Scheduling of Workflow Application on Multiple Grid Sites

Listing 1

Parts of the source code showing how access to NWS is embedded in the Heft site-selector algorithm. We create a new Java class NwsAwareHeft for bandwidth-aware Heft site-selector algorithm. This listing shows only important fragments of modified or added part in the original Heft algorithm of Pegasus WMS. The added/modified code is shown in bold-face to distinguish it from the already available code in Pegasus WMS’s Heft class.
public class  NwsAwareHeft  extends Abstract {
private NetworkInformationCollection mMachinesNIMap;
private HashMap<String,String>  mGridSitesToMachinesMap;
public void initialize  (  PegasusBag bag  )  {
super.initialize  (  bag  );
  initializeNwsInformation  ();
  bag.add  (PegasusBag.NWS_INFO, mMachinesNIMap);
  bag.add  (PegasusBag.SITES_TO_MACHINES_MAP,
mGridSitesToMachinesMap);
  mHeftImpl  =  new Algorithm  (  bag  );
 }
private void initializeNwsInformation  ()  {
  mMachinesNIMap=new NetworkInformationCollection  ();
  mGridSitesToMachinesMap=getGridSitesToMachinesMap  ();
  String
nwsNameServer=getNwsNameServerNameFromConfigFile  ();
  String     resources=getMachinesNames  ();
  mMachinesNIMap.init  (nwsNameServer, resources);
  mMachinesNIMap.performMeasurements  ();
 }
private String getMachineName  (String gridSiteName)  {
  String machineName=“”;
  String urlPrefix=“”;
  SiteCatalogEntry scEntry=mSiteStore.lookup  (gridSiteName);
  if  (scEntry!=null)  {
   HeadNodeFS headNodeFS=scEntry.getHeadNodeFS  ();
   if  (headNodeFS!=null)  {
    FileServer fileServer  =
headNodeFS.selectStorageSharedFileServer  ();
    urlPrefix=fileServer.getURLPrefix  ();
    if   (urlPrefix!=null)  {
     machineName=parseMachineName  (urlPrefix);
    }
   }
  }
return machineName
 }
}