use of org.apache.airavata.cloud.aurora.client.bean.PendingJobReasonBean in project airavata by apache.
the class AuroraThriftClientUtil method getPendingJobReasonBean.
/**
* Gets the pending job reason bean.
*
* @param response the response
* @return the pending job reason bean
*/
private static PendingJobReasonBean getPendingJobReasonBean(Response response) {
PendingJobReasonBean responseBean = null;
if (response != null) {
responseBean = new PendingJobReasonBean(getJobResponse(response));
responseBean.setReasons(response.getResult().getGetPendingReasonResult().getReasons());
}
return responseBean;
}
use of org.apache.airavata.cloud.aurora.client.bean.PendingJobReasonBean in project airavata by apache.
the class AuroraThriftClient method getPendingReasonForJob.
/**
* Gets the pending reason for job.
*
* @param jobKeyBean the job key bean
* @return the pending reason for job
* @throws Exception the exception
*/
public PendingJobReasonBean getPendingReasonForJob(JobKeyBean jobKeyBean) throws Exception {
PendingJobReasonBean response = null;
// try till we get response or scheduler connection not found
while (response == null) {
try {
JobKey jobKey = AuroraThriftClientUtil.getAuroraJobKey(jobKeyBean);
Set<JobKey> jobKeySet = new HashSet<>();
jobKeySet.add(jobKey);
TaskQuery query = new TaskQuery();
query.setJobKeys(jobKeySet);
Response pendingReasonResponse = this.readOnlySchedulerClient.getPendingReason(query);
response = (PendingJobReasonBean) AuroraThriftClientUtil.getResponseBean(pendingReasonResponse, ResponseResultType.GET_PENDING_JOB_REASON);
} catch (Exception ex) {
if (ex instanceof TTransportException) {
// if re-connection success, retry command
if (this.reconnectWithAuroraScheduler()) {
continue;
}
}
logger.error(ex.getMessage(), ex);
throw ex;
}
}
return response;
}
Aggregations