Search in sources :

Example 1 with HostScheduler

use of org.apache.airavata.gfac.core.scheduler.HostScheduler in project airavata by apache.

the class OrchestratorServerHandler method getAppDeploymentForModule.

private ApplicationDeploymentDescription getAppDeploymentForModule(ProcessModel processModel, String selectedModuleId) throws AppCatalogException, ClassNotFoundException, ApplicationSettingsException, InstantiationException, IllegalAccessException {
    Map<String, String> moduleIdFilter = new HashMap<String, String>();
    moduleIdFilter.put(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, selectedModuleId);
    if (processModel.getProcessResourceSchedule() != null && processModel.getProcessResourceSchedule().getResourceHostId() != null) {
        moduleIdFilter.put(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, processModel.getProcessResourceSchedule().getResourceHostId());
    }
    List<ApplicationDeploymentDescription> applicationDeployements = appCatalog.getApplicationDeployment().getApplicationDeployements(moduleIdFilter);
    Map<ComputeResourceDescription, ApplicationDeploymentDescription> deploymentMap = new HashMap<ComputeResourceDescription, ApplicationDeploymentDescription>();
    ComputeResource computeResource = appCatalog.getComputeResource();
    for (ApplicationDeploymentDescription deploymentDescription : applicationDeployements) {
        deploymentMap.put(computeResource.getComputeResource(deploymentDescription.getComputeHostId()), deploymentDescription);
    }
    List<ComputeResourceDescription> computeHostList = Arrays.asList(deploymentMap.keySet().toArray(new ComputeResourceDescription[] {}));
    Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
    HostScheduler hostScheduler = aClass.newInstance();
    ComputeResourceDescription ComputeResourceDescription = hostScheduler.schedule(computeHostList);
    return deploymentMap.get(ComputeResourceDescription);
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) HostScheduler(org.apache.airavata.gfac.core.scheduler.HostScheduler) ComputeResourceDescription(org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)

Aggregations

HostScheduler (org.apache.airavata.gfac.core.scheduler.HostScheduler)1 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)1 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)1