}
// Exception handler
String processExceptionHandler = jobRequestProperties.getProperty(JobRequestProperties.key_driver_exception_handler);
// Command line
DuccWorkPopDriver driver = new DuccWorkPopDriver(job.getjobBroker(), job.getjobQueue(), crxml, crcfg, meta_time, lost_time, wi_time, processExceptionHandler);
JavaCommandLine driverCommandLine = new JavaCommandLine(javaCmd);
driverCommandLine.setClassName(IDuccCommand.main);
driverCommandLine.addOption(IDuccCommand.arg_ducc_deploy_configruation);
driverCommandLine.addOption(IDuccCommand.arg_ducc_deploy_components);
driverCommandLine.addOption(IDuccCommand.arg_ducc_job_id+job.getDuccId().toString());
// classpath
String java_classpath = getDuccClasspath(0); // for driver
String driverClasspath = jobRequestProperties.getProperty(JobSpecificationProperties.key_classpath);
logger.debug(methodName, job.getDuccId(), "driver CP (spec):"+driverClasspath);
logger.debug(methodName, job.getDuccId(), "java CP:"+java_classpath);
if(driverClasspath != null) {
if(isClasspathOrderUserBeforeDucc(jobRequestProperties.getProperty(JobSpecificationProperties.key_classpath_order),job.getDuccId())) {
logger.info(methodName, job.getDuccId(), "driver:OrderUserBeforeDucc");
driverClasspath=driverClasspath+File.pathSeparator+java_classpath;
}
else {
logger.info(methodName, job.getDuccId(), "driver:OrderDuccBeforeUser");
driverClasspath=java_classpath+File.pathSeparator+driverClasspath;
}
}
else {
logger.info(methodName, job.getDuccId(), "driver:OrderDefault");
driverClasspath=java_classpath;
}
logger.debug(methodName, job.getDuccId(), "driver CP (combined):"+driverClasspath);
driverCommandLine.setClasspath(driverClasspath);
// Add the user-provided JVM args
boolean haveXmx = false;
String driver_jvm_args = jobRequestProperties.getProperty(JobSpecificationProperties.key_driver_jvm_args);
ArrayList<String> dTokens = QuotedOptions.tokenizeList(driver_jvm_args, true);
for(String token : dTokens) {
driverCommandLine.addOption(token);
if (!haveXmx) {
haveXmx = token.startsWith("-Xmx");
}
}
// Add any site-provided JVM args, but not -Xmx if the user has provided one
String siteJvmArgs = DuccPropertiesResolver.get(DuccPropertiesResolver.ducc_driver_jvm_args);
dTokens = QuotedOptions.tokenizeList(siteJvmArgs, true); // a null arg is acceptable
for (String token : dTokens) {
if (!haveXmx || !token.startsWith("-Xmx")) {
driverCommandLine.addOption(token);
}
}
// Name the log config file explicitly - the default of searching the user-provided classpath is dangerous
driverCommandLine.addOption("-Dlog4j.configuration=file://" + Utils.findDuccHome() + "/resources/log4j.xml");
// Environment
String driverEnvironmentVariables = jobRequestProperties.getProperty(JobSpecificationProperties.key_environment);
int envCountDriver = addEnvironment(job, "driver", driverCommandLine, driverEnvironmentVariables);
logger.info(methodName, job.getDuccId(), "driver env vars: "+envCountDriver);
logger.debug(methodName, job.getDuccId(), "driver: "+driverCommandLine.getCommand());
// Log directory
driverCommandLine.setLogDirectory(jobRequestProperties.getProperty(JobSpecificationProperties.key_log_directory));
driver.setCommandLine(driverCommandLine);
//
NodeIdentity nodeIdentity = hostManager.getNode();
DuccId duccId = jdIdFactory.next();
duccId.setFriendly(0);