extras.putEnv(LuaFields.KITTEN_LOCAL_FILE_TO_URI, LocalDataHelper.serialize(localToUris));
return new LuaContainerLaunchParameters(env.getTable(LuaFields.MASTER), conf, localToUris, extras);
}
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();
}