use of org.apache.airavata.cloud.aurora.client.bean.GetJobsResponseBean in project airavata by apache.
the class AuroraThriftClient method getJobList.
/**
* Gets the job list.
*
* @param ownerRole the owner role
* @return the job list
* @throws Exception the exception
*/
public GetJobsResponseBean getJobList(String ownerRole) throws Exception {
GetJobsResponseBean response = null;
// try till we get response or scheduler connection not found
while (response == null) {
try {
Response jobListResponse = this.readOnlySchedulerClient.getJobs(ownerRole);
response = (GetJobsResponseBean) AuroraThriftClientUtil.getResponseBean(jobListResponse, ResponseResultType.GET_JOBS);
} 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;
}
use of org.apache.airavata.cloud.aurora.client.bean.GetJobsResponseBean in project airavata by apache.
the class AuroraClientSample method getRunningJobsList.
/**
* Gets the job summary.
*
* @param client the client
* @return the job summary
* @throws Exception
*/
public static void getRunningJobsList(String ownerRole) throws Exception {
try {
AuroraThriftClient client = AuroraThriftClient.getAuroraThriftClient();
ResponseBean response = client.getJobList(ownerRole);
System.out.println("Response status: " + response.getResponseCode().name());
if (response instanceof GetJobsResponseBean) {
GetJobsResponseBean result = (GetJobsResponseBean) response;
System.out.println(result);
Set<JobConfigBean> jobConfigs = result.getJobConfigs();
for (JobConfigBean jobConfig : jobConfigs) {
System.out.println(jobConfig);
JobKeyBean jobKey = jobConfig.getJob();
IdentityBean owner = jobConfig.getOwner();
TaskConfigBean taskConfig = jobConfig.getTaskConfig();
Set<ProcessBean> processes = taskConfig.getProcesses();
System.out.println("\n**** JOB CONFIG ****");
System.out.println("\t # cluster: " + jobConfig.getCluster());
System.out.println("\t # instanceCount: " + jobConfig.getInstances());
System.out.println("\t # isService: " + jobConfig.isService());
System.out.println("\t\t # priority: " + jobConfig.getPriority());
System.out.println("\t >> Job Key <<");
System.out.println("\t\t # name: " + jobKey.getName());
System.out.println("\t\t # role: " + jobKey.getRole());
System.out.println("\t\t # environment: " + jobKey.getEnvironment());
System.out.println("\t >> Identity <<");
System.out.println("\t\t # owner: " + owner.getUser());
System.out.println("\t >> Task Config <<");
System.out.println("\t\t >> Resources <<");
System.out.println("\t\t\t # numCPUs: " + taskConfig.getResources().getNumCpus());
System.out.println("\t\t\t # diskMb: " + taskConfig.getResources().getDiskMb());
System.out.println("\t\t\t # ramMb: " + taskConfig.getResources().getRamMb());
System.out.println("\t\t >> Processes <<");
for (ProcessBean process : processes) {
System.out.println("\t\t\t ***** PROCESS *****");
System.out.println("\t\t\t # name: " + process.getName());
System.out.println("\t\t\t # cmdline: " + process.getCmdLine());
}
}
}
} catch (TException e) {
e.printStackTrace();
}
}
Aggregations