/** * Return the storage mount point for a particular pool. * * @param site SiteInfo object of the site for which you want the storage-mount-point. * @return String corresponding to the mount point if the pool is found. null if pool entry is not * found. */ public String getSeMountPoint(SiteInfo site) { logMessage("String getSeMountPoint(SiteInfo site)"); String mount_point = mStorageDir; GridFTPServer server = null; if (mStorageDir.length() == 0 || mStorageDir.charAt(0) != '/') { server = site.selectGridFTP(false); mount_point = server.getInfo(GridFTPServer.STORAGE_DIR); // removing the trailing slash if there int length = mount_point.length(); if (length > 1 && mount_point.charAt(length - 1) == '/') { mount_point = mount_point.substring(0, length - 1); } // append the Storage Dir File f = new File(mount_point, mStorageDir); mount_point = f.getAbsolutePath(); } // check if we need to replicate the submit directory // structure on the storage directory if (mDeepStorageStructure) { String leaf = (this.mUserOpts.getOptions().partOfDeferredRun()) ? // if a deferred run then pick up the relative random directory // this.mUserOpts.getOptions().getRandomDir(): this.mUserOpts.getOptions().getRelativeDirectory() : // for a normal run add the relative submit directory this.mUserOpts.getOptions().getRelativeDirectory(); File f = new File(mount_point, leaf); mount_point = f.getAbsolutePath(); } return mount_point; }
/** * An adapter method that converts the <code>SiteInfo</code> object to <code>SiteCatalogEntry * </code> object. * * @param s <code>SiteInfo</code> to be converted. * @param logger the hande to the LogManager * @return the converted <code>SiteCatalogEntry</code> object. */ public static SiteCatalogEntry convert(SiteInfo s, LogManager logger) { SiteCatalogEntry3 site = new SiteCatalogEntry3(); /* set the handle */ site.setSiteHandle((String) s.getInfo(SiteInfo.HANDLE)); VDSSysInfo sysinfo = (VDSSysInfo) s.getInfo(SiteInfo.SYSINFO); if (sysinfo != null) { site.setVDSSysInfo(sysinfo); } // describe the head node filesystem HeadNodeFS hfs = new HeadNodeFS(); /* set the work directory as shared scratch */ HeadNodeScratch hscratch = new HeadNodeScratch(); SharedDirectory hscratchShared = new SharedDirectory(); String workDir = s.getExecMountPoint(); for (Iterator it = ((List) s.getInfo(SiteInfo.GRIDFTP)).iterator(); it.hasNext(); ) { GridFTPServer g = (GridFTPServer) it.next(); hscratchShared.addFileServer( new FileServer("gsiftp", (String) g.getInfo(GridFTPServer.GRIDFTP_URL), workDir)); } hscratchShared.setInternalMountPoint(new InternalMountPoint(workDir)); hscratch.setSharedDirectory(hscratchShared); hfs.setScratch(hscratch); /* set the storage directory as shared storage */ HeadNodeStorage hstorage = new HeadNodeStorage(); SharedDirectory hstorageShared = new SharedDirectory(); String storageDir = null; for (Iterator it = ((List) s.getInfo(SiteInfo.GRIDFTP)).iterator(); it.hasNext(); ) { GridFTPServer g = (GridFTPServer) it.next(); storageDir = (String) g.getInfo(GridFTPServer.STORAGE_DIR); hstorageShared.addFileServer( new FileServer("gsiftp", (String) g.getInfo(GridFTPServer.GRIDFTP_URL), storageDir)); } hstorageShared.setInternalMountPoint(new InternalMountPoint(storageDir)); hstorage.setSharedDirectory(hstorageShared); hfs.setStorage(hstorage); site.setHeadNodeFS(hfs); /* set the storage directory as GridGateways */ for (Iterator it = ((List) s.getInfo(SiteInfo.JOBMANAGER)).iterator(); it.hasNext(); ) { JobManager jm = (JobManager) it.next(); GridGateway gw = new GridGateway(); String universe = (String) jm.getInfo(JobManager.UNIVERSE); if (universe.equals("vanilla")) { gw.setJobType(GridGateway.JOB_TYPE.compute); } else if (universe.equals("transfer")) { gw.setJobType(GridGateway.JOB_TYPE.auxillary); } else { throw new RuntimeException( "Unknown universe type " + universe + " for site " + site.getSiteHandle()); } String url = (String) jm.getInfo(JobManager.URL); gw.setContact(url); if (url.endsWith("condor")) { gw.setScheduler(GridGateway.SCHEDULER_TYPE.Condor); } else if (url.endsWith("fork")) { gw.setScheduler(GridGateway.SCHEDULER_TYPE.Fork); } else if (url.endsWith("pbs")) { gw.setScheduler(GridGateway.SCHEDULER_TYPE.PBS); } else if (url.endsWith("lsf")) { gw.setScheduler(GridGateway.SCHEDULER_TYPE.LSF); } else if (url.endsWith("sge")) { gw.setScheduler(GridGateway.SCHEDULER_TYPE.SGE); } gw.setIdleNodes((String) jm.getInfo(JobManager.IDLE_NODES)); gw.setTotalNodes((String) jm.getInfo(JobManager.TOTAL_NODES)); site.addGridGateway(gw); } /* set the LRC as Replica Catalog */ for (Iterator it = ((List) s.getInfo(SiteInfo.LRC)).iterator(); it.hasNext(); ) { LRC lrc = (LRC) it.next(); ReplicaCatalog rc = new ReplicaCatalog(lrc.getURL(), "LRC"); site.addReplicaCatalog(rc); } /* add Profiles */ for (Iterator it = ((List) s.getInfo(SiteInfo.PROFILE)).iterator(); it.hasNext(); ) { site.addProfile((Profile) it.next()); } // do another conversion. SiteCatalogEntry result = Adapter.convert(site); logger.log("SiteCatalogEntry object created is " + result, LogManager.DEBUG_MESSAGE_LEVEL); return result; }