Search in sources :

Example 1 with DistributedResourcePool

use of org.apache.zeppelin.resource.DistributedResourcePool in project zeppelin by apache.

the class Helium method suggestApp.

public HeliumPackageSuggestion suggestApp(Paragraph paragraph) {
    HeliumPackageSuggestion suggestion = new HeliumPackageSuggestion();
    Interpreter intp = paragraph.getCurrentRepl();
    if (intp == null) {
        return suggestion;
    }
    ResourcePool resourcePool = intp.getInterpreterGroup().getResourcePool();
    ResourceSet allResources;
    if (resourcePool != null) {
        if (resourcePool instanceof DistributedResourcePool) {
            allResources = ((DistributedResourcePool) resourcePool).getAll(true);
        } else {
            allResources = resourcePool.getAll();
        }
    } else {
        allResources = ResourcePoolUtils.getAllResources();
    }
    for (List<HeliumPackageSearchResult> pkgs : getAllPackageInfoWithoutRefresh().values()) {
        for (HeliumPackageSearchResult pkg : pkgs) {
            if (pkg.getPkg().getType() == HeliumType.APPLICATION && pkg.isEnabled()) {
                ResourceSet resources = ApplicationLoader.findRequiredResourceSet(pkg.getPkg().getResources(), paragraph.getNote().getId(), paragraph.getId(), allResources);
                if (resources == null) {
                    continue;
                } else {
                    suggestion.addAvailablePackage(pkg);
                }
                break;
            }
        }
    }
    suggestion.sort();
    return suggestion;
}
Also used : Interpreter(org.apache.zeppelin.interpreter.Interpreter) ResourcePool(org.apache.zeppelin.resource.ResourcePool) DistributedResourcePool(org.apache.zeppelin.resource.DistributedResourcePool) ResourceSet(org.apache.zeppelin.resource.ResourceSet) DistributedResourcePool(org.apache.zeppelin.resource.DistributedResourcePool)

Aggregations

Interpreter (org.apache.zeppelin.interpreter.Interpreter)1 DistributedResourcePool (org.apache.zeppelin.resource.DistributedResourcePool)1 ResourcePool (org.apache.zeppelin.resource.ResourcePool)1 ResourceSet (org.apache.zeppelin.resource.ResourceSet)1