use of org.smartdata.hdfs.scheduler.ActionSchedulerService in project SSM by Intel-bigdata.
the class CmdletManager method init.
@Override
public void init() throws IOException {
LOG.info("Initializing ...");
try {
maxActionId = new AtomicLong(metaStore.getMaxActionId());
maxCmdletId = new AtomicLong(metaStore.getMaxCmdletId());
numCmdletsFinished.addAndGet(metaStore.getNumCmdletsInTerminiatedStates());
schedulerServices = AbstractServiceFactory.createActionSchedulerServices(getContext().getConf(), (ServerContext) getContext(), metaStore, false);
for (ActionSchedulerService s : schedulerServices) {
s.init();
List<String> actions = s.getSupportedActions();
for (String a : actions) {
schedulers.put(a, s);
}
}
recover();
LOG.info("Initialized.");
} catch (MetaStoreException e) {
LOG.error("DB Connection error! Failed to get Max CmdletId/ActionId!", e);
throw new IOException(e);
} catch (IOException e) {
throw e;
} catch (Throwable t) {
throw new IOException(t);
}
}
use of org.smartdata.hdfs.scheduler.ActionSchedulerService in project SSM by Intel-bigdata.
the class CmdletManager method start.
@Override
public void start() throws IOException {
LOG.info("Starting ...");
executorService.scheduleAtFixedRate(new CmdletPurgeTask(getContext().getConf()), 10, 5000, TimeUnit.MILLISECONDS);
executorService.scheduleAtFixedRate(new ScheduleTask(), 100, 50, TimeUnit.MILLISECONDS);
executorService.scheduleAtFixedRate(new FlushCachedCmdletsTask(), 200, 50, TimeUnit.MILLISECONDS);
executorService.scheduleAtFixedRate(new DetectFailedActionTask(), 1000, 5000, TimeUnit.MILLISECONDS);
for (ActionSchedulerService s : schedulerServices) {
s.start();
}
dispatcher.start();
LOG.info("Started.");
}
use of org.smartdata.hdfs.scheduler.ActionSchedulerService in project SSM by Intel-bigdata.
the class AbstractServiceFactory method createActionSchedulerServices.
public static List<ActionSchedulerService> createActionSchedulerServices(Configuration conf, ServerContext context, MetaStore metaStore, boolean allMustSuccess) throws IOException {
List<ActionSchedulerService> services = new ArrayList<>();
String[] serviceNames = getActionSchedulerNames(context.getServiceMode());
for (String name : serviceNames) {
try {
Class clazz = Class.forName(name);
Constructor c = clazz.getConstructor(SmartContext.class, MetaStore.class);
services.add((ActionSchedulerService) c.newInstance(context, metaStore));
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException | NullPointerException e) {
if (allMustSuccess) {
throw new IOException(e);
} else {
LOG.warn("Error while create action scheduler service '" + name + "'.", e);
}
}
}
return services;
}
Aggregations