Search in sources :

Example 1 with TaskDetails

use of org.apache.airavata.model.experiment.TaskDetails in project airavata by apache.

the class ResourceProcessor method generateResourceElements.

public static void generateResourceElements(JobDefinitionType value, JobExecutionContext context) throws Exception {
    TaskDetails taskData = context.getTaskData();
    if (taskData != null && taskData.isSetTaskScheduling()) {
        try {
            ComputationalResourceScheduling crs = taskData.getTaskScheduling();
            if (crs.getTotalPhysicalMemory() > 0) {
                RangeValueType rangeType = new RangeValueType();
                rangeType.setLowerBound(Double.NaN);
                rangeType.setUpperBound(Double.NaN);
                rangeType.setExact(crs.getTotalPhysicalMemory());
                JSDLUtils.setIndividualPhysicalMemoryRequirements(value, rangeType);
            }
            if (crs.getNodeCount() > 0) {
                RangeValueType rangeType = new RangeValueType();
                rangeType.setLowerBound(Double.NaN);
                rangeType.setUpperBound(Double.NaN);
                rangeType.setExact(crs.getNodeCount());
                JSDLUtils.setTotalResourceCountRequirements(value, rangeType);
                // set totalcpu count to -1 as we dont need that
                crs.setTotalCPUCount(0);
            }
            if (crs.getWallTimeLimit() > 0) {
                RangeValueType cpuTime = new RangeValueType();
                cpuTime.setLowerBound(Double.NaN);
                cpuTime.setUpperBound(Double.NaN);
                long wallTime = crs.getWallTimeLimit() * 60;
                cpuTime.setExact(wallTime);
                JSDLUtils.setIndividualCPUTimeRequirements(value, cpuTime);
            }
            if (crs.getTotalCPUCount() > 0) {
                RangeValueType rangeType = new RangeValueType();
                rangeType.setLowerBound(Double.NaN);
                rangeType.setUpperBound(Double.NaN);
                rangeType.setExact(crs.getTotalCPUCount());
                JSDLUtils.setTotalCPUCountRequirements(value, rangeType);
            }
        } catch (NullPointerException npe) {
            new GFacProviderException("No value set for resource requirements.", npe);
        }
    }
}
Also used : ComputationalResourceScheduling(org.apache.airavata.model.experiment.ComputationalResourceScheduling) TaskDetails(org.apache.airavata.model.experiment.TaskDetails) GFacProviderException(org.apache.airavata.gfac.core.provider.GFacProviderException)

Example 2 with TaskDetails

use of org.apache.airavata.model.experiment.TaskDetails in project airavata by apache.

the class DataTransferrer method getDownloadLocation.

private String getDownloadLocation() {
    TaskDetails taskData = jobContext.getTaskData();
    // In case of third party transfer this will not work.
    // if (taskData != null && taskData.getAdvancedOutputDataHandling() != null) {
    // String outputDataDirectory = taskData.getAdvancedOutputDataHandling().getOutputDataDir();
    // return outputDataDirectory;
    // }
    String outputDataDir = File.separator + "tmp";
    outputDataDir = outputDataDir + File.separator + jobContext.getExperimentID();
    (new File(outputDataDir)).mkdirs();
    return outputDataDir;
}
Also used : TaskDetails(org.apache.airavata.model.experiment.TaskDetails) File(java.io.File)

Aggregations

TaskDetails (org.apache.airavata.model.experiment.TaskDetails)2 File (java.io.File)1 GFacProviderException (org.apache.airavata.gfac.core.provider.GFacProviderException)1 ComputationalResourceScheduling (org.apache.airavata.model.experiment.ComputationalResourceScheduling)1