LOG.info("called");
if (job == null) {
final String msg = "No job entered. Unable to continue";
LOG.error(msg);
throw new GeniePreconditionException(msg);
}
// Figure out a cluster to run this job. Cluster selection is done based on
// ClusterCriteria tags and Command tags specified in the job.
final Cluster cluster = this.clb.selectCluster(this.ccs.chooseClusterForJob(job.getId()));
final String className = ConfigurationManager.getConfigInstance()
.getString("netflix.genie.server." + cluster.getClusterType() + ".JobManagerImpl");
try {
final Class jobManagerClass = Class.forName(className);
final Object instance = this.context.getBean(jobManagerClass);
if (instance instanceof JobManager) {
final JobManager jobManager = (JobManager) instance;
jobManager.init(job, cluster);
return jobManager;
} else {
final String msg = className + " is not of type JobManager. Unable to continue.";
LOG.error(msg);
throw new GeniePreconditionException(msg);
}
} catch (final ClassNotFoundException | BeansException e) {
final String msg = "Unable to create job manager for class name " + className;
LOG.error(msg, e);
throw new GenieBadRequestException(msg);