use of org.apache.airavata.cloud.aurora.client.sdk.TaskConfig 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;
}
Aggregations