use of org.apache.airavata.cloud.aurora.client.sdk.JobConfiguration in project airavata by apache.
the class AuroraThriftClientUtil method getAuroraJobConfig.
/**
* Gets the aurora job config.
*
* @param jobConfigBean the job config bean
* @return the aurora job config
* @throws Exception the exception
*/
public static JobConfiguration getAuroraJobConfig(JobConfigBean jobConfigBean) throws Exception {
JobConfiguration jobConfig = null;
try {
if (jobConfigBean != null && jobConfigBean.getTaskConfig() != null) {
JobKey jobKey = getAuroraJobKey(jobConfigBean.getJob());
Identity owner = getAuroraIdentity(jobConfigBean.getOwner());
// Construct the task config
TaskConfig taskConfig = new TaskConfig();
taskConfig.setJob(jobKey);
taskConfig.setOwner(owner);
taskConfig.setIsService(jobConfigBean.isService());
taskConfig.setNumCpus(jobConfigBean.getTaskConfig().getResources().getNumCpus());
taskConfig.setRamMb(jobConfigBean.getTaskConfig().getResources().getRamMb());
taskConfig.setDiskMb(jobConfigBean.getTaskConfig().getResources().getDiskMb());
taskConfig.setPriority(jobConfigBean.getPriority());
taskConfig.setMaxTaskFailures(jobConfigBean.getMaxTaskFailures());
taskConfig.setResources(getResourceSet(jobConfigBean.getTaskConfig().getResources()));
// construct the executor config for this job
taskConfig.setExecutorConfig(getExecutorConfig(getExecutorConfigJson(jobConfigBean)));
// construct the job configuration
jobConfig = new JobConfiguration(jobKey, owner, null, taskConfig, jobConfigBean.getInstances());
} else {
throw new Exception("JobConfig, TaskConfig Bean is/are NULL!");
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
throw ex;
}
return jobConfig;
}
use of org.apache.airavata.cloud.aurora.client.sdk.JobConfiguration in project airavata by apache.
the class AuroraThriftClient method createJob.
/**
* Creates the job.
*
* @param jobConfigBean the job config bean
* @return the response bean
* @throws Exception the exception
*/
public ResponseBean createJob(JobConfigBean jobConfigBean) throws Exception {
ResponseBean response = null;
// try till we get response or scheduler connection not found
while (response == null) {
try {
if (jobConfigBean != null) {
JobConfiguration jobConfig = AuroraThriftClientUtil.getAuroraJobConfig(jobConfigBean);
Response createJobResponse = this.auroraSchedulerManagerClient.createJob(jobConfig);
response = AuroraThriftClientUtil.getResponseBean(createJobResponse, ResponseResultType.CREATE_JOB);
}
} 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