gov.bnl.star.offline.scheduler
Class ComponentLibrary
java.lang.Object
gov.bnl.star.offline.scheduler.ComponentLibrary
public class ComponentLibrary
- extends java.lang.Object
The base class that encapsulates(points to) the configurations object.
- Version:
- $Revision: 1.22 $ $Date: 2006/11/21 00:41:32 $
- Author:
- carcassi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
globalObjectTable
public java.util.Map globalObjectTable
getInstance
public static ComponentLibrary getInstance()
- Returns:
- The initialized global configuration object.
initLibrary
public static void initLibrary(java.lang.String xmlFilename)
main
public static void main(java.lang.String[] args)
- Initializes the component library with the old properties file.
This should be removed once the xml configuration is ready.
public static void initLibrary() {
theInstance = new ComponentLibrary();
theInstance.library = new Hashtable();
XMLInitializer init = new XMLInitializer();
init.setDefaultFileListSyntax(SchedulerProperties.getInstance().getProperty("JobRequestXMLParser.defaults.fileListSyntax"));
theInstance.library.put("defaultJobInitializer", init);
PassivePolicy policy = new PassivePolicy();
policy.setNfsQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.nfsQueue"));
policy.setLocalQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.localQueue"));
policy.setLongQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.longQueue"));
policy.setMinTimeLimitQueue(SchedulerProperties.getInstance().getIntProperty("PassivePolicy.localQueue.minTimeLimit"));
policy.setRootdAvailable("true".equals(SchedulerProperties.getInstance().getProperty("PassivePolicy.isRootdAvailable")));
theInstance.library.put("defaultPolicy", policy);
LSFDispatcher lsfDispatcher = new LSFDispatcher();
LSFResourceStrategy res = new LSFResourceStrategy();
res.setBase(12);
res.setFileFactor(2);
res.setMax(50);
res.setDataVaultPrefix("/star/data");
res.setTrimVaultNumberLeadingZeros(true);
res.setResourceNameSyntax("sd$vaultNumber");
// No need to change or expand. See above comment on obsolete method
res.setSwitchSyntax("\"rusage[$nameEqualValueCommaSeparated]\"");
lsfDispatcher.setResourceStrategy(res);
lsfDispatcher.setScratchDir(SchedulerProperties.getInstance().getProperty("LSFDispatcher.scratchDir"));
lsfDispatcher.setBsubEx(SchedulerProperties.getInstance().getProperty("ProgramLocation.bsub"));
lsfDispatcher.setQueueName(SchedulerProperties.getInstance().getProperty("LSFDispatcher.queueName"));
lsfDispatcher.setBsubOptions(SchedulerProperties.getInstance().getProperty("LSFDispatcher.bsubOptions"));
lsfDispatcher.setMaxAttempts(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.maxBsubAttempts"));
lsfDispatcher.setMsBtwnSuccess(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.msBtwnSuccess"));
lsfDispatcher.setMsBtwnFailure(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.msBtwnFailure"));
theInstance.library.put("defaultDispatcher", lsfDispatcher);
XMLInitializer gridInit = new XMLInitializer();
gridInit.setDefaultFileListSyntax(SchedulerProperties.getInstance().getProperty("JobRequestXMLParser.defaults.fileListSyntax"));
theInstance.library.put("gridInitializer", gridInit);
PassivePolicy gridPolicy = new PassivePolicy();
gridPolicy.setNfsQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.nfsQueue"));
gridPolicy.setLocalQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.localQueue"));
gridPolicy.setLongQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.longQueue"));
gridPolicy.setMinTimeLimitQueue(SchedulerProperties.getInstance().getIntProperty("PassivePolicy.localQueue.minTimeLimit"));
gridPolicy.setRootdAvailable("true".equals(SchedulerProperties.getInstance().getProperty("PassivePolicy.isRootdAvailable")));
theInstance.library.put("gridPolicy", gridPolicy);
CondorGLSFDispatcher condorgDispatcher = new CondorGLSFDispatcher();
LSFResourceStrategy gridres = new LSFResourceStrategy();
gridres.setBase(12);
gridres.setFileFactor(2);
gridres.setMax(50);
gridres.setDataVaultPrefix("/star/data");
gridres.setTrimVaultNumberLeadingZeros(true);
gridres.setResourceNameSyntax("sd$vaultNumber");
// No need to change or expand. See above comment on obsolete method
gridres.setSwitchSyntax("\"rusage[$nameEqualValueCommaSeparated]\"");
condorgDispatcher.setResourceStrategy(gridres);
condorgDispatcher.setScratchDir(SchedulerProperties.getInstance().getProperty("LSFDispatcher.scratchDir"));
condorgDispatcher.setBsubEx(SchedulerProperties.getInstance().getProperty("ProgramLocation.bsub"));
condorgDispatcher.setCondorEx(SchedulerProperties.getInstance().getProperty("ProgramLocation.condor_submit"));
condorgDispatcher.setQueueName(SchedulerProperties.getInstance().getProperty("LSFDispatcher.queueName"));
condorgDispatcher.setBsubOptions(SchedulerProperties.getInstance().getProperty("LSFDispatcher.bsubOptions"));
condorgDispatcher.setMaxAttempts(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.maxBsubAttempts"));
condorgDispatcher.setMsBtwnSuccess(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.msBtwnSuccess"));
condorgDispatcher.setMsBtwnFailure(SchedulerProperties.getInstance().getIntProperty("LSFDispatcher.msBtwnFailure"));
theInstance.library.put("gridDispatcher", condorgDispatcher);
policy = new PassivePolicy();
policy.setNfsQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.nfsQueue"));
policy.setLocalQueue(SchedulerProperties.getInstance().getProperty("PassivePolicy.localQueue"));
policy.setLongQueue(SchedulerProperties.getInstance().getProperty("ResonanceGroupPolicy.longQueue"));
policy.setMinTimeLimitQueue(SchedulerProperties.getInstance().getIntProperty("PassivePolicy.localQueue.minTimeLimit"));
theInstance.library.put("ResonanceGroupPolicy", policy);
theInstance.library.put("defaultFileCatalog", new StarCatalog());
Map programLocations = new Hashtable();
programLocations.put("csh", SchedulerProperties.getInstance().getProperty("ProgramLocation.csh"));
programLocations.put("ls", SchedulerProperties.getInstance().getProperty("ProgramLocation.ls"));
// TODO: might want to put these as parameters of the Dispatchers
programLocations.put("bsub", SchedulerProperties.getInstance().getProperty("ProgramLocation.bsub"));
programLocations.put("condor_submit", SchedulerProperties.getInstance().getProperty("ProgramLocation.condor_submit"));
theInstance.library.put("programLocations", programLocations);
Map statConf = new Hashtable();
statConf.put("URL", SchedulerProperties.getInstance().getProperty("statistics.URL"));
statConf.put("username", SchedulerProperties.getInstance().getProperty("statistics.username"));
statConf.put("password", SchedulerProperties.getInstance().getProperty("statistics.password"));
theInstance.library.put("statistics", statConf);
Map logConf = new Hashtable();
logConf.put("directory", SchedulerProperties.getInstance().getProperty("Log.directory"));
logConf.put("level", SchedulerProperties.getInstance().getProperty("Log.level"));
theInstance.library.put("log", logConf);
CompositeDispatcher bnlDispatcher = new CompositeDispatcher();
CondorDispatcher condorDispatcher = new CondorDispatcher();
condorDispatcher.setScratchDir(SchedulerProperties.getInstance().getProperty("LSFDispatcher.scratchDir"));
condorDispatcher.setCondorEx(SchedulerProperties.getInstance().getProperty("ProgramLocation.condor_submit"));
condorDispatcher.setMaxAttempts(SchedulerProperties.getInstance().getIntProperty("CondorDispatcher.maxBsubAttempts"));
condorDispatcher.setMsBtwnSuccess(SchedulerProperties.getInstance().getIntProperty("CondorDispatcher.msBtwnSuccess"));
condorDispatcher.setMsBtwnFailure(SchedulerProperties.getInstance().getIntProperty("CondorDispatcher.msBtwnFailure"));
SimpleDispatcherChooser chooser = new SimpleDispatcherChooser();
chooser.setCluster("rcas.rcf.bnl.gov");
chooser.setRedirectedCluster("crs.rcf.bnl.gov");
chooser.setRedirectedPercentage(0.2);
chooser.setQueueToRedirect(SchedulerProperties.getInstance().getProperty("PassivePolicy.nfsQueue"));
bnlDispatcher.setChooser(chooser);
Map dispatchers = new Hashtable();
dispatchers.put("rcas.rcf.bnl.gov", lsfDispatcher);
dispatchers.put("crs.rcf.bnl.gov", condorDispatcher);
bnlDispatcher.setDispatchers(dispatchers);
theInstance.library.put("BNLDispatcher", bnlDispatcher);
theInstance.library.put("CRSDispatcher", condorDispatcher);
// These 3 lines are a temporary fix to get test to work
// until xml configuration is read properly
CSHApplication app = new CSHApplication();
app.setMakeExecutableCommand("/bin/chmod +x");
theInstance.library.put("CSHApplication", app);
}
addComponent
public void addComponent(java.lang.String name,
java.lang.Object object)
- Add an object to the configuration table.
getComponent
public java.lang.Object getComponent(java.lang.String componentName)
- Get an object from the configuration table.
getJobInitializer
public JobInitializer getJobInitializer()
getJobInitializer
public JobInitializer getJobInitializer(java.lang.String jobInitializerName)
getPolicy
public Policy getPolicy()
getPolicy
public Policy getPolicy(java.lang.String policyName)
getDispatcher
public Dispatcher getDispatcher()
getDispatcher
public Dispatcher getDispatcher(java.lang.String dispatcherName)
getDefaultFileCatalog
public FileCatalog getDefaultFileCatalog()
getProgramLocation
public java.lang.String getProgramLocation(java.lang.String programName)
getProgramLocation
public java.lang.String getProgramLocation(Site site,
java.lang.String programName)
forceGridDispatchers
public void forceGridDispatchers()
Copyright © 2002-2004 STAR collaboration - Brookhaven National Laboratory. All Rights Reserved.