use of com.cloudera.kitten.lua.LuaWrapper 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();
}
Aggregations