Search in sources :

Example 1 with TaskQuery

use of org.apache.airavata.cloud.aurora.client.sdk.TaskQuery in project airavata by apache.

the class AuroraThriftClient method getJobDetails.

/**
 * Gets the job details.
 *
 * @param jobKeyBean the job key bean
 * @return the job details
 * @throws Exception the exception
 */
public JobDetailsResponseBean getJobDetails(JobKeyBean jobKeyBean) throws Exception {
    JobDetailsResponseBean response = null;
    // try till we get response or scheduler connection not found
    while (response == null) {
        try {
            if (jobKeyBean != null) {
                JobKey jobKey = AuroraThriftClientUtil.getAuroraJobKey(jobKeyBean);
                Set<JobKey> jobKeySet = new HashSet<>();
                jobKeySet.add(jobKey);
                TaskQuery query = new TaskQuery();
                query.setJobKeys(jobKeySet);
                Response jobDetailsResponse = this.readOnlySchedulerClient.getTasksStatus(query);
                response = (JobDetailsResponseBean) AuroraThriftClientUtil.getResponseBean(jobDetailsResponse, ResponseResultType.GET_JOB_DETAILS);
            }
        } 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;
}
Also used : Response(org.apache.airavata.cloud.aurora.client.sdk.Response) JobKey(org.apache.airavata.cloud.aurora.client.sdk.JobKey) JobDetailsResponseBean(org.apache.airavata.cloud.aurora.client.bean.JobDetailsResponseBean) TaskQuery(org.apache.airavata.cloud.aurora.client.sdk.TaskQuery) TTransportException(org.apache.thrift.transport.TTransportException) TTransportException(org.apache.thrift.transport.TTransportException) HashSet(java.util.HashSet)

Example 2 with TaskQuery

use of org.apache.airavata.cloud.aurora.client.sdk.TaskQuery 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;
}
Also used : Response(org.apache.airavata.cloud.aurora.client.sdk.Response) JobKey(org.apache.airavata.cloud.aurora.client.sdk.JobKey) PendingJobReasonBean(org.apache.airavata.cloud.aurora.client.bean.PendingJobReasonBean) TaskQuery(org.apache.airavata.cloud.aurora.client.sdk.TaskQuery) TTransportException(org.apache.thrift.transport.TTransportException) TTransportException(org.apache.thrift.transport.TTransportException) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 JobKey (org.apache.airavata.cloud.aurora.client.sdk.JobKey)2 Response (org.apache.airavata.cloud.aurora.client.sdk.Response)2 TaskQuery (org.apache.airavata.cloud.aurora.client.sdk.TaskQuery)2 TTransportException (org.apache.thrift.transport.TTransportException)2 JobDetailsResponseBean (org.apache.airavata.cloud.aurora.client.bean.JobDetailsResponseBean)1 PendingJobReasonBean (org.apache.airavata.cloud.aurora.client.bean.PendingJobReasonBean)1