id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
118,200 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/ProtocolCompatible.java | ProtocolCompatible.isCompatibleClientProtocol | public static boolean isCompatibleClientProtocol(
long clientVersion, long serverVersion) {
return clientVersion == serverVersion ||
(
( clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION-1 ||
clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION ||
... | java | public static boolean isCompatibleClientProtocol(
long clientVersion, long serverVersion) {
return clientVersion == serverVersion ||
(
( clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION-1 ||
clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION ||
... | [
"public",
"static",
"boolean",
"isCompatibleClientProtocol",
"(",
"long",
"clientVersion",
",",
"long",
"serverVersion",
")",
"{",
"return",
"clientVersion",
"==",
"serverVersion",
"||",
"(",
"(",
"clientVersion",
"==",
"ClientProtocol",
".",
"OPTIMIZE_FILE_STATUS_VERSI... | Check if the client and NameNode have compatible ClientProtocol versions
@param clientVersion the version of ClientProtocol that client has
@param serverVersion the version of ClientProtocol that NameNode has
@return true if two versions are compatible | [
"Check",
"if",
"the",
"client",
"and",
"NameNode",
"have",
"compatible",
"ClientProtocol",
"versions"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/ProtocolCompatible.java#L16-L40 |
118,201 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/ProtocolCompatible.java | ProtocolCompatible.isCompatibleClientDatanodeProtocol | public static boolean isCompatibleClientDatanodeProtocol(
long clientVersion, long serverVersion) {
return clientVersion == serverVersion ||
(
( clientVersion == ClientDatanodeProtocol.GET_BLOCKINFO_VERSION-1 ||
clientVersion == ClientDatanodeProtocol.GET_BLOCKINFO_VERSION... | java | public static boolean isCompatibleClientDatanodeProtocol(
long clientVersion, long serverVersion) {
return clientVersion == serverVersion ||
(
( clientVersion == ClientDatanodeProtocol.GET_BLOCKINFO_VERSION-1 ||
clientVersion == ClientDatanodeProtocol.GET_BLOCKINFO_VERSION... | [
"public",
"static",
"boolean",
"isCompatibleClientDatanodeProtocol",
"(",
"long",
"clientVersion",
",",
"long",
"serverVersion",
")",
"{",
"return",
"clientVersion",
"==",
"serverVersion",
"||",
"(",
"(",
"clientVersion",
"==",
"ClientDatanodeProtocol",
".",
"GET_BLOCKI... | Check if the client and DataNode have compatible ClientDataNodeProtocol versions
@param clientVersion the version of ClientDatanodeProtocol that client has
@param serverVersion the version of ClientDatanodeProtocol that DataNode has
@return true if two versions are compatible | [
"Check",
"if",
"the",
"client",
"and",
"DataNode",
"have",
"compatible",
"ClientDataNodeProtocol",
"versions"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/ProtocolCompatible.java#L49-L61 |
118,202 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java | HighTideNode.stop | public void stop() {
if (stopRequested) {
return;
}
stopRequested = true;
running = false;
if (server != null) server.stop();
if (triggerThread != null) triggerThread.interrupt();
if (fileFixer != null) fileFixer.shutdown();
if (fileFixerThread != null) fileFixerThread.interrupt();... | java | public void stop() {
if (stopRequested) {
return;
}
stopRequested = true;
running = false;
if (server != null) server.stop();
if (triggerThread != null) triggerThread.interrupt();
if (fileFixer != null) fileFixer.shutdown();
if (fileFixerThread != null) fileFixerThread.interrupt();... | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"stopRequested",
")",
"{",
"return",
";",
"}",
"stopRequested",
"=",
"true",
";",
"running",
"=",
"false",
";",
"if",
"(",
"server",
"!=",
"null",
")",
"server",
".",
"stop",
"(",
")",
";",
"if",
... | Stop all HighTideNode threads and wait for all to finish. | [
"Stop",
"all",
"HighTideNode",
"threads",
"and",
"wait",
"for",
"all",
"to",
"finish",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java#L202-L215 |
118,203 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java | HighTideNode.shutdown | void shutdown() throws IOException, InterruptedException {
configMgr.stopReload(); // stop config reloads
fileFixer.shutdown(); // stop block fixer
fileFixerThread.interrupt();
server.stop(); // stop http server
} | java | void shutdown() throws IOException, InterruptedException {
configMgr.stopReload(); // stop config reloads
fileFixer.shutdown(); // stop block fixer
fileFixerThread.interrupt();
server.stop(); // stop http server
} | [
"void",
"shutdown",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"configMgr",
".",
"stopReload",
"(",
")",
";",
"// stop config reloads",
"fileFixer",
".",
"shutdown",
"(",
")",
";",
"// stop block fixer",
"fileFixerThread",
".",
"interrupt",... | Shuts down the HighTideNode | [
"Shuts",
"down",
"the",
"HighTideNode"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java#L416-L421 |
118,204 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java | HighTideNode.createHighTideNode | public static HighTideNode createHighTideNode(String argv[],
Configuration conf) throws IOException {
if (conf == null) {
conf = new Configuration();
}
StartupOption startOpt = parseArguments(argv);
if (startOpt == null) {
printUsage();
return nu... | java | public static HighTideNode createHighTideNode(String argv[],
Configuration conf) throws IOException {
if (conf == null) {
conf = new Configuration();
}
StartupOption startOpt = parseArguments(argv);
if (startOpt == null) {
printUsage();
return nu... | [
"public",
"static",
"HighTideNode",
"createHighTideNode",
"(",
"String",
"argv",
"[",
"]",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"conf",
"==",
"null",
")",
"{",
"conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"}",
... | Create an instance of the HighTideNode | [
"Create",
"an",
"instance",
"of",
"the",
"HighTideNode"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/HighTideNode.java#L471-L484 |
118,205 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.stat2Paths | public static Path[] stat2Paths(FileStatus[] stats) {
if (stats == null)
return null;
Path[] ret = new Path[stats.length];
for (int i = 0; i < stats.length; ++i) {
ret[i] = stats[i].getPath();
}
return ret;
} | java | public static Path[] stat2Paths(FileStatus[] stats) {
if (stats == null)
return null;
Path[] ret = new Path[stats.length];
for (int i = 0; i < stats.length; ++i) {
ret[i] = stats[i].getPath();
}
return ret;
} | [
"public",
"static",
"Path",
"[",
"]",
"stat2Paths",
"(",
"FileStatus",
"[",
"]",
"stats",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"return",
"null",
";",
"Path",
"[",
"]",
"ret",
"=",
"new",
"Path",
"[",
"stats",
".",
"length",
"]",
";",
... | convert an array of FileStatus to an array of Path
@param stats
an array of FileStatus objects
@return an array of paths corresponding to the input | [
"convert",
"an",
"array",
"of",
"FileStatus",
"to",
"an",
"array",
"of",
"Path"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L53-L61 |
118,206 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.stat2Paths | public static Path[] stat2Paths(FileStatus[] stats, Path path) {
if (stats == null)
return new Path[]{path};
else
return stat2Paths(stats);
} | java | public static Path[] stat2Paths(FileStatus[] stats, Path path) {
if (stats == null)
return new Path[]{path};
else
return stat2Paths(stats);
} | [
"public",
"static",
"Path",
"[",
"]",
"stat2Paths",
"(",
"FileStatus",
"[",
"]",
"stats",
",",
"Path",
"path",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"return",
"new",
"Path",
"[",
"]",
"{",
"path",
"}",
";",
"else",
"return",
"stat2Paths",
... | convert an array of FileStatus to an array of Path.
If stats if null, return path
@param stats
an array of FileStatus objects
@param path
default path to return in stats is null
@return an array of paths corresponding to the input | [
"convert",
"an",
"array",
"of",
"FileStatus",
"to",
"an",
"array",
"of",
"Path",
".",
"If",
"stats",
"if",
"null",
"return",
"path"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L72-L77 |
118,207 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.fullyDelete | public static boolean fullyDelete(File dir) throws IOException {
boolean deleted = true;
File contents[] = dir.listFiles();
if (contents != null) {
for (int i = 0; i < contents.length; i++) {
if (contents[i].isFile()) {
if (!contents[i].delete()) {
deleted = false;
... | java | public static boolean fullyDelete(File dir) throws IOException {
boolean deleted = true;
File contents[] = dir.listFiles();
if (contents != null) {
for (int i = 0; i < contents.length; i++) {
if (contents[i].isFile()) {
if (!contents[i].delete()) {
deleted = false;
... | [
"public",
"static",
"boolean",
"fullyDelete",
"(",
"File",
"dir",
")",
"throws",
"IOException",
"{",
"boolean",
"deleted",
"=",
"true",
";",
"File",
"contents",
"[",
"]",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"contents",
"!=",
"null",
... | Delete a directory and all its contents. If
we return false, the directory may be partially-deleted. | [
"Delete",
"a",
"directory",
"and",
"all",
"its",
"contents",
".",
"If",
"we",
"return",
"false",
"the",
"directory",
"may",
"be",
"partially",
"-",
"deleted",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L83-L110 |
118,208 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.fullyDelete | @Deprecated
public static void fullyDelete(FileSystem fs, Path dir)
throws IOException {
fs.delete(dir, true);
} | java | @Deprecated
public static void fullyDelete(FileSystem fs, Path dir)
throws IOException {
fs.delete(dir, true);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"fullyDelete",
"(",
"FileSystem",
"fs",
",",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"fs",
".",
"delete",
"(",
"dir",
",",
"true",
")",
";",
"}"
] | Recursively delete a directory.
@param fs {@link FileSystem} on which the path is present
@param dir directory to recursively delete
@throws IOException
@deprecated Use {@link FileSystem#delete(Path, boolean)} | [
"Recursively",
"delete",
"a",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L120-L124 |
118,209 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.copy | public static boolean copy(FileSystem srcFS, Path src,
FileSystem dstFS, Path dst,
boolean deleteSource,
Configuration conf) throws IOException {
return copy(srcFS, src, dstFS, dst, deleteSource, true, conf);
} | java | public static boolean copy(FileSystem srcFS, Path src,
FileSystem dstFS, Path dst,
boolean deleteSource,
Configuration conf) throws IOException {
return copy(srcFS, src, dstFS, dst, deleteSource, true, conf);
} | [
"public",
"static",
"boolean",
"copy",
"(",
"FileSystem",
"srcFS",
",",
"Path",
"src",
",",
"FileSystem",
"dstFS",
",",
"Path",
"dst",
",",
"boolean",
"deleteSource",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"copy",
"(",
"sr... | Copy files between FileSystems. | [
"Copy",
"files",
"between",
"FileSystems",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L150-L155 |
118,210 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.copy | public static boolean copy(FileSystem srcFS, Path src,
FileSystem dstFS, Path dst,
boolean deleteSource,
boolean overwrite, boolean validate,
Configuration conf,
IOThrottler... | java | public static boolean copy(FileSystem srcFS, Path src,
FileSystem dstFS, Path dst,
boolean deleteSource,
boolean overwrite, boolean validate,
Configuration conf,
IOThrottler... | [
"public",
"static",
"boolean",
"copy",
"(",
"FileSystem",
"srcFS",
",",
"Path",
"src",
",",
"FileSystem",
"dstFS",
",",
"Path",
"dst",
",",
"boolean",
"deleteSource",
",",
"boolean",
"overwrite",
",",
"boolean",
"validate",
",",
"Configuration",
"conf",
",",
... | Copy files between file systems
@param srcFS source file system
@param src source file
@param dstFS destination file system
@param dst destination file
@param deleteSource if source should be deleted
@param overwrite if destination could be overwritten if exists
@param validate if source and destination should be valid... | [
"Copy",
"files",
"between",
"file",
"systems"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L293-L347 |
118,211 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.copy | public static boolean copy(File src,
FileSystem dstFS, Path dst,
boolean deleteSource,
Configuration conf) throws IOException {
dst = checkDest(src.getName(), dstFS, dst, false);
if (src.isDirectory()) {
if (!dstFS.mkd... | java | public static boolean copy(File src,
FileSystem dstFS, Path dst,
boolean deleteSource,
Configuration conf) throws IOException {
dst = checkDest(src.getName(), dstFS, dst, false);
if (src.isDirectory()) {
if (!dstFS.mkd... | [
"public",
"static",
"boolean",
"copy",
"(",
"File",
"src",
",",
"FileSystem",
"dstFS",
",",
"Path",
"dst",
",",
"boolean",
"deleteSource",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"dst",
"=",
"checkDest",
"(",
"src",
".",
"getName",
... | Copy local files to a FileSystem. | [
"Copy",
"local",
"files",
"to",
"a",
"FileSystem",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L394-L430 |
118,212 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.copy | public static boolean copy(FileSystem srcFS, Path src,
File dst, boolean deleteSource,
Configuration conf) throws IOException {
return copy(srcFS, src, dst, deleteSource, conf, false, 0L);
} | java | public static boolean copy(FileSystem srcFS, Path src,
File dst, boolean deleteSource,
Configuration conf) throws IOException {
return copy(srcFS, src, dst, deleteSource, conf, false, 0L);
} | [
"public",
"static",
"boolean",
"copy",
"(",
"FileSystem",
"srcFS",
",",
"Path",
"src",
",",
"File",
"dst",
",",
"boolean",
"deleteSource",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"copy",
"(",
"srcFS",
",",
"src",
",",
"ds... | Copy FileSystem files to local files. | [
"Copy",
"FileSystem",
"files",
"to",
"local",
"files",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L433-L437 |
118,213 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.getDU | public static long getDU(File dir) {
long size = 0;
if (!dir.exists())
return 0;
if (!dir.isDirectory()) {
return dir.length();
} else {
size = dir.length();
File[] allFiles = dir.listFiles();
for (int i = 0; i < allFiles.length; i++) {
size = size + getDU(allFiles[... | java | public static long getDU(File dir) {
long size = 0;
if (!dir.exists())
return 0;
if (!dir.isDirectory()) {
return dir.length();
} else {
size = dir.length();
File[] allFiles = dir.listFiles();
for (int i = 0; i < allFiles.length; i++) {
size = size + getDU(allFiles[... | [
"public",
"static",
"long",
"getDU",
"(",
"File",
"dir",
")",
"{",
"long",
"size",
"=",
"0",
";",
"if",
"(",
"!",
"dir",
".",
"exists",
"(",
")",
")",
"return",
"0",
";",
"if",
"(",
"!",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
... | Takes an input dir and returns the du on that local directory. Very basic
implementation.
@param dir
The input dir to get the disk space of this local dir
@return The total disk space of the input local directory | [
"Takes",
"an",
"input",
"dir",
"and",
"returns",
"the",
"du",
"on",
"that",
"local",
"directory",
".",
"Very",
"basic",
"implementation",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L609-L623 |
118,214 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.unZip | public static void unZip(File inFile, File unzipDir) throws IOException {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(inFile);
try {
entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (!entry.isD... | java | public static void unZip(File inFile, File unzipDir) throws IOException {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(inFile);
try {
entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (!entry.isD... | [
"public",
"static",
"void",
"unZip",
"(",
"File",
"inFile",
",",
"File",
"unzipDir",
")",
"throws",
"IOException",
"{",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"entries",
";",
"ZipFile",
"zipFile",
"=",
"new",
"ZipFile",
"(",
"inFile",
")",
";... | Given a File input it will unzip the file in a the unzip directory
passed as the second parameter
@param inFile The zip file as input
@param unzipDir The unzip directory where to unzip the zip file.
@throws IOException | [
"Given",
"a",
"File",
"input",
"it",
"will",
"unzip",
"the",
"file",
"in",
"a",
"the",
"unzip",
"directory",
"passed",
"as",
"the",
"second",
"parameter"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L632-L668 |
118,215 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.unTar | public static void unTar(File inFile, File untarDir) throws IOException {
if (!untarDir.mkdirs()) {
if (!untarDir.isDirectory()) {
throw new IOException("Mkdirs failed to create " + untarDir);
}
}
StringBuffer untarCommand = new StringBuffer();
boolean gzipped = inFile.toString().en... | java | public static void unTar(File inFile, File untarDir) throws IOException {
if (!untarDir.mkdirs()) {
if (!untarDir.isDirectory()) {
throw new IOException("Mkdirs failed to create " + untarDir);
}
}
StringBuffer untarCommand = new StringBuffer();
boolean gzipped = inFile.toString().en... | [
"public",
"static",
"void",
"unTar",
"(",
"File",
"inFile",
",",
"File",
"untarDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"untarDir",
".",
"mkdirs",
"(",
")",
")",
"{",
"if",
"(",
"!",
"untarDir",
".",
"isDirectory",
"(",
")",
")",
"{",... | Given a Tar File as input it will untar the file in a the untar directory
passed as the second parameter
This utility will untar ".tar" files and ".tar.gz","tgz" files.
@param inFile The tar file as input.
@param untarDir The untar directory where to untar the tar file.
@throws IOException | [
"Given",
"a",
"Tar",
"File",
"as",
"input",
"it",
"will",
"untar",
"the",
"file",
"in",
"a",
"the",
"untar",
"directory",
"passed",
"as",
"the",
"second",
"parameter"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L680-L712 |
118,216 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.symLink | public static int symLink(String target, String linkname) throws IOException{
String cmd = "ln -s " + target + " " + linkname;
Process p = Runtime.getRuntime().exec(cmd, null);
int returnVal = -1;
try{
returnVal = p.waitFor();
} catch(InterruptedException e){
//do nothing as of yet
}... | java | public static int symLink(String target, String linkname) throws IOException{
String cmd = "ln -s " + target + " " + linkname;
Process p = Runtime.getRuntime().exec(cmd, null);
int returnVal = -1;
try{
returnVal = p.waitFor();
} catch(InterruptedException e){
//do nothing as of yet
}... | [
"public",
"static",
"int",
"symLink",
"(",
"String",
"target",
",",
"String",
"linkname",
")",
"throws",
"IOException",
"{",
"String",
"cmd",
"=",
"\"ln -s \"",
"+",
"target",
"+",
"\" \"",
"+",
"linkname",
";",
"Process",
"p",
"=",
"Runtime",
".",
"getRun... | Create a soft link between a src and destination
only on a local disk. HDFS does not support this
@param target the target for symlink
@param linkname the symlink
@return value returned by the command | [
"Create",
"a",
"soft",
"link",
"between",
"a",
"src",
"and",
"destination",
"only",
"on",
"a",
"local",
"disk",
".",
"HDFS",
"does",
"not",
"support",
"this"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L721-L731 |
118,217 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.chmod | public static int chmod(String filename, String perm
) throws IOException, InterruptedException {
return chmod(filename, perm, false);
} | java | public static int chmod(String filename, String perm
) throws IOException, InterruptedException {
return chmod(filename, perm, false);
} | [
"public",
"static",
"int",
"chmod",
"(",
"String",
"filename",
",",
"String",
"perm",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"chmod",
"(",
"filename",
",",
"perm",
",",
"false",
")",
";",
"}"
] | Change the permissions on a filename.
@param filename the name of the file to change
@param perm the permission string
@return the exit code from the command
@throws IOException
@throws InterruptedException | [
"Change",
"the",
"permissions",
"on",
"a",
"filename",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L741-L744 |
118,218 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.createLocalTempFile | public static final File createLocalTempFile(final File basefile,
final String prefix,
final boolean isDeleteOnExit)
throws IOException {
File tmp = File.createTempFile(prefix + basefile.getName(),
... | java | public static final File createLocalTempFile(final File basefile,
final String prefix,
final boolean isDeleteOnExit)
throws IOException {
File tmp = File.createTempFile(prefix + basefile.getName(),
... | [
"public",
"static",
"final",
"File",
"createLocalTempFile",
"(",
"final",
"File",
"basefile",
",",
"final",
"String",
"prefix",
",",
"final",
"boolean",
"isDeleteOnExit",
")",
"throws",
"IOException",
"{",
"File",
"tmp",
"=",
"File",
".",
"createTempFile",
"(",
... | Create a tmp file for a base file.
@param basefile the base file of the tmp
@param prefix file name prefix of tmp
@param isDeleteOnExit if true, the tmp will be deleted when the VM exits
@return a newly created tmp file
@exception IOException If a tmp file cannot created
@see java.io.File#createTempFile(String, String,... | [
"Create",
"a",
"tmp",
"file",
"for",
"a",
"base",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L788-L798 |
118,219 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.listStatusHelper | public static List<FileStatus> listStatusHelper(FileSystem fs, Path path,
int depth, List<FileStatus> acc) throws IOException {
FileStatus[] fileStatusResults = fs.listStatus(path);
if (fileStatusResults == null) {
throw new IOException("Path does not exist: " + path);
}
for (FileStatus f :... | java | public static List<FileStatus> listStatusHelper(FileSystem fs, Path path,
int depth, List<FileStatus> acc) throws IOException {
FileStatus[] fileStatusResults = fs.listStatus(path);
if (fileStatusResults == null) {
throw new IOException("Path does not exist: " + path);
}
for (FileStatus f :... | [
"public",
"static",
"List",
"<",
"FileStatus",
">",
"listStatusHelper",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
",",
"int",
"depth",
",",
"List",
"<",
"FileStatus",
">",
"acc",
")",
"throws",
"IOException",
"{",
"FileStatus",
"[",
"]",
"fileStatusResul... | Core logic for listStatus | [
"Core",
"logic",
"for",
"listStatus"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L836-L857 |
118,220 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.listStatusForLeafDir | public static void listStatusForLeafDir(FileSystem fs,
FileStatus pathStatus,
List<FileStatus> acc) throws IOException {
if (!pathStatus.isDir())
return;
FileStatus[] fileStatusResults = fs.listStatus(pathStatus.getPath());
if (fileStatusResults == null) {
throw new IOException("Path... | java | public static void listStatusForLeafDir(FileSystem fs,
FileStatus pathStatus,
List<FileStatus> acc) throws IOException {
if (!pathStatus.isDir())
return;
FileStatus[] fileStatusResults = fs.listStatus(pathStatus.getPath());
if (fileStatusResults == null) {
throw new IOException("Path... | [
"public",
"static",
"void",
"listStatusForLeafDir",
"(",
"FileSystem",
"fs",
",",
"FileStatus",
"pathStatus",
",",
"List",
"<",
"FileStatus",
">",
"acc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"pathStatus",
".",
"isDir",
"(",
")",
")",
"return",
... | pass in a directory path, get the list of statuses of leaf directories
@param fs file system
@param path path to scan
@param acc the collection of file status of leaf directories
@throws IOException if any error occurs | [
"pass",
"in",
"a",
"directory",
"path",
"get",
"the",
"list",
"of",
"statuses",
"of",
"leaf",
"directories"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L866-L886 |
118,221 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.replaceFile | public static void replaceFile(File src, File target) throws IOException {
/* renameTo() has two limitations on Windows platform.
* src.renameTo(target) fails if
* 1) If target already exists OR
* 2) If target is already open for reading/writing.
*/
if (!src.renameTo(target)) {
int ret... | java | public static void replaceFile(File src, File target) throws IOException {
/* renameTo() has two limitations on Windows platform.
* src.renameTo(target) fails if
* 1) If target already exists OR
* 2) If target is already open for reading/writing.
*/
if (!src.renameTo(target)) {
int ret... | [
"public",
"static",
"void",
"replaceFile",
"(",
"File",
"src",
",",
"File",
"target",
")",
"throws",
"IOException",
"{",
"/* renameTo() has two limitations on Windows platform.\n * src.renameTo(target) fails if\n * 1) If target already exists OR\n * 2) If target is already op... | Move the src file to the name specified by target.
@param src the source file
@param target the target file
@exception IOException If this operation fails | [
"Move",
"the",
"src",
"file",
"to",
"the",
"name",
"specified",
"by",
"target",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L915-L935 |
118,222 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/TupleWritable.java | TupleWritable.iterator | public Iterator<Writable> iterator() {
final TupleWritable t = this;
return new Iterator<Writable>() {
long i = written;
long last = 0L;
public boolean hasNext() {
return 0L != i;
}
public Writable next() {
last = Long.lowestOneBit(i);
if (0 == last)
... | java | public Iterator<Writable> iterator() {
final TupleWritable t = this;
return new Iterator<Writable>() {
long i = written;
long last = 0L;
public boolean hasNext() {
return 0L != i;
}
public Writable next() {
last = Long.lowestOneBit(i);
if (0 == last)
... | [
"public",
"Iterator",
"<",
"Writable",
">",
"iterator",
"(",
")",
"{",
"final",
"TupleWritable",
"t",
"=",
"this",
";",
"return",
"new",
"Iterator",
"<",
"Writable",
">",
"(",
")",
"{",
"long",
"i",
"=",
"written",
";",
"long",
"last",
"=",
"0L",
";"... | Return an iterator over the elements in this tuple.
Note that this doesn't flatten the tuple; one may receive tuples
from this iterator. | [
"Return",
"an",
"iterator",
"over",
"the",
"elements",
"in",
"this",
"tuple",
".",
"Note",
"that",
"this",
"doesn",
"t",
"flatten",
"the",
"tuple",
";",
"one",
"may",
"receive",
"tuples",
"from",
"this",
"iterator",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/TupleWritable.java#L113-L136 |
118,223 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IFileInputStream.java | IFileInputStream.close | @Override
public void close() throws IOException {
if (currentOffset < dataLength) {
byte[] t = new byte[Math.min((int)
(Integer.MAX_VALUE & (dataLength - currentOffset)), 32 * 1024)];
while (currentOffset < dataLength) {
int n = read(t, 0, t.length);
if (0 == n) {
... | java | @Override
public void close() throws IOException {
if (currentOffset < dataLength) {
byte[] t = new byte[Math.min((int)
(Integer.MAX_VALUE & (dataLength - currentOffset)), 32 * 1024)];
while (currentOffset < dataLength) {
int n = read(t, 0, t.length);
if (0 == n) {
... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currentOffset",
"<",
"dataLength",
")",
"{",
"byte",
"[",
"]",
"t",
"=",
"new",
"byte",
"[",
"Math",
".",
"min",
"(",
"(",
"int",
")",
"(",
"Integer",
"... | Close the input stream. Note that we need to read to the end of the
stream to validate the checksum. | [
"Close",
"the",
"input",
"stream",
".",
"Note",
"that",
"we",
"need",
"to",
"read",
"to",
"the",
"end",
"of",
"the",
"stream",
"to",
"validate",
"the",
"checksum",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IFileInputStream.java#L63-L76 |
118,224 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IFileInputStream.java | IFileInputStream.read | public int read(byte[] b, int off, int len) throws IOException {
if (currentOffset >= dataLength) {
return -1;
}
return doRead(b,off,len);
} | java | public int read(byte[] b, int off, int len) throws IOException {
if (currentOffset >= dataLength) {
return -1;
}
return doRead(b,off,len);
} | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currentOffset",
">=",
"dataLength",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"doRead",
"(",
"b",
",",... | Read bytes from the stream.
At EOF, checksum is validated, but the checksum
bytes are not passed back in the buffer. | [
"Read",
"bytes",
"from",
"the",
"stream",
".",
"At",
"EOF",
"checksum",
"is",
"validated",
"but",
"the",
"checksum",
"bytes",
"are",
"not",
"passed",
"back",
"in",
"the",
"buffer",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IFileInputStream.java#L96-L103 |
118,225 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IFileInputStream.java | IFileInputStream.readWithChecksum | public int readWithChecksum(byte[] b, int off, int len) throws IOException {
if (currentOffset == length) {
return -1;
}
else if (currentOffset >= dataLength) {
// If the previous read drained off all the data, then just return
// the checksum now. Note that checksum validation would have... | java | public int readWithChecksum(byte[] b, int off, int len) throws IOException {
if (currentOffset == length) {
return -1;
}
else if (currentOffset >= dataLength) {
// If the previous read drained off all the data, then just return
// the checksum now. Note that checksum validation would have... | [
"public",
"int",
"readWithChecksum",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currentOffset",
"==",
"length",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"currentO... | Read bytes from the stream.
At EOF, checksum is validated and sent back
as the last four bytes of the buffer. The caller should handle
these bytes appropriately | [
"Read",
"bytes",
"from",
"the",
"stream",
".",
"At",
"EOF",
"checksum",
"is",
"validated",
"and",
"sent",
"back",
"as",
"the",
"last",
"four",
"bytes",
"of",
"the",
"buffer",
".",
"The",
"caller",
"should",
"handle",
"these",
"bytes",
"appropriately"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IFileInputStream.java#L111-L140 |
118,226 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.scheduleTasks | private Map<String, List<ResourceGrant>> scheduleTasks() {
fullyScheduled = false;
long nodeWait = configManager.getLocalityWait(type, LocalityLevel.NODE);
long rackWait = configManager.getLocalityWait(type, LocalityLevel.RACK);
int tasksToSchedule = configManager.getGrantsPerIteration();
Map<String... | java | private Map<String, List<ResourceGrant>> scheduleTasks() {
fullyScheduled = false;
long nodeWait = configManager.getLocalityWait(type, LocalityLevel.NODE);
long rackWait = configManager.getLocalityWait(type, LocalityLevel.RACK);
int tasksToSchedule = configManager.getGrantsPerIteration();
Map<String... | [
"private",
"Map",
"<",
"String",
",",
"List",
"<",
"ResourceGrant",
">",
">",
"scheduleTasks",
"(",
")",
"{",
"fullyScheduled",
"=",
"false",
";",
"long",
"nodeWait",
"=",
"configManager",
".",
"getLocalityWait",
"(",
"type",
",",
"LocalityLevel",
".",
"NODE... | Match requests to nodes.
@return The list of granted resources for each session | [
"Match",
"requests",
"to",
"nodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L292-L315 |
118,227 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.scheduleOneTask | private ScheduledPair scheduleOneTask(long nodeWait, long rackWait) {
if (!nodeManager.existRunnableNodes(type)) {
return null;
}
Queue<PoolGroupSchedulable> poolGroupQueue =
poolGroupManager.getScheduleQueue();
while (!poolGroupQueue.isEmpty()) {
PoolGroupSchedulable poolGroup = po... | java | private ScheduledPair scheduleOneTask(long nodeWait, long rackWait) {
if (!nodeManager.existRunnableNodes(type)) {
return null;
}
Queue<PoolGroupSchedulable> poolGroupQueue =
poolGroupManager.getScheduleQueue();
while (!poolGroupQueue.isEmpty()) {
PoolGroupSchedulable poolGroup = po... | [
"private",
"ScheduledPair",
"scheduleOneTask",
"(",
"long",
"nodeWait",
",",
"long",
"rackWait",
")",
"{",
"if",
"(",
"!",
"nodeManager",
".",
"existRunnableNodes",
"(",
"type",
")",
")",
"{",
"return",
"null",
";",
"}",
"Queue",
"<",
"PoolGroupSchedulable",
... | Try match one request to one node
@param nodeWait Time to wait for node locality
@param rackWait Time to wait for rack locality
@return The pair contains a session id and a granted resource
or null when no task can be scheduled | [
"Try",
"match",
"one",
"request",
"to",
"one",
"node"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L325-L375 |
118,228 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.doMatch | private MatchedPair doMatch(
SessionSchedulable schedulable, long now, long nodeWait, long rackWait) {
schedulable.adjustLocalityRequirement(now, nodeWait, rackWait);
for (LocalityLevel level : neededLocalityLevels) {
if (level.isBetterThan(schedulable.getLastLocality())) {
/**
* Th... | java | private MatchedPair doMatch(
SessionSchedulable schedulable, long now, long nodeWait, long rackWait) {
schedulable.adjustLocalityRequirement(now, nodeWait, rackWait);
for (LocalityLevel level : neededLocalityLevels) {
if (level.isBetterThan(schedulable.getLastLocality())) {
/**
* Th... | [
"private",
"MatchedPair",
"doMatch",
"(",
"SessionSchedulable",
"schedulable",
",",
"long",
"now",
",",
"long",
"nodeWait",
",",
"long",
"rackWait",
")",
"{",
"schedulable",
".",
"adjustLocalityRequirement",
"(",
"now",
",",
"nodeWait",
",",
"rackWait",
")",
";"... | Find a node to give resources to this schedulable session.
@param schedulable Given a resource to this schedulable
@param now Current time
@param nodeWait Time to wait for node locality
@param rackWait Time to wait for rack locality
@return Pair of resource request and node or null if no node can be found. | [
"Find",
"a",
"node",
"to",
"give",
"resources",
"to",
"this",
"schedulable",
"session",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L386-L431 |
118,229 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.matchNodeForSession | private MatchedPair matchNodeForSession(
Session session, LocalityLevel level) {
Iterator<ResourceRequestInfo> pendingRequestIterator =
session.getPendingRequestIteratorForType(type);
while (pendingRequestIterator.hasNext()) {
ResourceRequestInfo req = pendingRequestIterator.next();
Set<... | java | private MatchedPair matchNodeForSession(
Session session, LocalityLevel level) {
Iterator<ResourceRequestInfo> pendingRequestIterator =
session.getPendingRequestIteratorForType(type);
while (pendingRequestIterator.hasNext()) {
ResourceRequestInfo req = pendingRequestIterator.next();
Set<... | [
"private",
"MatchedPair",
"matchNodeForSession",
"(",
"Session",
"session",
",",
"LocalityLevel",
"level",
")",
"{",
"Iterator",
"<",
"ResourceRequestInfo",
">",
"pendingRequestIterator",
"=",
"session",
".",
"getPendingRequestIteratorForType",
"(",
"type",
")",
";",
... | Find a matching pair of node, request by looping through the requests in
the session, looking at the hosts in each request and making look-ups
into the node manager.
@param session The session
@param level The locality level at which we are trying to schedule.
@return A match if found, null if not. | [
"Find",
"a",
"matching",
"pair",
"of",
"node",
"request",
"by",
"looping",
"through",
"the",
"requests",
"in",
"the",
"session",
"looking",
"at",
"the",
"hosts",
"in",
"each",
"request",
"and",
"making",
"look",
"-",
"ups",
"into",
"the",
"node",
"manager"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L441-L467 |
118,230 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.matchSessionForNode | private MatchedPair matchSessionForNode(
Session session, LocalityLevel level) {
if (level == LocalityLevel.NODE || level == LocalityLevel.ANY) {
Set<Map.Entry<String, NodeContainer>> hostNodesSet =
nodeSnapshot.runnableHosts();
for (Map.Entry<String, NodeContainer> hostNodes : hostNodesSet)... | java | private MatchedPair matchSessionForNode(
Session session, LocalityLevel level) {
if (level == LocalityLevel.NODE || level == LocalityLevel.ANY) {
Set<Map.Entry<String, NodeContainer>> hostNodesSet =
nodeSnapshot.runnableHosts();
for (Map.Entry<String, NodeContainer> hostNodes : hostNodesSet)... | [
"private",
"MatchedPair",
"matchSessionForNode",
"(",
"Session",
"session",
",",
"LocalityLevel",
"level",
")",
"{",
"if",
"(",
"level",
"==",
"LocalityLevel",
".",
"NODE",
"||",
"level",
"==",
"LocalityLevel",
".",
"ANY",
")",
"{",
"Set",
"<",
"Map",
".",
... | Find a matching pair of node, request by looping through runnable nodes
in the node snapshot created earlier. For each node, we make lookups in the
session to find a suitable request.
@param session The session
@param level The locality level at which we are trying to schedule.
@return A match if found, null if not. | [
"Find",
"a",
"matching",
"pair",
"of",
"node",
"request",
"by",
"looping",
"through",
"runnable",
"nodes",
"in",
"the",
"node",
"snapshot",
"created",
"earlier",
".",
"For",
"each",
"node",
"we",
"make",
"lookups",
"in",
"the",
"session",
"to",
"find",
"a"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L477-L521 |
118,231 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.needLocalityCheck | private boolean needLocalityCheck(
LocalityLevel level, long nodeWait, long rackWait) {
if (level == LocalityLevel.NODE) {
return nodeWait != 0;
}
if (level == LocalityLevel.RACK) {
return rackWait != 0;
}
return false;
} | java | private boolean needLocalityCheck(
LocalityLevel level, long nodeWait, long rackWait) {
if (level == LocalityLevel.NODE) {
return nodeWait != 0;
}
if (level == LocalityLevel.RACK) {
return rackWait != 0;
}
return false;
} | [
"private",
"boolean",
"needLocalityCheck",
"(",
"LocalityLevel",
"level",
",",
"long",
"nodeWait",
",",
"long",
"rackWait",
")",
"{",
"if",
"(",
"level",
"==",
"LocalityLevel",
".",
"NODE",
")",
"{",
"return",
"nodeWait",
"!=",
"0",
";",
"}",
"if",
"(",
... | If the locality wait time is zero, we don't need to check locality at all.
@param level The level
@param nodeWait The amount of time in msec to wait for node locality
@param rackWait The amount of time in msec to wait for rack locality
@return True if the locality check is needed, false otherwise. | [
"If",
"the",
"locality",
"wait",
"time",
"is",
"zero",
"we",
"don",
"t",
"need",
"to",
"check",
"locality",
"at",
"all",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L530-L539 |
118,232 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.commitMatchedResource | private ResourceGrant commitMatchedResource(
Session session, MatchedPair pair) {
ResourceGrant grant = null;
ResourceRequestInfo req = pair.req;
ClusterNode node = pair.node;
String appInfo = nodeManager.getAppInfo(node, type);
if (appInfo != null) {
if (nodeManager.addGrant(node, sessi... | java | private ResourceGrant commitMatchedResource(
Session session, MatchedPair pair) {
ResourceGrant grant = null;
ResourceRequestInfo req = pair.req;
ClusterNode node = pair.node;
String appInfo = nodeManager.getAppInfo(node, type);
if (appInfo != null) {
if (nodeManager.addGrant(node, sessi... | [
"private",
"ResourceGrant",
"commitMatchedResource",
"(",
"Session",
"session",
",",
"MatchedPair",
"pair",
")",
"{",
"ResourceGrant",
"grant",
"=",
"null",
";",
"ResourceRequestInfo",
"req",
"=",
"pair",
".",
"req",
";",
"ClusterNode",
"node",
"=",
"pair",
".",... | Given a session and match of request-node, perform a "transaction commit"
@param session The session
@param pair The pair of (request, node)
@return The resource grant: non-null if the "commit" was successful, null
otherwise. | [
"Given",
"a",
"session",
"and",
"match",
"of",
"request",
"-",
"node",
"perform",
"a",
"transaction",
"commit"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L548-L575 |
118,233 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.doPreemption | private void doPreemption() {
long now = ClusterManager.clock.getTime();
if (now - lastPreemptionTime > PREEMPTION_PERIOD) {
lastPreemptionTime = now;
doPreemptionNow();
}
} | java | private void doPreemption() {
long now = ClusterManager.clock.getTime();
if (now - lastPreemptionTime > PREEMPTION_PERIOD) {
lastPreemptionTime = now;
doPreemptionNow();
}
} | [
"private",
"void",
"doPreemption",
"(",
")",
"{",
"long",
"now",
"=",
"ClusterManager",
".",
"clock",
".",
"getTime",
"(",
")",
";",
"if",
"(",
"now",
"-",
"lastPreemptionTime",
">",
"PREEMPTION_PERIOD",
")",
"{",
"lastPreemptionTime",
"=",
"now",
";",
"do... | Performs preemption if it has been long enough since the last round. | [
"Performs",
"preemption",
"if",
"it",
"has",
"been",
"long",
"enough",
"since",
"the",
"last",
"round",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L629-L635 |
118,234 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.doPreemptionNow | private void doPreemptionNow() {
int totalShare = nodeManager.getAllocatedCpuForType(type);
poolGroupManager.distributeShare(totalShare);
for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
poolGroup.distributeShare();
}
int tasksToPreempt = countTasksShouldPreempt();
... | java | private void doPreemptionNow() {
int totalShare = nodeManager.getAllocatedCpuForType(type);
poolGroupManager.distributeShare(totalShare);
for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
poolGroup.distributeShare();
}
int tasksToPreempt = countTasksShouldPreempt();
... | [
"private",
"void",
"doPreemptionNow",
"(",
")",
"{",
"int",
"totalShare",
"=",
"nodeManager",
".",
"getAllocatedCpuForType",
"(",
"type",
")",
";",
"poolGroupManager",
".",
"distributeShare",
"(",
"totalShare",
")",
";",
"for",
"(",
"PoolGroupSchedulable",
"poolGr... | Performs the preemption. | [
"Performs",
"the",
"preemption",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L640-L651 |
118,235 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.preemptTasks | private void preemptTasks(int tasksToPreempt) {
LOG.info("Start preempt " + tasksToPreempt + " for type " + type);
long maxRunningTime = configManager.getPreemptedTaskMaxRunningTime();
int rounds = configManager.getPreemptionRounds();
while (tasksToPreempt > 0) {
int preempted = preemptOneSession(... | java | private void preemptTasks(int tasksToPreempt) {
LOG.info("Start preempt " + tasksToPreempt + " for type " + type);
long maxRunningTime = configManager.getPreemptedTaskMaxRunningTime();
int rounds = configManager.getPreemptionRounds();
while (tasksToPreempt > 0) {
int preempted = preemptOneSession(... | [
"private",
"void",
"preemptTasks",
"(",
"int",
"tasksToPreempt",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Start preempt \"",
"+",
"tasksToPreempt",
"+",
"\" for type \"",
"+",
"type",
")",
";",
"long",
"maxRunningTime",
"=",
"configManager",
".",
"getPreemptedTaskMax... | Kill tasks from over-scheduled sessions
@param tasksToPreempt The number of tasks should kill | [
"Kill",
"tasks",
"from",
"over",
"-",
"scheduled",
"sessions"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L657-L676 |
118,236 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.preemptOneSession | private int preemptOneSession(int maxToPreemt, long maxRunningTime) {
Queue<PoolGroupSchedulable> poolGroupQueue =
poolGroupManager.getPreemptQueue();
while (!poolGroupQueue.isEmpty()) {
PoolGroupSchedulable poolGroup = poolGroupQueue.poll();
poolGroup.distributeShare();
Queue<PoolSche... | java | private int preemptOneSession(int maxToPreemt, long maxRunningTime) {
Queue<PoolGroupSchedulable> poolGroupQueue =
poolGroupManager.getPreemptQueue();
while (!poolGroupQueue.isEmpty()) {
PoolGroupSchedulable poolGroup = poolGroupQueue.poll();
poolGroup.distributeShare();
Queue<PoolSche... | [
"private",
"int",
"preemptOneSession",
"(",
"int",
"maxToPreemt",
",",
"long",
"maxRunningTime",
")",
"{",
"Queue",
"<",
"PoolGroupSchedulable",
">",
"poolGroupQueue",
"=",
"poolGroupManager",
".",
"getPreemptQueue",
"(",
")",
";",
"while",
"(",
"!",
"poolGroupQue... | Find the most over-scheduled session in the most over-scheduled pool.
Kill tasks from this session.
@param maxToPreemt The maximum number of tasks to kill
@param maxRunningTime The killed task cannot be older than this time
@return The number of tasks actually killed | [
"Find",
"the",
"most",
"over",
"-",
"scheduled",
"session",
"in",
"the",
"most",
"over",
"-",
"scheduled",
"pool",
".",
"Kill",
"tasks",
"from",
"this",
"session",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L685-L730 |
118,237 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.preemptSession | private int preemptSession(SessionSchedulable schedulable,
int maxToPreemt, long maxRunningTime) throws InvalidSessionHandle {
Session session = schedulable.getSession();
List<Integer> grantIds;
synchronized (session) {
grantIds = session.getGrantsToPreempt(maxToPreemt, maxRunningTime, type);
... | java | private int preemptSession(SessionSchedulable schedulable,
int maxToPreemt, long maxRunningTime) throws InvalidSessionHandle {
Session session = schedulable.getSession();
List<Integer> grantIds;
synchronized (session) {
grantIds = session.getGrantsToPreempt(maxToPreemt, maxRunningTime, type);
... | [
"private",
"int",
"preemptSession",
"(",
"SessionSchedulable",
"schedulable",
",",
"int",
"maxToPreemt",
",",
"long",
"maxRunningTime",
")",
"throws",
"InvalidSessionHandle",
"{",
"Session",
"session",
"=",
"schedulable",
".",
"getSession",
"(",
")",
";",
"List",
... | Preempt a session.
@param schedulable The session.
@param maxToPreemt Maximum number of resources to preempt.
@param maxRunningTime Running time threshold for preemption.
@return The number of preempted resources.
@throws InvalidSessionHandle | [
"Preempt",
"a",
"session",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L740-L759 |
118,238 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.countTasksShouldPreempt | private int countTasksShouldPreempt() {
int tasksToPreempt = 0;
long now = ClusterManager.clock.getTime();
for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
for (PoolSchedulable pool : poolGroup.getPools()) {
if (pool.isStarving(now)) {
tasksToPreempt +=
... | java | private int countTasksShouldPreempt() {
int tasksToPreempt = 0;
long now = ClusterManager.clock.getTime();
for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
for (PoolSchedulable pool : poolGroup.getPools()) {
if (pool.isStarving(now)) {
tasksToPreempt +=
... | [
"private",
"int",
"countTasksShouldPreempt",
"(",
")",
"{",
"int",
"tasksToPreempt",
"=",
"0",
";",
"long",
"now",
"=",
"ClusterManager",
".",
"clock",
".",
"getTime",
"(",
")",
";",
"for",
"(",
"PoolGroupSchedulable",
"poolGroup",
":",
"poolGroupManager",
"."... | Count how many tasks should preempt for the starving pools
@return The number of tasks should kill | [
"Count",
"how",
"many",
"tasks",
"should",
"preempt",
"for",
"the",
"starving",
"pools"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L765-L777 |
118,239 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.addSession | public void addSession(String id, Session session) {
poolGroupManager.addSession(id, session);
LOG.info("Session " + id +
" has been added to " + type + " scheduler");
} | java | public void addSession(String id, Session session) {
poolGroupManager.addSession(id, session);
LOG.info("Session " + id +
" has been added to " + type + " scheduler");
} | [
"public",
"void",
"addSession",
"(",
"String",
"id",
",",
"Session",
"session",
")",
"{",
"poolGroupManager",
".",
"addSession",
"(",
"id",
",",
"session",
")",
";",
"LOG",
".",
"info",
"(",
"\"Session \"",
"+",
"id",
"+",
"\" has been added to \"",
"+",
"... | Add a session to this scheduler.
@param id The session ID.
@param session The session. | [
"Add",
"a",
"session",
"to",
"this",
"scheduler",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L784-L788 |
118,240 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/MapFileOutputFormat.java | MapFileOutputFormat.getEntry | public static <K extends WritableComparable, V extends Writable>
Writable getEntry(MapFile.Reader[] readers,
Partitioner<K, V> partitioner,
K key,
V value) throws IOException {
int part = partitioner.getPartition... | java | public static <K extends WritableComparable, V extends Writable>
Writable getEntry(MapFile.Reader[] readers,
Partitioner<K, V> partitioner,
K key,
V value) throws IOException {
int part = partitioner.getPartition... | [
"public",
"static",
"<",
"K",
"extends",
"WritableComparable",
",",
"V",
"extends",
"Writable",
">",
"Writable",
"getEntry",
"(",
"MapFile",
".",
"Reader",
"[",
"]",
"readers",
",",
"Partitioner",
"<",
"K",
",",
"V",
">",
"partitioner",
",",
"K",
"key",
... | Get an entry from output generated by this class. | [
"Get",
"an",
"entry",
"from",
"output",
"generated",
"by",
"this",
"class",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapFileOutputFormat.java#L99-L106 |
118,241 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java | LogParser.monitor | public void monitor(LocalStore ls) {
int in = 0;
EventRecord er = null;
Environment.logInfo("Started processing log...");
while ((er = getNext()) != null) {
// Environment.logInfo("Processing log line:\t" + in++);
if (er.isValid()) {
ls.insert(er);
}
}
PersistentState... | java | public void monitor(LocalStore ls) {
int in = 0;
EventRecord er = null;
Environment.logInfo("Started processing log...");
while ((er = getNext()) != null) {
// Environment.logInfo("Processing log line:\t" + in++);
if (er.isValid()) {
ls.insert(er);
}
}
PersistentState... | [
"public",
"void",
"monitor",
"(",
"LocalStore",
"ls",
")",
"{",
"int",
"in",
"=",
"0",
";",
"EventRecord",
"er",
"=",
"null",
";",
"Environment",
".",
"logInfo",
"(",
"\"Started processing log...\"",
")",
";",
"while",
"(",
"(",
"er",
"=",
"getNext",
"("... | Insert all EventRecords that can be extracted for
the represented hardware component into a LocalStore.
@param ls the LocalStore into which the EventRecords
are to be stored. | [
"Insert",
"all",
"EventRecords",
"that",
"can",
"be",
"extracted",
"for",
"the",
"represented",
"hardware",
"component",
"into",
"a",
"LocalStore",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java#L106-L120 |
118,242 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java | LogParser.monitor | public EventRecord[] monitor() {
ArrayList<EventRecord> recs = new ArrayList<EventRecord>();
EventRecord er;
while ((er = getNext()) != null)
recs.add(er);
EventRecord[] T = new EventRecord[recs.size()];
return recs.toArray(T);
} | java | public EventRecord[] monitor() {
ArrayList<EventRecord> recs = new ArrayList<EventRecord>();
EventRecord er;
while ((er = getNext()) != null)
recs.add(er);
EventRecord[] T = new EventRecord[recs.size()];
return recs.toArray(T);
} | [
"public",
"EventRecord",
"[",
"]",
"monitor",
"(",
")",
"{",
"ArrayList",
"<",
"EventRecord",
">",
"recs",
"=",
"new",
"ArrayList",
"<",
"EventRecord",
">",
"(",
")",
";",
"EventRecord",
"er",
";",
"while",
"(",
"(",
"er",
"=",
"getNext",
"(",
")",
"... | Get an array of all EventRecords that can be extracted for
the represented hardware component.
@return The array of EventRecords | [
"Get",
"an",
"array",
"of",
"all",
"EventRecords",
"that",
"can",
"be",
"extracted",
"for",
"the",
"represented",
"hardware",
"component",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java#L128-L139 |
118,243 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java | LogParser.getNext | public EventRecord getNext() {
try {
String line = reader.readLine();
if (line != null) {
if (firstLine == null)
firstLine = new String(line);
offset += line.length() + 1;
return parseLine(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
} | java | public EventRecord getNext() {
try {
String line = reader.readLine();
if (line != null) {
if (firstLine == null)
firstLine = new String(line);
offset += line.length() + 1;
return parseLine(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"EventRecord",
"getNext",
"(",
")",
"{",
"try",
"{",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"line",
"!=",
"null",
")",
"{",
"if",
"(",
"firstLine",
"==",
"null",
")",
"firstLine",
"=",
"new",
"String",
... | Continue parsing the log file until a valid log entry is identified.
When one such entry is found, parse it and return a corresponding EventRecord.
@return The EventRecord corresponding to the next log entry | [
"Continue",
"parsing",
"the",
"log",
"file",
"until",
"a",
"valid",
"log",
"entry",
"is",
"identified",
".",
"When",
"one",
"such",
"entry",
"is",
"found",
"parse",
"it",
"and",
"return",
"a",
"corresponding",
"EventRecord",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java#L148-L161 |
118,244 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java | LogParser.checkForRotation | public void checkForRotation() {
try {
BufferedReader probe = new BufferedReader(new FileReader(file.getAbsoluteFile()));
if (firstLine == null || (!firstLine.equals(probe.readLine()))) {
probe.close();
// start reading the file from the beginning
reader.close();
reader = new BufferedR... | java | public void checkForRotation() {
try {
BufferedReader probe = new BufferedReader(new FileReader(file.getAbsoluteFile()));
if (firstLine == null || (!firstLine.equals(probe.readLine()))) {
probe.close();
// start reading the file from the beginning
reader.close();
reader = new BufferedR... | [
"public",
"void",
"checkForRotation",
"(",
")",
"{",
"try",
"{",
"BufferedReader",
"probe",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"file",
".",
"getAbsoluteFile",
"(",
")",
")",
")",
";",
"if",
"(",
"firstLine",
"==",
"null",
"||",
... | Check whether the log file has been rotated. If so,
start reading the file from the beginning. | [
"Check",
"whether",
"the",
"log",
"file",
"has",
"been",
"rotated",
".",
"If",
"so",
"start",
"reading",
"the",
"file",
"from",
"the",
"beginning",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/LogParser.java#L177-L191 |
118,245 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java | MapOutputCorrectness.getPartitionStatic | public static int getPartitionStatic(LongWritable key, LongWritable value,
int numPartitions) {
return (int) (Math.abs(key.get()) % numPartitions);
} | java | public static int getPartitionStatic(LongWritable key, LongWritable value,
int numPartitions) {
return (int) (Math.abs(key.get()) % numPartitions);
} | [
"public",
"static",
"int",
"getPartitionStatic",
"(",
"LongWritable",
"key",
",",
"LongWritable",
"value",
",",
"int",
"numPartitions",
")",
"{",
"return",
"(",
"int",
")",
"(",
"Math",
".",
"abs",
"(",
"key",
".",
"get",
"(",
")",
")",
"%",
"numPartitio... | Get a partition from the key only
@param key Key to partition
@param value Value (not used)
@param numPartitions Number of partitions
@return Destination partition | [
"Get",
"a",
"partition",
"from",
"the",
"key",
"only"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L316-L319 |
118,246 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java | MapOutputCorrectness.getMapperId | private static int getMapperId(long key, int numReducers, int maxKeySpace) {
key = key - getFirstSumKey(numReducers, maxKeySpace);
return (int) (key / numReducers);
} | java | private static int getMapperId(long key, int numReducers, int maxKeySpace) {
key = key - getFirstSumKey(numReducers, maxKeySpace);
return (int) (key / numReducers);
} | [
"private",
"static",
"int",
"getMapperId",
"(",
"long",
"key",
",",
"int",
"numReducers",
",",
"int",
"maxKeySpace",
")",
"{",
"key",
"=",
"key",
"-",
"getFirstSumKey",
"(",
"numReducers",
",",
"maxKeySpace",
")",
";",
"return",
"(",
"int",
")",
"(",
"ke... | Which mapper sent this key sum?
@param key Key to check
@param numReducers Number of reducers
@param maxKeySpace Max key space
@return Mapper that send this key sum | [
"Which",
"mapper",
"sent",
"this",
"key",
"sum?"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L339-L342 |
118,247 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java | MapOutputCorrectness.getAttemptId | public static int getAttemptId(Configuration conf)
throws IllegalArgumentException {
if (conf == null) {
throw new NullPointerException("Conf is null");
}
String taskId = conf.get("mapred.task.id");
if (taskId == null) {
throw new IllegalArgumentException(
"Configuration doe... | java | public static int getAttemptId(Configuration conf)
throws IllegalArgumentException {
if (conf == null) {
throw new NullPointerException("Conf is null");
}
String taskId = conf.get("mapred.task.id");
if (taskId == null) {
throw new IllegalArgumentException(
"Configuration doe... | [
"public",
"static",
"int",
"getAttemptId",
"(",
"Configuration",
"conf",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"conf",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Conf is null\"",
")",
";",
"}",
"String",
"taskId"... | Get the attempt number
@param conf Configuration
@return Attempt number
@throws IllegalArgumentException | [
"Get",
"the",
"attempt",
"number"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L388-L409 |
118,248 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/DatanodeID.java | DatanodeID.updateRegInfo | public void updateRegInfo(DatanodeID nodeReg) {
name = nodeReg.getName();
infoPort = nodeReg.getInfoPort();
ipcPort = nodeReg.getIpcPort();
// update any more fields added in future.
} | java | public void updateRegInfo(DatanodeID nodeReg) {
name = nodeReg.getName();
infoPort = nodeReg.getInfoPort();
ipcPort = nodeReg.getIpcPort();
// update any more fields added in future.
} | [
"public",
"void",
"updateRegInfo",
"(",
"DatanodeID",
"nodeReg",
")",
"{",
"name",
"=",
"nodeReg",
".",
"getName",
"(",
")",
";",
"infoPort",
"=",
"nodeReg",
".",
"getInfoPort",
"(",
")",
";",
"ipcPort",
"=",
"nodeReg",
".",
"getIpcPort",
"(",
")",
";",
... | Update fields when a new registration request comes in.
Note that this does not update storageID. | [
"Update",
"fields",
"when",
"a",
"new",
"registration",
"request",
"comes",
"in",
".",
"Note",
"that",
"this",
"does",
"not",
"update",
"storageID",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/DatanodeID.java#L164-L169 |
118,249 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/raid/ErasureCode.java | ErasureCode.decodeBulk | public void decodeBulk(byte[][] readBufs, byte[][] writeBufs,
int[] erasedLocations) throws IOException {
int[] tmpInput = new int[readBufs.length];
int[] tmpOutput = new int[erasedLocations.length];
int numBytes = readBufs[0].length;
for (int idx = 0; idx < numBytes; idx++) {
for (int i = ... | java | public void decodeBulk(byte[][] readBufs, byte[][] writeBufs,
int[] erasedLocations) throws IOException {
int[] tmpInput = new int[readBufs.length];
int[] tmpOutput = new int[erasedLocations.length];
int numBytes = readBufs[0].length;
for (int idx = 0; idx < numBytes; idx++) {
for (int i = ... | [
"public",
"void",
"decodeBulk",
"(",
"byte",
"[",
"]",
"[",
"]",
"readBufs",
",",
"byte",
"[",
"]",
"[",
"]",
"writeBufs",
",",
"int",
"[",
"]",
"erasedLocations",
")",
"throws",
"IOException",
"{",
"int",
"[",
"]",
"tmpInput",
"=",
"new",
"int",
"["... | This method would be overridden in the subclass,
so that the subclass will have its own decodeBulk behavior. | [
"This",
"method",
"would",
"be",
"overridden",
"in",
"the",
"subclass",
"so",
"that",
"the",
"subclass",
"will",
"have",
"its",
"own",
"decodeBulk",
"behavior",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/raid/ErasureCode.java#L150-L168 |
118,250 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/LexicographicalComparerHolder.java | LexicographicalComparerHolder.getBestComparer | static Comparer<byte[]> getBestComparer() {
try {
Class<?> theClass = Class.forName(UNSAFE_COMPARER_NAME);
// yes, UnsafeComparer does implement Comparer<byte[]>
@SuppressWarnings("unchecked")
Comparer<byte[]> comparer = (Comparer<byte[]>) theClass
.getEnumConstants()[0];
re... | java | static Comparer<byte[]> getBestComparer() {
try {
Class<?> theClass = Class.forName(UNSAFE_COMPARER_NAME);
// yes, UnsafeComparer does implement Comparer<byte[]>
@SuppressWarnings("unchecked")
Comparer<byte[]> comparer = (Comparer<byte[]>) theClass
.getEnumConstants()[0];
re... | [
"static",
"Comparer",
"<",
"byte",
"[",
"]",
">",
"getBestComparer",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"theClass",
"=",
"Class",
".",
"forName",
"(",
"UNSAFE_COMPARER_NAME",
")",
";",
"// yes, UnsafeComparer does implement Comparer<byte[]>",
"@"... | Returns the Unsafe-using Comparer, or falls back to the pure-Java
implementation if unable to do so. | [
"Returns",
"the",
"Unsafe",
"-",
"using",
"Comparer",
"or",
"falls",
"back",
"to",
"the",
"pure",
"-",
"Java",
"implementation",
"if",
"unable",
"to",
"do",
"so",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/LexicographicalComparerHolder.java#L79-L92 |
118,251 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/ContextFactory.java | ContextFactory.getAttributeNames | public String[] getAttributeNames() {
String[] result = new String[attributeMap.size()];
int i = 0;
// for (String attributeName : attributeMap.keySet()) {
Iterator it = attributeMap.keySet().iterator();
while (it.hasNext()) {
result[i++] = (String) it.next();
}
return result;
... | java | public String[] getAttributeNames() {
String[] result = new String[attributeMap.size()];
int i = 0;
// for (String attributeName : attributeMap.keySet()) {
Iterator it = attributeMap.keySet().iterator();
while (it.hasNext()) {
result[i++] = (String) it.next();
}
return result;
... | [
"public",
"String",
"[",
"]",
"getAttributeNames",
"(",
")",
"{",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"attributeMap",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"// for (String attributeName : attributeMap.keySet()) {\r",
... | Returns the names of all the factory's attributes.
@return the attribute names | [
"Returns",
"the",
"names",
"of",
"all",
"the",
"factory",
"s",
"attributes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/ContextFactory.java#L85-L94 |
118,252 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/ContextFactory.java | ContextFactory.getNullContext | public static synchronized MetricsContext getNullContext(String contextName) {
MetricsContext nullContext = nullContextMap.get(contextName);
if (nullContext == null) {
nullContext = new NullContext();
nullContextMap.put(contextName, nullContext);
}
return nullContext;
} | java | public static synchronized MetricsContext getNullContext(String contextName) {
MetricsContext nullContext = nullContextMap.get(contextName);
if (nullContext == null) {
nullContext = new NullContext();
nullContextMap.put(contextName, nullContext);
}
return nullContext;
} | [
"public",
"static",
"synchronized",
"MetricsContext",
"getNullContext",
"(",
"String",
"contextName",
")",
"{",
"MetricsContext",
"nullContext",
"=",
"nullContextMap",
".",
"get",
"(",
"contextName",
")",
";",
"if",
"(",
"nullContext",
"==",
"null",
")",
"{",
"n... | Returns a "null" context - one which does nothing. | [
"Returns",
"a",
"null",
"context",
"-",
"one",
"which",
"does",
"nothing",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/ContextFactory.java#L169-L176 |
118,253 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/shell/CommandFormat.java | CommandFormat.parse | public List<String> parse(String[] args, int pos) {
List<String> parameters = new ArrayList<String>();
for(; pos < args.length; pos++) {
if (args[pos].charAt(0) == '-' && args[pos].length() > 1) {
String opt = args[pos].substring(1);
if (options.containsKey(opt))
options.put(opt,... | java | public List<String> parse(String[] args, int pos) {
List<String> parameters = new ArrayList<String>();
for(; pos < args.length; pos++) {
if (args[pos].charAt(0) == '-' && args[pos].length() > 1) {
String opt = args[pos].substring(1);
if (options.containsKey(opt))
options.put(opt,... | [
"public",
"List",
"<",
"String",
">",
"parse",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"pos",
")",
"{",
"List",
"<",
"String",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
";",
"pos",
"<",
"args"... | Parse parameters starting from the given position
@param args an array of input arguments
@param pos the position at which starts to parse
@return a list of parameters | [
"Parse",
"parameters",
"starting",
"from",
"the",
"given",
"position"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/shell/CommandFormat.java#L48-L71 |
118,254 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/file/FileContext.java | FileContext.emitRecord | public void emitRecord(String contextName, String recordName, OutputRecord outRec)
throws IOException
{
Calendar currentDate = Calendar.getInstance();
if (fileName != null) {
if (currentDate.get(Calendar.DAY_OF_MONTH) != lastRecordDate.get(Calendar.DAY_OF_MONTH)) {
// rotate to a new ... | java | public void emitRecord(String contextName, String recordName, OutputRecord outRec)
throws IOException
{
Calendar currentDate = Calendar.getInstance();
if (fileName != null) {
if (currentDate.get(Calendar.DAY_OF_MONTH) != lastRecordDate.get(Calendar.DAY_OF_MONTH)) {
// rotate to a new ... | [
"public",
"void",
"emitRecord",
"(",
"String",
"contextName",
",",
"String",
"recordName",
",",
"OutputRecord",
"outRec",
")",
"throws",
"IOException",
"{",
"Calendar",
"currentDate",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"fileName",
"... | Emits a metrics record to a file. | [
"Emits",
"a",
"metrics",
"record",
"to",
"a",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/file/FileContext.java#L135-L171 |
118,255 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/BlockReader.java | BlockReader.adjustChecksumBytes | private void adjustChecksumBytes(int dataLen) {
int requiredSize =
((dataLen + bytesPerChecksum - 1)/bytesPerChecksum)*checksumSize;
if (checksumBytes == null || requiredSize > checksumBytes.capacity()) {
checksumBytes = ByteBuffer.wrap(new byte[requiredSize]);
} else {
checksumBytes.clea... | java | private void adjustChecksumBytes(int dataLen) {
int requiredSize =
((dataLen + bytesPerChecksum - 1)/bytesPerChecksum)*checksumSize;
if (checksumBytes == null || requiredSize > checksumBytes.capacity()) {
checksumBytes = ByteBuffer.wrap(new byte[requiredSize]);
} else {
checksumBytes.clea... | [
"private",
"void",
"adjustChecksumBytes",
"(",
"int",
"dataLen",
")",
"{",
"int",
"requiredSize",
"=",
"(",
"(",
"dataLen",
"+",
"bytesPerChecksum",
"-",
"1",
")",
"/",
"bytesPerChecksum",
")",
"*",
"checksumSize",
";",
"if",
"(",
"checksumBytes",
"==",
"nul... | Makes sure that checksumBytes has enough capacity
and limit is set to the number of checksum bytes needed
to be read. | [
"Makes",
"sure",
"that",
"checksumBytes",
"has",
"enough",
"capacity",
"and",
"limit",
"is",
"set",
"to",
"the",
"number",
"of",
"checksum",
"bytes",
"needed",
"to",
"be",
"read",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/BlockReader.java#L240-L249 |
118,256 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/BlockReader.java | BlockReader.readBlockSizeInfo | private synchronized void readBlockSizeInfo() throws IOException {
if (!transferBlockSize) {
return;
}
blkLenInfoUpdated = true;
isBlockFinalized = in.readBoolean();
updatedBlockLength = in.readLong();
if (dataTransferVersion >= DataTransferProtocol.READ_PROFILING_VERSION) {
readData... | java | private synchronized void readBlockSizeInfo() throws IOException {
if (!transferBlockSize) {
return;
}
blkLenInfoUpdated = true;
isBlockFinalized = in.readBoolean();
updatedBlockLength = in.readLong();
if (dataTransferVersion >= DataTransferProtocol.READ_PROFILING_VERSION) {
readData... | [
"private",
"synchronized",
"void",
"readBlockSizeInfo",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"transferBlockSize",
")",
"{",
"return",
";",
"}",
"blkLenInfoUpdated",
"=",
"true",
";",
"isBlockFinalized",
"=",
"in",
".",
"readBoolean",
"(",
")... | Read the block length information from data stream
@throws IOException | [
"Read",
"the",
"block",
"length",
"information",
"from",
"data",
"stream"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/BlockReader.java#L256-L271 |
118,257 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/BlockReader.java | BlockReader.newBlockReader | public static BlockReader newBlockReader( int dataTransferVersion,
int namespaceId,
Socket sock, String file, long blockId,
long genStamp,
long startOffset, long len,
... | java | public static BlockReader newBlockReader( int dataTransferVersion,
int namespaceId,
Socket sock, String file, long blockId,
long genStamp,
long startOffset, long len,
... | [
"public",
"static",
"BlockReader",
"newBlockReader",
"(",
"int",
"dataTransferVersion",
",",
"int",
"namespaceId",
",",
"Socket",
"sock",
",",
"String",
"file",
",",
"long",
"blockId",
",",
"long",
"genStamp",
",",
"long",
"startOffset",
",",
"long",
"len",
",... | Java Doc required | [
"Java",
"Doc",
"required"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/BlockReader.java#L535-L548 |
118,258 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskTracker.java | CoronaTaskTracker.createRunningJob | @Override
protected RunningJob createRunningJob(JobID jobId, TaskInProgress tip)
throws IOException {
CoronaSessionInfo info = (CoronaSessionInfo)(tip.getExtensible());
// JobClient will be set by JobTrackerReporter thread later
RunningJob rJob = new RunningJob(jobId, null, info);
JobTrackerRepo... | java | @Override
protected RunningJob createRunningJob(JobID jobId, TaskInProgress tip)
throws IOException {
CoronaSessionInfo info = (CoronaSessionInfo)(tip.getExtensible());
// JobClient will be set by JobTrackerReporter thread later
RunningJob rJob = new RunningJob(jobId, null, info);
JobTrackerRepo... | [
"@",
"Override",
"protected",
"RunningJob",
"createRunningJob",
"(",
"JobID",
"jobId",
",",
"TaskInProgress",
"tip",
")",
"throws",
"IOException",
"{",
"CoronaSessionInfo",
"info",
"=",
"(",
"CoronaSessionInfo",
")",
"(",
"tip",
".",
"getExtensible",
"(",
")",
"... | Override this method to create the proper jobClient and the thread that
sends jobTracker heartbeat. | [
"Override",
"this",
"method",
"to",
"create",
"the",
"proper",
"jobClient",
"and",
"the",
"thread",
"that",
"sends",
"jobTracker",
"heartbeat",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskTracker.java#L750-L764 |
118,259 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskTracker.java | CoronaTaskTracker.purgeJob | @Override
protected synchronized void purgeJob(KillJobAction action) throws IOException {
JobID jobId = action.getJobID();
JobTrackerReporter reporter = jobTrackerReporters.remove(jobId);
if (reporter != null) {
reporter.shutdown();
}
super.purgeJob(action);
crReleaseManager.returnReleas... | java | @Override
protected synchronized void purgeJob(KillJobAction action) throws IOException {
JobID jobId = action.getJobID();
JobTrackerReporter reporter = jobTrackerReporters.remove(jobId);
if (reporter != null) {
reporter.shutdown();
}
super.purgeJob(action);
crReleaseManager.returnReleas... | [
"@",
"Override",
"protected",
"synchronized",
"void",
"purgeJob",
"(",
"KillJobAction",
"action",
")",
"throws",
"IOException",
"{",
"JobID",
"jobId",
"=",
"action",
".",
"getJobID",
"(",
")",
";",
"JobTrackerReporter",
"reporter",
"=",
"jobTrackerReporters",
".",... | Override this to shutdown the heartbeat the the corresponding jobtracker | [
"Override",
"this",
"to",
"shutdown",
"the",
"heartbeat",
"the",
"the",
"corresponding",
"jobtracker"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskTracker.java#L769-L778 |
118,260 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java | DefaultTaskController.launchTaskJVM | void launchTaskJVM(TaskController.TaskControllerContext context)
throws IOException {
JvmEnv env = context.env;
List<String> wrappedCommand =
TaskLog.captureOutAndError(env.setup, env.vargs, env.stdout, env.stderr,
env.logSize, true);
ShellCommandExecu... | java | void launchTaskJVM(TaskController.TaskControllerContext context)
throws IOException {
JvmEnv env = context.env;
List<String> wrappedCommand =
TaskLog.captureOutAndError(env.setup, env.vargs, env.stdout, env.stderr,
env.logSize, true);
ShellCommandExecu... | [
"void",
"launchTaskJVM",
"(",
"TaskController",
".",
"TaskControllerContext",
"context",
")",
"throws",
"IOException",
"{",
"JvmEnv",
"env",
"=",
"context",
".",
"env",
";",
"List",
"<",
"String",
">",
"wrappedCommand",
"=",
"TaskLog",
".",
"captureOutAndError",
... | Launch a new JVM for the task.
This method launches the new JVM for the task by executing the
the JVM command using the {@link Shell.ShellCommandExecutor} | [
"Launch",
"a",
"new",
"JVM",
"for",
"the",
"task",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java#L51-L63 |
118,261 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContentProvider.java | DFSContentProvider.refresh | void refresh() {
// no display, nothing to update
if (this.viewer == null)
return;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
DFSContentProvider.this.viewer.refresh();
}
});
} | java | void refresh() {
// no display, nothing to update
if (this.viewer == null)
return;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
DFSContentProvider.this.viewer.refresh();
}
});
} | [
"void",
"refresh",
"(",
")",
"{",
"// no display, nothing to update",
"if",
"(",
"this",
".",
"viewer",
"==",
"null",
")",
"return",
";",
"Display",
".",
"getDefault",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"... | Ask the viewer for this content to refresh | [
"Ask",
"the",
"viewer",
"for",
"this",
"content",
"to",
"refresh"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContentProvider.java#L210-L220 |
118,262 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContentProvider.java | DFSContentProvider.refresh | void refresh(final DFSContent content) {
if (this.sviewer != null) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
DFSContentProvider.this.sviewer.refresh(content);
}
});
} else {
refresh();
}
} | java | void refresh(final DFSContent content) {
if (this.sviewer != null) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
DFSContentProvider.this.sviewer.refresh(content);
}
});
} else {
refresh();
}
} | [
"void",
"refresh",
"(",
"final",
"DFSContent",
"content",
")",
"{",
"if",
"(",
"this",
".",
"sviewer",
"!=",
"null",
")",
"{",
"Display",
".",
"getDefault",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"... | Ask the viewer to refresh a single element
@param content what to refresh | [
"Ask",
"the",
"viewer",
"to",
"refresh",
"a",
"single",
"element"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContentProvider.java#L227-L238 |
118,263 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLogServlet.java | TaskLogServlet.getTaskLogUrl | public static String getTaskLogUrl(String taskTrackerHostName,
String httpPort, String taskAttemptID) {
return ("http://" + taskTrackerHostName + ":" + httpPort
+ "/tasklog?taskid=" + taskAttemptID);
} | java | public static String getTaskLogUrl(String taskTrackerHostName,
String httpPort, String taskAttemptID) {
return ("http://" + taskTrackerHostName + ":" + httpPort
+ "/tasklog?taskid=" + taskAttemptID);
} | [
"public",
"static",
"String",
"getTaskLogUrl",
"(",
"String",
"taskTrackerHostName",
",",
"String",
"httpPort",
",",
"String",
"taskAttemptID",
")",
"{",
"return",
"(",
"\"http://\"",
"+",
"taskTrackerHostName",
"+",
"\":\"",
"+",
"httpPort",
"+",
"\"/tasklog?taskid... | Construct the taskLogUrl
@param taskTrackerHostName
@param httpPort
@param taskAttemptID
@return the taskLogUrl | [
"Construct",
"the",
"taskLogUrl"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLogServlet.java#L51-L55 |
118,264 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLogServlet.java | TaskLogServlet.findFirstQuotable | private static int findFirstQuotable(byte[] data, int offset, int end) {
while (offset < end) {
switch (data[offset]) {
case '<':
case '>':
case '&':
return offset;
default:
offset += 1;
}
}
return offset;
} | java | private static int findFirstQuotable(byte[] data, int offset, int end) {
while (offset < end) {
switch (data[offset]) {
case '<':
case '>':
case '&':
return offset;
default:
offset += 1;
}
}
return offset;
} | [
"private",
"static",
"int",
"findFirstQuotable",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"end",
")",
"{",
"while",
"(",
"offset",
"<",
"end",
")",
"{",
"switch",
"(",
"data",
"[",
"offset",
"]",
")",
"{",
"case",
"'",
"'",
... | Find the next quotable character in the given array.
@param data the bytes to look in
@param offset the first index to look in
@param end the index after the last one to look in
@return the index of the quotable character or end if none was found | [
"Find",
"the",
"next",
"quotable",
"character",
"in",
"the",
"given",
"array",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLogServlet.java#L64-L76 |
118,265 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.snapshot | public void snapshot() {
snapshotPoolGroups =
new ArrayList<PoolGroupSchedulable>(nameToPoolGroup.values());
for (PoolGroupSchedulable poolGroup : snapshotPoolGroups) {
poolGroup.snapshot();
}
scheduleQueue = null;
preemptQueue = null;
// Load the configured pools for stats and cm... | java | public void snapshot() {
snapshotPoolGroups =
new ArrayList<PoolGroupSchedulable>(nameToPoolGroup.values());
for (PoolGroupSchedulable poolGroup : snapshotPoolGroups) {
poolGroup.snapshot();
}
scheduleQueue = null;
preemptQueue = null;
// Load the configured pools for stats and cm... | [
"public",
"void",
"snapshot",
"(",
")",
"{",
"snapshotPoolGroups",
"=",
"new",
"ArrayList",
"<",
"PoolGroupSchedulable",
">",
"(",
"nameToPoolGroup",
".",
"values",
"(",
")",
")",
";",
"for",
"(",
"PoolGroupSchedulable",
"poolGroup",
":",
"snapshotPoolGroups",
"... | Take snapshots for all pools groups and sessions. | [
"Take",
"snapshots",
"for",
"all",
"pools",
"groups",
"and",
"sessions",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L81-L99 |
118,266 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.getScheduleQueue | public Queue<PoolGroupSchedulable> getScheduleQueue() {
if (scheduleQueue == null) {
scheduleQueue = createPoolGroupQueue(ScheduleComparator.FAIR);
}
return scheduleQueue;
} | java | public Queue<PoolGroupSchedulable> getScheduleQueue() {
if (scheduleQueue == null) {
scheduleQueue = createPoolGroupQueue(ScheduleComparator.FAIR);
}
return scheduleQueue;
} | [
"public",
"Queue",
"<",
"PoolGroupSchedulable",
">",
"getScheduleQueue",
"(",
")",
"{",
"if",
"(",
"scheduleQueue",
"==",
"null",
")",
"{",
"scheduleQueue",
"=",
"createPoolGroupQueue",
"(",
"ScheduleComparator",
".",
"FAIR",
")",
";",
"}",
"return",
"scheduleQu... | Get the queue of pool groups sorted for scheduling
@return the queue of pools sorted for scheduling | [
"Get",
"the",
"queue",
"of",
"pool",
"groups",
"sorted",
"for",
"scheduling"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L105-L110 |
118,267 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.getPreemptQueue | public Queue<PoolGroupSchedulable> getPreemptQueue() {
if (preemptQueue == null) {
preemptQueue = createPoolGroupQueue(ScheduleComparator.FAIR_PREEMPT);
}
return preemptQueue;
} | java | public Queue<PoolGroupSchedulable> getPreemptQueue() {
if (preemptQueue == null) {
preemptQueue = createPoolGroupQueue(ScheduleComparator.FAIR_PREEMPT);
}
return preemptQueue;
} | [
"public",
"Queue",
"<",
"PoolGroupSchedulable",
">",
"getPreemptQueue",
"(",
")",
"{",
"if",
"(",
"preemptQueue",
"==",
"null",
")",
"{",
"preemptQueue",
"=",
"createPoolGroupQueue",
"(",
"ScheduleComparator",
".",
"FAIR_PREEMPT",
")",
";",
"}",
"return",
"preem... | Get the queue of the pool groups sorted for preemption
@return the queue of pool sorted for preemption | [
"Get",
"the",
"queue",
"of",
"the",
"pool",
"groups",
"sorted",
"for",
"preemption"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L116-L121 |
118,268 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.createPoolGroupQueue | private Queue<PoolGroupSchedulable> createPoolGroupQueue(
ScheduleComparator comparator) {
int initCapacity =
snapshotPoolGroups.size() == 0 ? 1 : snapshotPoolGroups.size();
Queue<PoolGroupSchedulable> poolGroupQueue =
new PriorityQueue<PoolGroupSchedulable>(initCapacity, comparator);
... | java | private Queue<PoolGroupSchedulable> createPoolGroupQueue(
ScheduleComparator comparator) {
int initCapacity =
snapshotPoolGroups.size() == 0 ? 1 : snapshotPoolGroups.size();
Queue<PoolGroupSchedulable> poolGroupQueue =
new PriorityQueue<PoolGroupSchedulable>(initCapacity, comparator);
... | [
"private",
"Queue",
"<",
"PoolGroupSchedulable",
">",
"createPoolGroupQueue",
"(",
"ScheduleComparator",
"comparator",
")",
"{",
"int",
"initCapacity",
"=",
"snapshotPoolGroups",
".",
"size",
"(",
")",
"==",
"0",
"?",
"1",
":",
"snapshotPoolGroups",
".",
"size",
... | Put all the pool groups into the priority queue sorted by a comparator
@param comparator the comparator to sort all the pool groups in the queue
@return the queue of the pool groups sorted by a comparator | [
"Put",
"all",
"the",
"pool",
"groups",
"into",
"the",
"priority",
"queue",
"sorted",
"by",
"a",
"comparator"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L128-L136 |
118,269 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.addSession | public void addSession(String id, Session session) {
PoolInfo poolInfo = getPoolInfo(session);
LOG.info("Session " + id + " added to pool info " +
poolInfo + " (originally " + session.getInfo().getPoolInfoStrings() +") for " + type);
getPoolSchedulable(poolInfo).addSession(id, session);
} | java | public void addSession(String id, Session session) {
PoolInfo poolInfo = getPoolInfo(session);
LOG.info("Session " + id + " added to pool info " +
poolInfo + " (originally " + session.getInfo().getPoolInfoStrings() +") for " + type);
getPoolSchedulable(poolInfo).addSession(id, session);
} | [
"public",
"void",
"addSession",
"(",
"String",
"id",
",",
"Session",
"session",
")",
"{",
"PoolInfo",
"poolInfo",
"=",
"getPoolInfo",
"(",
"session",
")",
";",
"LOG",
".",
"info",
"(",
"\"Session \"",
"+",
"id",
"+",
"\" added to pool info \"",
"+",
"poolInf... | Add a session to the scheduler
@param id the id of the session
@param session the session object to add | [
"Add",
"a",
"session",
"to",
"the",
"scheduler"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L143-L148 |
118,270 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.checkPoolInfoIfStrict | public static void checkPoolInfoIfStrict(PoolInfo poolInfo,
ConfigManager configManager,
CoronaConf conf)
throws InvalidSessionHandle {
if (!conf.onlyAllowConfiguredPools()) {
return;
}
// When only allowing c... | java | public static void checkPoolInfoIfStrict(PoolInfo poolInfo,
ConfigManager configManager,
CoronaConf conf)
throws InvalidSessionHandle {
if (!conf.onlyAllowConfiguredPools()) {
return;
}
// When only allowing c... | [
"public",
"static",
"void",
"checkPoolInfoIfStrict",
"(",
"PoolInfo",
"poolInfo",
",",
"ConfigManager",
"configManager",
",",
"CoronaConf",
"conf",
")",
"throws",
"InvalidSessionHandle",
"{",
"if",
"(",
"!",
"conf",
".",
"onlyAllowConfiguredPools",
"(",
")",
")",
... | If the cluster is set to configured pools only, do not allow unset pool
information or pool info that doesn't match a valid pool info. Throws
an InvalidSessionHandle exception in either of the failure cases.
@param poolInfo Pool info to check
@param configManager Configuration to check
@param conf Corona configuratio... | [
"If",
"the",
"cluster",
"is",
"set",
"to",
"configured",
"pools",
"only",
"do",
"not",
"allow",
"unset",
"pool",
"information",
"or",
"pool",
"info",
"that",
"doesn",
"t",
"match",
"a",
"valid",
"pool",
"info",
".",
"Throws",
"an",
"InvalidSessionHandle",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L160-L201 |
118,271 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.getPoolInfo | public static PoolInfo getPoolInfo(
Session session) {
PoolInfo poolInfo = session.getPoolInfo();
// If there is no explicit pool info set, take user name.
if (poolInfo == null || poolInfo.getPoolName().equals("")) {
poolInfo = new PoolInfo(DEFAULT_POOL_GROUP, session.getUserId());
}
i... | java | public static PoolInfo getPoolInfo(
Session session) {
PoolInfo poolInfo = session.getPoolInfo();
// If there is no explicit pool info set, take user name.
if (poolInfo == null || poolInfo.getPoolName().equals("")) {
poolInfo = new PoolInfo(DEFAULT_POOL_GROUP, session.getUserId());
}
i... | [
"public",
"static",
"PoolInfo",
"getPoolInfo",
"(",
"Session",
"session",
")",
"{",
"PoolInfo",
"poolInfo",
"=",
"session",
".",
"getPoolInfo",
"(",
")",
";",
"// If there is no explicit pool info set, take user name.",
"if",
"(",
"poolInfo",
"==",
"null",
"||",
"po... | Get the pool name for a given session, using the default pool
information if the name is illegal. Redirection should happen prior to
this.
@param session the session to get the pool name for
@return the pool info that the session is running in | [
"Get",
"the",
"pool",
"name",
"for",
"a",
"given",
"session",
"using",
"the",
"default",
"pool",
"information",
"if",
"the",
"name",
"is",
"illegal",
".",
"Redirection",
"should",
"happen",
"prior",
"to",
"this",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L211-L226 |
118,272 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.getPoolSchedulable | private PoolSchedulable getPoolSchedulable(PoolInfo poolInfo) {
PoolGroupSchedulable poolGroup =
nameToPoolGroup.get(poolInfo.getPoolGroupName());
if (poolGroup == null) {
poolGroup = new PoolGroupSchedulable(
poolInfo.getPoolGroupName(), type, configManager);
PoolGroupSchedulable ... | java | private PoolSchedulable getPoolSchedulable(PoolInfo poolInfo) {
PoolGroupSchedulable poolGroup =
nameToPoolGroup.get(poolInfo.getPoolGroupName());
if (poolGroup == null) {
poolGroup = new PoolGroupSchedulable(
poolInfo.getPoolGroupName(), type, configManager);
PoolGroupSchedulable ... | [
"private",
"PoolSchedulable",
"getPoolSchedulable",
"(",
"PoolInfo",
"poolInfo",
")",
"{",
"PoolGroupSchedulable",
"poolGroup",
"=",
"nameToPoolGroup",
".",
"get",
"(",
"poolInfo",
".",
"getPoolGroupName",
"(",
")",
")",
";",
"if",
"(",
"poolGroup",
"==",
"null",
... | Get the Schedulable representing the pool with a given name
If it doesn't exist - create it and add it to the list
@param poolInfo Group and pool names
@return the PoolSchedulable for a pool with a given name | [
"Get",
"the",
"Schedulable",
"representing",
"the",
"pool",
"with",
"a",
"given",
"name",
"If",
"it",
"doesn",
"t",
"exist",
"-",
"create",
"it",
"and",
"add",
"it",
"to",
"the",
"list"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L235-L249 |
118,273 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/nativeio/NativeIO.java | NativeIO.ioprioGetIfPossible | public static int ioprioGetIfPossible() throws IOException {
if (nativeLoaded && ioprioPossible) {
try {
return ioprio_get();
} catch (UnsupportedOperationException uoe) {
LOG.warn("ioprioGetIfPossible() failed", uoe);
ioprioPossible = false;
} catch (UnsatisfiedLinkError u... | java | public static int ioprioGetIfPossible() throws IOException {
if (nativeLoaded && ioprioPossible) {
try {
return ioprio_get();
} catch (UnsupportedOperationException uoe) {
LOG.warn("ioprioGetIfPossible() failed", uoe);
ioprioPossible = false;
} catch (UnsatisfiedLinkError u... | [
"public",
"static",
"int",
"ioprioGetIfPossible",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"nativeLoaded",
"&&",
"ioprioPossible",
")",
"{",
"try",
"{",
"return",
"ioprio_get",
"(",
")",
";",
"}",
"catch",
"(",
"UnsupportedOperationException",
"uoe",
... | Call ioprio_get for this thread.
@throws NativeIOException
if there is an error with the syscall
@return -1 on failure, ioprio value on success. | [
"Call",
"ioprio_get",
"for",
"this",
"thread",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/nativeio/NativeIO.java#L242-L258 |
118,274 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/nativeio/NativeIO.java | NativeIO.posixFadviseIfPossible | public static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags)
throws NativeIOException {
if (nativeLoaded && fadvisePossible) {
try {
posix_fadvise(fd, offset, len, flags);
InjectionHandler.processEvent(
InjectionEventCore.NATIVEIO_POSI... | java | public static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags)
throws NativeIOException {
if (nativeLoaded && fadvisePossible) {
try {
posix_fadvise(fd, offset, len, flags);
InjectionHandler.processEvent(
InjectionEventCore.NATIVEIO_POSI... | [
"public",
"static",
"void",
"posixFadviseIfPossible",
"(",
"FileDescriptor",
"fd",
",",
"long",
"offset",
",",
"long",
"len",
",",
"int",
"flags",
")",
"throws",
"NativeIOException",
"{",
"if",
"(",
"nativeLoaded",
"&&",
"fadvisePossible",
")",
"{",
"try",
"{"... | Call posix_fadvise on the given file descriptor. See the manpage
for this syscall for more information. On systems where this
call is not available, does nothing.
@throws NativeIOException if there is an error with the syscall | [
"Call",
"posix_fadvise",
"on",
"the",
"given",
"file",
"descriptor",
".",
"See",
"the",
"manpage",
"for",
"this",
"syscall",
"for",
"more",
"information",
".",
"On",
"systems",
"where",
"this",
"call",
"is",
"not",
"available",
"does",
"nothing",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/nativeio/NativeIO.java#L330-L349 |
118,275 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/nativeio/NativeIO.java | NativeIO.syncFileRangeIfPossible | public static void syncFileRangeIfPossible(
FileDescriptor fd, long offset, long nbytes, int flags)
throws NativeIOException {
InjectionHandler.processEvent(InjectionEventCore.NATIVEIO_SYNC_FILE_RANGE,
flags);
if (nativeLoaded && syncFileRangePossible) {
try {
sync_file_range(f... | java | public static void syncFileRangeIfPossible(
FileDescriptor fd, long offset, long nbytes, int flags)
throws NativeIOException {
InjectionHandler.processEvent(InjectionEventCore.NATIVEIO_SYNC_FILE_RANGE,
flags);
if (nativeLoaded && syncFileRangePossible) {
try {
sync_file_range(f... | [
"public",
"static",
"void",
"syncFileRangeIfPossible",
"(",
"FileDescriptor",
"fd",
",",
"long",
"offset",
",",
"long",
"nbytes",
",",
"int",
"flags",
")",
"throws",
"NativeIOException",
"{",
"InjectionHandler",
".",
"processEvent",
"(",
"InjectionEventCore",
".",
... | Call sync_file_range on the given file descriptor. See the manpage
for this syscall for more information. On systems where this
call is not available, does nothing.
@throws NativeIOException if there is an error with the syscall | [
"Call",
"sync_file_range",
"on",
"the",
"given",
"file",
"descriptor",
".",
"See",
"the",
"manpage",
"for",
"this",
"syscall",
"for",
"more",
"information",
".",
"On",
"systems",
"where",
"this",
"call",
"is",
"not",
"available",
"does",
"nothing",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/nativeio/NativeIO.java#L358-L378 |
118,276 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/CreateOptions.java | CreateOptions.writeOptions | public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){
WriteOptions wo = new WriteOptions();
if (overwrite != null)
wo.setOverwrite(overwrite);
if (forceSync != null)
wo.setForcesync(forceSync);
return wo;
} | java | public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){
WriteOptions wo = new WriteOptions();
if (overwrite != null)
wo.setOverwrite(overwrite);
if (forceSync != null)
wo.setForcesync(forceSync);
return wo;
} | [
"public",
"static",
"WriteOptions",
"writeOptions",
"(",
"Boolean",
"overwrite",
",",
"Boolean",
"forceSync",
")",
"{",
"WriteOptions",
"wo",
"=",
"new",
"WriteOptions",
"(",
")",
";",
"if",
"(",
"overwrite",
"!=",
"null",
")",
"wo",
".",
"setOverwrite",
"("... | Creates a WriteOptions from given overwrite and forceSync values. If null passed,
it will use their default value. | [
"Creates",
"a",
"WriteOptions",
"from",
"given",
"overwrite",
"and",
"forceSync",
"values",
".",
"If",
"null",
"passed",
"it",
"will",
"use",
"their",
"default",
"value",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/CreateOptions.java#L39-L46 |
118,277 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/CreateOptions.java | CreateOptions.getOpt | public static CreateOptions getOpt(Class<? extends CreateOptions> theClass, CreateOptions... opts) {
if (opts == null)
return null;
CreateOptions result = null;
for (int i = 0; i < opts.length; ++i) {
if (opts[i].getClass() == theClass) {
if (result != null)
throw new IllegalAr... | java | public static CreateOptions getOpt(Class<? extends CreateOptions> theClass, CreateOptions... opts) {
if (opts == null)
return null;
CreateOptions result = null;
for (int i = 0; i < opts.length; ++i) {
if (opts[i].getClass() == theClass) {
if (result != null)
throw new IllegalAr... | [
"public",
"static",
"CreateOptions",
"getOpt",
"(",
"Class",
"<",
"?",
"extends",
"CreateOptions",
">",
"theClass",
",",
"CreateOptions",
"...",
"opts",
")",
"{",
"if",
"(",
"opts",
"==",
"null",
")",
"return",
"null",
";",
"CreateOptions",
"result",
"=",
... | Get an option of desired type
@param theClass
is the desired class of the opt
@param opts
- not null - at least one opt must be passed
@return an opt from one of the opts of type theClass.
returns null if there isn't any | [
"Get",
"an",
"option",
"of",
"desired",
"type"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/CreateOptions.java#L145-L157 |
118,278 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/CreateOptions.java | CreateOptions.setOpt | public static <T extends CreateOptions> CreateOptions[] setOpt(T newValue, CreateOptions ... opts) {
boolean alreadyInOpts = false;
if (opts != null) {
for (int i = 0; i < opts.length; ++i) {
if (opts[i].getClass() == newValue.getClass()) {
if (alreadyInOpts)
throw new Illega... | java | public static <T extends CreateOptions> CreateOptions[] setOpt(T newValue, CreateOptions ... opts) {
boolean alreadyInOpts = false;
if (opts != null) {
for (int i = 0; i < opts.length; ++i) {
if (opts[i].getClass() == newValue.getClass()) {
if (alreadyInOpts)
throw new Illega... | [
"public",
"static",
"<",
"T",
"extends",
"CreateOptions",
">",
"CreateOptions",
"[",
"]",
"setOpt",
"(",
"T",
"newValue",
",",
"CreateOptions",
"...",
"opts",
")",
"{",
"boolean",
"alreadyInOpts",
"=",
"false",
";",
"if",
"(",
"opts",
"!=",
"null",
")",
... | set an option
@param newValue
the option to be set
@param opts
- the option is set into this array of opts
@return updated CreateOpts[] == opts + newValue
@throws IllegalArgumentException If two options with the same type as newValue exists change will apply to one of them, and an Exception will be thrown. | [
"set",
"an",
"option"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/CreateOptions.java#L169-L189 |
118,279 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java | BlockReceiver.handleMirrorOutError | private void handleMirrorOutError(IOException ioe) throws IOException {
LOG.info(datanode.getDatanodeInfo() + ": Exception writing block " +
block + " namespaceId: " + namespaceId + " to mirror " + mirrorAddr + "\n" +
StringUtils.stringifyException(ioe));
if (Thread.interrupted()) { //... | java | private void handleMirrorOutError(IOException ioe) throws IOException {
LOG.info(datanode.getDatanodeInfo() + ": Exception writing block " +
block + " namespaceId: " + namespaceId + " to mirror " + mirrorAddr + "\n" +
StringUtils.stringifyException(ioe));
if (Thread.interrupted()) { //... | [
"private",
"void",
"handleMirrorOutError",
"(",
"IOException",
"ioe",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"datanode",
".",
"getDatanodeInfo",
"(",
")",
"+",
"\": Exception writing block \"",
"+",
"block",
"+",
"\" namespaceId: \"",
"+",
"na... | While writing to mirrorOut, failure to write to mirror should not
affect this datanode. | [
"While",
"writing",
"to",
"mirrorOut",
"failure",
"to",
"write",
"to",
"mirror",
"should",
"not",
"affect",
"this",
"datanode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L218-L230 |
118,280 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java | BlockReceiver.verifyChunks | private void verifyChunks( byte[] dataBuf, int dataOff, int len,
byte[] checksumBuf, int checksumOff,
int firstChunkOffset, int packetVersion)
throws IOException {
int chunkOffset = firstChunkOffset;
while (len > 0) {
... | java | private void verifyChunks( byte[] dataBuf, int dataOff, int len,
byte[] checksumBuf, int checksumOff,
int firstChunkOffset, int packetVersion)
throws IOException {
int chunkOffset = firstChunkOffset;
while (len > 0) {
... | [
"private",
"void",
"verifyChunks",
"(",
"byte",
"[",
"]",
"dataBuf",
",",
"int",
"dataOff",
",",
"int",
"len",
",",
"byte",
"[",
"]",
"checksumBuf",
",",
"int",
"checksumOff",
",",
"int",
"firstChunkOffset",
",",
"int",
"packetVersion",
")",
"throws",
"IOE... | Verify multiple CRC chunks. | [
"Verify",
"multiple",
"CRC",
"chunks",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L235-L277 |
118,281 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/common/Util.java | Util.stringAsURI | public static URI stringAsURI(String s) throws IOException {
URI u = null;
// try to make a URI
try {
u = new URI(s);
} catch (URISyntaxException e){
LOG.error("Syntax error in URI " + s
+ ". Please check hdfs configuration.", e);
}
// if URI is null or scheme is undefined... | java | public static URI stringAsURI(String s) throws IOException {
URI u = null;
// try to make a URI
try {
u = new URI(s);
} catch (URISyntaxException e){
LOG.error("Syntax error in URI " + s
+ ". Please check hdfs configuration.", e);
}
// if URI is null or scheme is undefined... | [
"public",
"static",
"URI",
"stringAsURI",
"(",
"String",
"s",
")",
"throws",
"IOException",
"{",
"URI",
"u",
"=",
"null",
";",
"// try to make a URI",
"try",
"{",
"u",
"=",
"new",
"URI",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
... | Interprets the passed string as a URI. In case of error it
assumes the specified string is a file.
@param s the string to interpret
@return the resulting URI
@throws IOException | [
"Interprets",
"the",
"passed",
"string",
"as",
"a",
"URI",
".",
"In",
"case",
"of",
"error",
"it",
"assumes",
"the",
"specified",
"string",
"is",
"a",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/common/Util.java#L49-L66 |
118,282 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/common/Util.java | Util.stringCollectionAsURIs | public static Collection<URI> stringCollectionAsURIs(
Collection<String> names) {
Collection<URI> uris = new ArrayList<URI>(names.size());
for(String name : names) {
try {
uris.add(stringAsURI(name));
} catch (IOException e) {
LOG.error("Error while ... | java | public static Collection<URI> stringCollectionAsURIs(
Collection<String> names) {
Collection<URI> uris = new ArrayList<URI>(names.size());
for(String name : names) {
try {
uris.add(stringAsURI(name));
} catch (IOException e) {
LOG.error("Error while ... | [
"public",
"static",
"Collection",
"<",
"URI",
">",
"stringCollectionAsURIs",
"(",
"Collection",
"<",
"String",
">",
"names",
")",
"{",
"Collection",
"<",
"URI",
">",
"uris",
"=",
"new",
"ArrayList",
"<",
"URI",
">",
"(",
"names",
".",
"size",
"(",
")",
... | Converts a collection of strings into a collection of URIs.
@param names collection of strings to convert to URIs
@return collection of URIs | [
"Converts",
"a",
"collection",
"of",
"strings",
"into",
"a",
"collection",
"of",
"URIs",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/common/Util.java#L84-L95 |
118,283 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.getRealTaskLogFilePath | static String getRealTaskLogFilePath(String location, LogName filter)
throws IOException {
return FileUtil.makeShellPath(new File(getBaseDir(location),
filter.toString()));
} | java | static String getRealTaskLogFilePath(String location, LogName filter)
throws IOException {
return FileUtil.makeShellPath(new File(getBaseDir(location),
filter.toString()));
} | [
"static",
"String",
"getRealTaskLogFilePath",
"(",
"String",
"location",
",",
"LogName",
"filter",
")",
"throws",
"IOException",
"{",
"return",
"FileUtil",
".",
"makeShellPath",
"(",
"new",
"File",
"(",
"getBaseDir",
"(",
"location",
")",
",",
"filter",
".",
"... | Get the real task-log file-path
@param location Location of the log-file. This should point to an
attempt-directory.
@param filter
@return
@throws IOException | [
"Get",
"the",
"real",
"task",
"-",
"log",
"file",
"-",
"path"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L115-L119 |
118,284 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.captureOutAndError | public static List<String> captureOutAndError(List<String> cmd,
File stdoutFilename,
File stderrFilename,
long tailLength
) thro... | java | public static List<String> captureOutAndError(List<String> cmd,
File stdoutFilename,
File stderrFilename,
long tailLength
) thro... | [
"public",
"static",
"List",
"<",
"String",
">",
"captureOutAndError",
"(",
"List",
"<",
"String",
">",
"cmd",
",",
"File",
"stdoutFilename",
",",
"File",
"stderrFilename",
",",
"long",
"tailLength",
")",
"throws",
"IOException",
"{",
"return",
"captureOutAndErro... | Wrap a command in a shell to capture stdout and stderr to files.
If the tailLength is 0, the entire output will be saved.
@param cmd The command and the arguments that should be run
@param stdoutFilename The filename that stdout should be saved to
@param stderrFilename The filename that stderr should be saved to
@param... | [
"Wrap",
"a",
"command",
"in",
"a",
"shell",
"to",
"capture",
"stdout",
"and",
"stderr",
"to",
"files",
".",
"If",
"the",
"tailLength",
"is",
"0",
"the",
"entire",
"output",
"will",
"be",
"saved",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L506-L513 |
118,285 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.captureOutAndError | public static List<String> captureOutAndError(List<String> setup,
List<String> cmd,
File stdoutFilename,
File stderrFilename,
long tailLength,
boolean useSetsid
) throws IOException {
List<String> result = new ArrayList<String>(3);
result.add(bashCommand);
result.add("-c"... | java | public static List<String> captureOutAndError(List<String> setup,
List<String> cmd,
File stdoutFilename,
File stderrFilename,
long tailLength,
boolean useSetsid
) throws IOException {
List<String> result = new ArrayList<String>(3);
result.add(bashCommand);
result.add("-c"... | [
"public",
"static",
"List",
"<",
"String",
">",
"captureOutAndError",
"(",
"List",
"<",
"String",
">",
"setup",
",",
"List",
"<",
"String",
">",
"cmd",
",",
"File",
"stdoutFilename",
",",
"File",
"stderrFilename",
",",
"long",
"tailLength",
",",
"boolean",
... | Wrap a command in a shell to capture stdout and stderr to files.
Setup commands such as setting memory limit can be passed which
will be executed before exec.
If the tailLength is 0, the entire output will be saved.
@param setup The setup commands for the execed process.
@param cmd The command and the arguments that sh... | [
"Wrap",
"a",
"command",
"in",
"a",
"shell",
"to",
"capture",
"stdout",
"and",
"stderr",
"to",
"files",
".",
"Setup",
"commands",
"such",
"as",
"setting",
"memory",
"limit",
"can",
"be",
"passed",
"which",
"will",
"be",
"executed",
"before",
"exec",
".",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L605-L621 |
118,286 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.addCommand | public static String addCommand(List<String> cmd, boolean isExecutable)
throws IOException {
StringBuffer command = new StringBuffer();
for(String s: cmd) {
command.append('\'');
if (isExecutable) {
// the executable name needs to be expressed as a shell path for the
// shell to ... | java | public static String addCommand(List<String> cmd, boolean isExecutable)
throws IOException {
StringBuffer command = new StringBuffer();
for(String s: cmd) {
command.append('\'');
if (isExecutable) {
// the executable name needs to be expressed as a shell path for the
// shell to ... | [
"public",
"static",
"String",
"addCommand",
"(",
"List",
"<",
"String",
">",
"cmd",
",",
"boolean",
"isExecutable",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"command",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"cm... | Add quotes to each of the command strings and
return as a single string
@param cmd The command to be quoted
@param isExecutable makes shell path if the first
argument is executable
@return returns The quoted string.
@throws IOException | [
"Add",
"quotes",
"to",
"each",
"of",
"the",
"command",
"strings",
"and",
"return",
"as",
"a",
"single",
"string"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L685-L702 |
118,287 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.captureDebugOut | public static List<String> captureDebugOut(List<String> cmd,
File debugoutFilename
) throws IOException {
String debugout = FileUtil.makeShellPath(debugoutFilename);
List<String> result = new ArrayList<String>(3);
resu... | java | public static List<String> captureDebugOut(List<String> cmd,
File debugoutFilename
) throws IOException {
String debugout = FileUtil.makeShellPath(debugoutFilename);
List<String> result = new ArrayList<String>(3);
resu... | [
"public",
"static",
"List",
"<",
"String",
">",
"captureDebugOut",
"(",
"List",
"<",
"String",
">",
"cmd",
",",
"File",
"debugoutFilename",
")",
"throws",
"IOException",
"{",
"String",
"debugout",
"=",
"FileUtil",
".",
"makeShellPath",
"(",
"debugoutFilename",
... | Wrap a command in a shell to capture debug script's
stdout and stderr to debugout.
@param cmd The command and the arguments that should be run
@param debugoutFilename The filename that stdout and stderr
should be saved to.
@return the modified command that should be run
@throws IOException | [
"Wrap",
"a",
"command",
"in",
"a",
"shell",
"to",
"capture",
"debug",
"script",
"s",
"stdout",
"and",
"stderr",
"to",
"debugout",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L713-L740 |
118,288 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/DU.java | DU.start | public void start() {
//only start the thread if the interval is sane
if(refreshInterval > 0) {
refreshUsed = new Thread(new DURefreshThread(),
"refreshUsed-"+dirPath);
refreshUsed.setDaemon(true);
refreshUsed.start();
}
} | java | public void start() {
//only start the thread if the interval is sane
if(refreshInterval > 0) {
refreshUsed = new Thread(new DURefreshThread(),
"refreshUsed-"+dirPath);
refreshUsed.setDaemon(true);
refreshUsed.start();
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"//only start the thread if the interval is sane",
"if",
"(",
"refreshInterval",
">",
"0",
")",
"{",
"refreshUsed",
"=",
"new",
"Thread",
"(",
"new",
"DURefreshThread",
"(",
")",
",",
"\"refreshUsed-\"",
"+",
"dirPath",
... | Start the disk usage checking thread. | [
"Start",
"the",
"disk",
"usage",
"checking",
"thread",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/DU.java#L255-L263 |
118,289 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/DU.java | DU.shutdown | public void shutdown() {
this.shouldRun = false;
this.namespaceSliceDUMap.clear();
if(this.refreshUsed != null) {
this.refreshUsed.interrupt();
try {
this.refreshUsed.join();
this.refreshUsed = null;
} catch (InterruptedException ie) {
}
}
} | java | public void shutdown() {
this.shouldRun = false;
this.namespaceSliceDUMap.clear();
if(this.refreshUsed != null) {
this.refreshUsed.interrupt();
try {
this.refreshUsed.join();
this.refreshUsed = null;
} catch (InterruptedException ie) {
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"this",
".",
"shouldRun",
"=",
"false",
";",
"this",
".",
"namespaceSliceDUMap",
".",
"clear",
"(",
")",
";",
"if",
"(",
"this",
".",
"refreshUsed",
"!=",
"null",
")",
"{",
"this",
".",
"refreshUsed",
".",
... | Shut down the refreshing thread. | [
"Shut",
"down",
"the",
"refreshing",
"thread",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/DU.java#L268-L279 |
118,290 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaClient.java | CoronaClient.killSession | private int killSession(String sessionId)throws IOException {
try {
System.out.printf("Killing %s", sessionId);
ClusterManagerService.Client client = getCMSClient();
try {
client.killSession(sessionId);
} catch (SafeModeException e) {
throw new IOException(
"Cannot ... | java | private int killSession(String sessionId)throws IOException {
try {
System.out.printf("Killing %s", sessionId);
ClusterManagerService.Client client = getCMSClient();
try {
client.killSession(sessionId);
} catch (SafeModeException e) {
throw new IOException(
"Cannot ... | [
"private",
"int",
"killSession",
"(",
"String",
"sessionId",
")",
"throws",
"IOException",
"{",
"try",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"Killing %s\"",
",",
"sessionId",
")",
";",
"ClusterManagerService",
".",
"Client",
"client",
"=",
"getCMSCl... | Tells the cluster manager to kill the session with a given id
@param sessionId the id of the session to kill
@return 0 in case of success, non zero value on error
@throws IOException | [
"Tells",
"the",
"cluster",
"manager",
"to",
"kill",
"the",
"session",
"with",
"a",
"given",
"id"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaClient.java#L98-L113 |
118,291 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaClient.java | CoronaClient.listSessions | private int listSessions() throws IOException {
try {
ClusterManagerService.Client client = getCMSClient();
List<RunningSession> sessions;
try {
sessions = client.getSessions();
} catch (SafeModeException e) {
throw new IOException(
"Cannot list sessions, ClusterMan... | java | private int listSessions() throws IOException {
try {
ClusterManagerService.Client client = getCMSClient();
List<RunningSession> sessions;
try {
sessions = client.getSessions();
} catch (SafeModeException e) {
throw new IOException(
"Cannot list sessions, ClusterMan... | [
"private",
"int",
"listSessions",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ClusterManagerService",
".",
"Client",
"client",
"=",
"getCMSClient",
"(",
")",
";",
"List",
"<",
"RunningSession",
">",
"sessions",
";",
"try",
"{",
"sessions",
"=",
"cli... | Gets a list of the sessions from the cluster manager
and outputs them on the console
@return 0 in case of success, non zero value on error
@throws IOException | [
"Gets",
"a",
"list",
"of",
"the",
"sessions",
"from",
"the",
"cluster",
"manager",
"and",
"outputs",
"them",
"on",
"the",
"console"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaClient.java#L133-L175 |
118,292 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsVisitorFactory.java | EditsVisitorFactory.getEditsVisitor | static public EditsVisitor getEditsVisitor(String filename,
String processor,
Tokenizer tokenizer,
boolean printToScreen) throws IOException {
if(processor.toLowerCase().equals("xml")) {
return new XmlEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("... | java | static public EditsVisitor getEditsVisitor(String filename,
String processor,
Tokenizer tokenizer,
boolean printToScreen) throws IOException {
if(processor.toLowerCase().equals("xml")) {
return new XmlEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("... | [
"static",
"public",
"EditsVisitor",
"getEditsVisitor",
"(",
"String",
"filename",
",",
"String",
"processor",
",",
"Tokenizer",
"tokenizer",
",",
"boolean",
"printToScreen",
")",
"throws",
"IOException",
"{",
"if",
"(",
"processor",
".",
"toLowerCase",
"(",
")",
... | Factory function that creates an EditsVisitor object
@param filename output filename
@param tokenizer input tokenizer
@return EditsVisitor for appropriate output format (binary, XML etc.) | [
"Factory",
"function",
"that",
"creates",
"an",
"EditsVisitor",
"object"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsVisitorFactory.java#L36-L51 |
118,293 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.runCommand | private void runCommand(TaskCommands taskCommand, String user,
List<String> cmdArgs, File workDir, Map<String, String> env)
throws IOException {
ShellCommandExecutor shExec =
buildTaskControllerExecutor(taskCommand, user, cmdArgs, workDir, env);
try {
shExec.execute();
} catch (Ex... | java | private void runCommand(TaskCommands taskCommand, String user,
List<String> cmdArgs, File workDir, Map<String, String> env)
throws IOException {
ShellCommandExecutor shExec =
buildTaskControllerExecutor(taskCommand, user, cmdArgs, workDir, env);
try {
shExec.execute();
} catch (Ex... | [
"private",
"void",
"runCommand",
"(",
"TaskCommands",
"taskCommand",
",",
"String",
"user",
",",
"List",
"<",
"String",
">",
"cmdArgs",
",",
"File",
"workDir",
",",
"Map",
"<",
"String",
",",
"String",
">",
"env",
")",
"throws",
"IOException",
"{",
"ShellC... | Helper method that runs a LinuxTaskController command
@param taskCommand
@param user
@param cmdArgs
@param env
@throws IOException | [
"Helper",
"method",
"that",
"runs",
"a",
"LinuxTaskController",
"command"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L182-L205 |
118,294 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.getJobId | private String getJobId(TaskControllerContext context) {
String taskId = context.task.getTaskID().toString();
TaskAttemptID tId = TaskAttemptID.forName(taskId);
String jobId = tId.getJobID().toString();
return jobId;
} | java | private String getJobId(TaskControllerContext context) {
String taskId = context.task.getTaskID().toString();
TaskAttemptID tId = TaskAttemptID.forName(taskId);
String jobId = tId.getJobID().toString();
return jobId;
} | [
"private",
"String",
"getJobId",
"(",
"TaskControllerContext",
"context",
")",
"{",
"String",
"taskId",
"=",
"context",
".",
"task",
".",
"getTaskID",
"(",
")",
".",
"toString",
"(",
")",
";",
"TaskAttemptID",
"tId",
"=",
"TaskAttemptID",
".",
"forName",
"("... | get the Job ID from the information in the TaskControllerContext | [
"get",
"the",
"Job",
"ID",
"from",
"the",
"information",
"in",
"the",
"TaskControllerContext"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L299-L304 |
118,295 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.getDirectoryChosenForTask | private String getDirectoryChosenForTask(File directory,
TaskControllerContext context) {
String jobId = getJobId(context);
String taskId = context.task.getTaskID().toString();
for (String dir : mapredLocalDirs) {
File mapredDir = new File(dir);
File taskDir = new File(mapredDir, TaskTrack... | java | private String getDirectoryChosenForTask(File directory,
TaskControllerContext context) {
String jobId = getJobId(context);
String taskId = context.task.getTaskID().toString();
for (String dir : mapredLocalDirs) {
File mapredDir = new File(dir);
File taskDir = new File(mapredDir, TaskTrack... | [
"private",
"String",
"getDirectoryChosenForTask",
"(",
"File",
"directory",
",",
"TaskControllerContext",
"context",
")",
"{",
"String",
"jobId",
"=",
"getJobId",
"(",
"context",
")",
";",
"String",
"taskId",
"=",
"context",
".",
"task",
".",
"getTaskID",
"(",
... | this task. | [
"this",
"task",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L309-L325 |
118,296 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.setupTaskLogFileAccess | private void setupTaskLogFileAccess(TaskControllerContext context) {
TaskAttemptID taskId = context.task.getTaskID();
File f = TaskLog.getTaskLogFile(taskId, TaskLog.LogName.SYSLOG);
String taskAttemptLogDir = f.getParentFile().getAbsolutePath();
changeDirectoryPermissions(taskAttemptLogDir, FILE_PERMIS... | java | private void setupTaskLogFileAccess(TaskControllerContext context) {
TaskAttemptID taskId = context.task.getTaskID();
File f = TaskLog.getTaskLogFile(taskId, TaskLog.LogName.SYSLOG);
String taskAttemptLogDir = f.getParentFile().getAbsolutePath();
changeDirectoryPermissions(taskAttemptLogDir, FILE_PERMIS... | [
"private",
"void",
"setupTaskLogFileAccess",
"(",
"TaskControllerContext",
"context",
")",
"{",
"TaskAttemptID",
"taskId",
"=",
"context",
".",
"task",
".",
"getTaskID",
"(",
")",
";",
"File",
"f",
"=",
"TaskLog",
".",
"getTaskLogFile",
"(",
"taskId",
",",
"Ta... | the task log directory | [
"the",
"task",
"log",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L350-L355 |
118,297 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.setupTaskCacheFileAccess | private void setupTaskCacheFileAccess(TaskControllerContext context) {
String taskId = context.task.getTaskID().toString();
JobID jobId = JobID.forName(getJobId(context));
//Change permission for the task across all the disks
for(String localDir : mapredLocalDirs) {
File f = new File(localDir);
... | java | private void setupTaskCacheFileAccess(TaskControllerContext context) {
String taskId = context.task.getTaskID().toString();
JobID jobId = JobID.forName(getJobId(context));
//Change permission for the task across all the disks
for(String localDir : mapredLocalDirs) {
File f = new File(localDir);
... | [
"private",
"void",
"setupTaskCacheFileAccess",
"(",
"TaskControllerContext",
"context",
")",
"{",
"String",
"taskId",
"=",
"context",
".",
"task",
".",
"getTaskID",
"(",
")",
".",
"toString",
"(",
")",
";",
"JobID",
"jobId",
"=",
"JobID",
".",
"forName",
"("... | the files under the job and task cache directories | [
"the",
"files",
"under",
"the",
"job",
"and",
"task",
"cache",
"directories"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L359-L372 |
118,298 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.changeDirectoryPermissions | private void changeDirectoryPermissions(String dir, String mode,
boolean isRecursive) {
int ret = 0;
try {
ret = FileUtil.chmod(dir, mode, isRecursive);
} catch (Exception e) {
LOG.warn("Exception in changing permissions for directory " + dir +
... | java | private void changeDirectoryPermissions(String dir, String mode,
boolean isRecursive) {
int ret = 0;
try {
ret = FileUtil.chmod(dir, mode, isRecursive);
} catch (Exception e) {
LOG.warn("Exception in changing permissions for directory " + dir +
... | [
"private",
"void",
"changeDirectoryPermissions",
"(",
"String",
"dir",
",",
"String",
"mode",
",",
"boolean",
"isRecursive",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"try",
"{",
"ret",
"=",
"FileUtil",
".",
"chmod",
"(",
"dir",
",",
"mode",
",",
"isRecursi... | convenience method to execute chmod. | [
"convenience",
"method",
"to",
"execute",
"chmod",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L375-L387 |
118,299 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.getTaskCacheDirectory | private String getTaskCacheDirectory(TaskControllerContext context) {
// In the case of JVM reuse, the task specific directory
// is different from what is set with respect with
// env.workDir. Hence building this from the taskId everytime.
String taskId = context.task.getTaskID().toString();
File c... | java | private String getTaskCacheDirectory(TaskControllerContext context) {
// In the case of JVM reuse, the task specific directory
// is different from what is set with respect with
// env.workDir. Hence building this from the taskId everytime.
String taskId = context.task.getTaskID().toString();
File c... | [
"private",
"String",
"getTaskCacheDirectory",
"(",
"TaskControllerContext",
"context",
")",
"{",
"// In the case of JVM reuse, the task specific directory",
"// is different from what is set with respect with",
"// env.workDir. Hence building this from the taskId everytime.",
"String",
"task... | Return the task specific directory under the cache. | [
"Return",
"the",
"task",
"specific",
"directory",
"under",
"the",
"cache",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L435-L445 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.