use of org.apache.airavata.gfac.core.config.JobSubmitterTaskConfig in project airavata by apache.
the class Factory method loadConfiguration.
public static void loadConfiguration() throws GFacException {
GFacYamlConfigruation config = new GFacYamlConfigruation();
try {
for (JobSubmitterTaskConfig jobSubmitterTaskConfig : config.getJobSbumitters()) {
String taskClass = jobSubmitterTaskConfig.getTaskClass();
Class<?> aClass = Class.forName(taskClass);
Constructor<?> constructor = aClass.getConstructor();
JobSubmissionTask task = (JobSubmissionTask) constructor.newInstance();
task.init(jobSubmitterTaskConfig.getProperties());
jobSubmissionTask.put(jobSubmitterTaskConfig.getSubmissionProtocol(), task);
}
for (DataTransferTaskConfig dataTransferTaskConfig : config.getFileTransferTasks()) {
String taskClass = dataTransferTaskConfig.getTaskClass();
Class<?> aClass = Class.forName(taskClass);
Constructor<?> constructor = aClass.getConstructor();
Task task = (Task) constructor.newInstance();
task.init(dataTransferTaskConfig.getProperties());
dataMovementTask.put(dataTransferTaskConfig.getTransferProtocol(), task);
}
for (ResourceConfig resourceConfig : config.getResourceConfiguration()) {
resources.put(resourceConfig.getJobManagerType(), resourceConfig);
}
} catch (Exception e) {
throw new GFacException("Gfac config issue", e);
}
sessionCache = CacheBuilder.newBuilder().expireAfterAccess(ServerSettings.getSessionCacheAccessTimeout(), TimeUnit.MINUTES).removalListener((RemovalListener<String, Session>) removalNotification -> {
if (removalNotification.getValue().isConnected()) {
log.info("Disconnecting ssh session with key: " + removalNotification.getKey());
removalNotification.getValue().disconnect();
}
log.info("Removed ssh session with key: " + removalNotification.getKey());
}).build();
}
Aggregations