Search in sources :

Example 1 with LocalDataHelper

use of com.cloudera.kitten.util.LocalDataHelper 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)1 LuaWrapper (com.cloudera.kitten.lua.LuaWrapper)1 LocalDataHelper (com.cloudera.kitten.util.LocalDataHelper)1 IOException (java.io.IOException)1