Search in sources :

Example 1 with LuaPair

use of com.cloudera.kitten.lua.LuaPair in project kitten by cloudera.

the class LuaApplicationMasterParameters method getContainerLaunchParameters.

@Override
public List<ContainerLaunchParameters> getContainerLaunchParameters() {
    if (!env.isNil(LuaFields.CONTAINERS)) {
        List<ContainerLaunchParameters> clp = Lists.newArrayList();
        Iterator<LuaPair> iter = env.getTable(LuaFields.CONTAINERS).arrayIterator();
        while (iter.hasNext()) {
            clp.add(new LuaContainerLaunchParameters(iter.next().value, conf, localToUris));
        }
        return clp;
    } else if (!env.isNil(LuaFields.CONTAINER)) {
        return ImmutableList.<ContainerLaunchParameters>of(new LuaContainerLaunchParameters(env.getTable(LuaFields.CONTAINER), conf, localToUris));
    }
    return ImmutableList.of();
}
Also used : LuaContainerLaunchParameters(com.cloudera.kitten.lua.LuaContainerLaunchParameters) ContainerLaunchParameters(com.cloudera.kitten.ContainerLaunchParameters) LuaContainerLaunchParameters(com.cloudera.kitten.lua.LuaContainerLaunchParameters) LuaPair(com.cloudera.kitten.lua.LuaPair)

Example 2 with LuaPair

use of com.cloudera.kitten.lua.LuaPair in project kitten by cloudera.

the class LuaYarnClientParameters method mapLocalFiles.

private Map<String, URI> mapLocalFiles(ApplicationId applicationId) {
    LocalDataHelper lfh = new LocalDataHelper(applicationId, conf);
    // Map the configuration object as an XML file.
    try {
        lfh.copyConfiguration(LuaFields.KITTEN_JOB_XML_FILE, conf);
    } catch (IOException e) {
        LOG.error("Error copying configuration object", e);
    }
    // Map the files that were specified by the framework itself.
    for (String localFileName : extras.getResources().values()) {
        try {
            lfh.copyToHdfs(localFileName);
        } catch (IOException e) {
            LOG.error("Error copying local file " + localFileName + " to hdfs", e);
        }
    }
    // Map all of the local files that the appmaster will need.
    mapLocalFiles(env.getTable(LuaFields.MASTER), lfh);
    // Map all of the files that the containers will need.   
    if (!env.isNil(LuaFields.CONTAINERS)) {
        Iterator<LuaPair> iter = env.getTable(LuaFields.CONTAINERS).arrayIterator();
        while (iter.hasNext()) {
            mapLocalFiles(new LuaWrapper(iter.next().value.checktable()), lfh);
        }
    } else if (!env.isNil(LuaFields.CONTAINER)) {
        mapLocalFiles(env.getTable(LuaFields.CONTAINER), lfh);
    }
    return lfh.getFileMapping();
}
Also used : LuaWrapper(com.cloudera.kitten.lua.LuaWrapper) LocalDataHelper(com.cloudera.kitten.util.LocalDataHelper) IOException(java.io.IOException) LuaPair(com.cloudera.kitten.lua.LuaPair)

Aggregations

LuaPair (com.cloudera.kitten.lua.LuaPair)2 ContainerLaunchParameters (com.cloudera.kitten.ContainerLaunchParameters)1 LuaContainerLaunchParameters (com.cloudera.kitten.lua.LuaContainerLaunchParameters)1 LuaWrapper (com.cloudera.kitten.lua.LuaWrapper)1 LocalDataHelper (com.cloudera.kitten.util.LocalDataHelper)1 IOException (java.io.IOException)1