Search in sources :

Example 1 with TaskConfig

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;
}
Also used : JobKey(org.apache.airavata.cloud.aurora.client.sdk.JobKey) TaskConfig(org.apache.airavata.cloud.aurora.client.sdk.TaskConfig) Identity(org.apache.airavata.cloud.aurora.client.sdk.Identity) JobConfiguration(org.apache.airavata.cloud.aurora.client.sdk.JobConfiguration)

Aggregations

Identity (org.apache.airavata.cloud.aurora.client.sdk.Identity)1 JobConfiguration (org.apache.airavata.cloud.aurora.client.sdk.JobConfiguration)1 JobKey (org.apache.airavata.cloud.aurora.client.sdk.JobKey)1 TaskConfig (org.apache.airavata.cloud.aurora.client.sdk.TaskConfig)1