use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.
the class AzkabanJobStatusUtil method doLogin.
public WorkflowClient doLogin(AzkabanWorkflowClient workflowClient) {
Long _currentTime = System.currentTimeMillis();
if (_currentTime - workflowClient.getSessionUpdatedTime() > TOKEN_UPDATE_INTERVAL) {
logger.info("Creating a new session with Azkaban");
SchedulerConfigurationData schedulerData = InfoExtractor.getSchedulerData(scheduler);
if (schedulerData == null) {
throw new RuntimeException(String.format("Cannot find scheduler %s for url %s", scheduler));
}
if (!schedulerData.getParamMap().containsKey(USERNAME)) {
throw new RuntimeException(String.format("Cannot find username for login"));
}
String username = schedulerData.getParamMap().get(USERNAME);
if (schedulerData.getParamMap().containsKey(PRIVATE_KEY)) {
workflowClient.login(username, new File(schedulerData.getParamMap().get(PRIVATE_KEY)));
} else if (schedulerData.getParamMap().containsKey(PASSWORD)) {
workflowClient.login(username, schedulerData.getParamMap().get(PASSWORD));
} else {
throw new RuntimeException("Neither private key nor password was specified");
}
workflowClient.setSessionUpdatedTime(_currentTime);
}
return workflowClient;
}
Aggregations