_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q161900 | NNStorage.inspectStorageDirs | train | void inspectStorageDirs(FSImageStorageInspector inspector)
throws IOException {
// Process each of the storage directories to find the pair of
// newest image file and edit file
for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
inspector... | java | {
"resource": ""
} |
q161901 | NNStorage.readAndInspectDirs | train | FSImageStorageInspector readAndInspectDirs()
throws IOException {
int minLayoutVersion = Integer.MAX_VALUE; // the newest
int maxLayoutVersion = Integer.MIN_VALUE; // the oldest
// First determine what range of layout versions we're going to inspect
for (Iterator<StorageDirectory> it = dirIte... | java | {
"resource": ""
} |
q161902 | ProcfsBasedProcessTree.isAvailable | train | public static boolean isAvailable() {
try {
String osName = System.getProperty("os.name");
if (!osName.startsWith("Linux")) {
LOG.info("ProcfsBasedProcessTree currently is supported only on "
+ "Linux.");
return false;
}
} catch (SecurityException se) {
LOG.wa... | java | {
"resource": ""
} |
q161903 | ProcfsBasedProcessTree.getProcessTree | train | public ProcfsBasedProcessTree getProcessTree() {
if (pid != -1) {
// Get the list of processes
List<Integer> processList = getProcessList();
Map<Integer, ProcessInfo> allProcessInfo = new HashMap<Integer, ProcessInfo>();
// cache the processTree to get the age for processes
Map... | java | {
"resource": ""
} |
q161904 | ProcfsBasedProcessTree.isAnyProcessInTreeAlive | train | public boolean isAnyProcessInTreeAlive() {
for (Integer pId : processTree.keySet()) {
if (isAlive(pId.toString())) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q161905 | ProcfsBasedProcessTree.checkPidPgrpidForMatch | train | static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) {
Integer pId = Integer.parseInt(pidStr);
// Get information for this process
ProcessInfo pInfo = new ProcessInfo(pId);
pInfo = constructProcessInfo(pInfo, procfsDir);
if (pInfo == null) {
// process group leader may have f... | java | {
"resource": ""
} |
q161906 | ProcfsBasedProcessTree.assertAndDestroyProcessGroup | train | public static void assertAndDestroyProcessGroup(String pgrpId, long interval,
boolean inBackground)
throws IOException {
// Make sure that the pid given is a process group leader
if (!checkPidPgrpidForMatch(pgrpId, PROCFS)) {
throw new IOException("Process with PID " + pgrp... | java | {
"resource": ""
} |
q161907 | ProcfsBasedProcessTree.getProcessTreeDump | train | public String getProcessTreeDump() {
StringBuilder ret = new StringBuilder();
// The header.
ret.append(String.format("\t|- PID PPID PGRPID SESSID CMD_NAME "
+ "USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) "
+ "RSSMEM_USAGE(PAGES) FULL_CMD_LINE\n"));
for (ProcessInfo p : ... | java | {
"resource": ""
} |
q161908 | ProcfsBasedProcessTree.getProcessNameContainsCount | train | public Collection<String> getProcessNameContainsCount(String name) {
List<String> retProcessList = new ArrayList<String>();
// Get the list of processes
List<Integer> processList = getProcessList();
for (Integer proc : processList) {
// Get information for each process
ProcessInfo p = new P... | java | {
"resource": ""
} |
q161909 | ProcfsBasedProcessTree.getCumulativeVmem | train | public long getCumulativeVmem(int olderThanAge) {
long total = 0;
for (ProcessInfo p : processTree.values()) {
if ((p != null) && (p.getAge() > olderThanAge)) {
total += p.getVmem();
}
}
return total;
} | java | {
"resource": ""
} |
q161910 | ProcfsBasedProcessTree.getCumulativeCpuTime | train | public long getCumulativeCpuTime() {
if (JIFFY_LENGTH_IN_MILLIS < 0) {
return 0;
}
long incJiffies = 0;
for (ProcessInfo p : processTree.values()) {
if (p != null) {
incJiffies += p.dtime;
}
}
if (incJiffies * JIFFY_LENGTH_IN_MILLIS < Integer.MAX_VALUE) {
// Ignor... | java | {
"resource": ""
} |
q161911 | ProcfsBasedProcessTree.getProcessList | train | private List<Integer> getProcessList() {
String[] processDirs = (new File(procfsDir)).list();
List<Integer> processList = new ArrayList<Integer>();
for (String dir : processDirs) {
try {
int pd = Integer.parseInt(dir);
if ((new File(procfsDir, dir)).isDirectory()) {
processL... | java | {
"resource": ""
} |
q161912 | ProcfsBasedProcessTree.constructProcessInfo | train | private static ProcessInfo constructProcessInfo(ProcessInfo pinfo,
String procfsDir) {
ProcessInfo ret = null;
// Read "procfsDir/<pid>/stat" file - typically /proc/<pid>/stat
BufferedReader in = null;
FileReader fReader = null;
try {
File p... | java | {
"resource": ""
} |
q161913 | MStress_Client.parseOptions | train | private static void parseOptions(String args[])
{
if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
usage();
}
/*
* As described in usage():
* -s dfs-server
* -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
* -a planfile-path
* -c ho... | java | {
"resource": ""
} |
q161914 | MStress_Client.usage | train | private static void usage()
{
String className = MStress_Client.class.getName();
System.out.printf("Usage: java %s -s dfs-server -p dfs-port" +
"[-t [create|stat|read|readdir|delete|rename] -a planfile-path -c host -n process-name" +
" -P prefix]\n",
className);
System.ou... | java | {
"resource": ""
} |
q161915 | MStress_Client.parsePlanFile | train | private static int parsePlanFile()
{
int ret = -1;
try {
FileInputStream fis = new FileInputStream(planfilePath_);
DataInputStream dis = new DataInputStream(fis);
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
if (prefix_.isEmpty()) {
prefix_ = "PATH_PREFI... | java | {
"resource": ""
} |
q161916 | MStress_Client.CreateDFSPaths | train | private static int CreateDFSPaths(int level, String parentPath) {
Boolean isLeaf = false;
Boolean isDir = false;
if (level + 1 >= levels_) {
isLeaf = true;
}
if (isLeaf) {
if (type_.equals("dir")) {
isDir = true;
} else {
isDir = false;
}
} else {
is... | java | {
"resource": ""
} |
q161917 | MStress_Client.createWriteDFSPaths | train | private static int createWriteDFSPaths()
{
if (createDFSPaths() != 0) {
return -1;
}
try {
// write to all the files!
for (Map.Entry<String, OutputStream> file : files_.entrySet()) {
OutputStream os = file.getValue();
long startTime = System.nanoTime();
os.write(data_.getByte... | java | {
"resource": ""
} |
q161918 | CoronaJobTrackerRunner.localizeTaskConfiguration | train | @SuppressWarnings("deprecation")
private void localizeTaskConfiguration(TaskTracker tracker, JobConf ttConf,
String workDir, Task t, JobID jobID) throws IOException {
Path jobFile = new Path(t.getJobFile());
FileSystem systemFS = tracker.systemFS;
this.localizedJobFile = new Path(workDir, jobID + ".... | java | {
"resource": ""
} |
q161919 | CoronaJobTrackerRunner.prepare | train | @Override
public boolean prepare() throws IOException {
if (!super.prepare()) {
return false;
}
mapOutputFile.removeAll(getTask().getTaskID());
return true;
} | java | {
"resource": ""
} |
q161920 | CompositeInputFormat.addDefaults | train | protected void addDefaults() {
try {
Parser.CNode.addIdentifier("inner", InnerJoinRecordReader.class);
Parser.CNode.addIdentifier("outer", OuterJoinRecordReader.class);
Parser.CNode.addIdentifier("override", OverrideRecordReader.class);
Parser.WNode.addIdentifier("tbl", WrappedRecordReader.c... | java | {
"resource": ""
} |
q161921 | CompositeInputFormat.addUserIdentifiers | train | private void addUserIdentifiers(JobConf job) throws IOException {
Pattern x = Pattern.compile("^mapred\\.join\\.define\\.(\\w+)$");
for (Map.Entry<String,String> kv : job) {
Matcher m = x.matcher(kv.getKey());
if (m.matches()) {
try {
Parser.CNode.addIdentifier(m.group(1),
... | java | {
"resource": ""
} |
q161922 | CompositeInputFormat.getSplits | train | public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
setFormat(job);
job.setLong("mapred.min.split.size", Long.MAX_VALUE);
return root.getSplits(job, numSplits);
} | java | {
"resource": ""
} |
q161923 | CompositeInputFormat.getRecordReader | train | @SuppressWarnings("unchecked") // child types unknown
public ComposableRecordReader<K,TupleWritable> getRecordReader(
InputSplit split, JobConf job, Reporter reporter) throws IOException {
setFormat(job);
return root.getRecordReader(split, job, reporter);
} | java | {
"resource": ""
} |
q161924 | LogLevel.main | train | public static void main(String[] args) {
if (args.length == 3 && "-getlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]);
return;
}
else if (args.length == 4 && "-setlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]
... | java | {
"resource": ""
} |
q161925 | S3FileSystem.getFileStatus | train | @Override
public FileStatus getFileStatus(Path f) throws IOException {
INode inode = store.retrieveINode(makeAbsolute(f));
if (inode == null) {
throw new FileNotFoundException(f + ": No such file or directory.");
}
return new S3FileStatus(f.makeQualified(this), inode);
} | java | {
"resource": ""
} |
q161926 | ServerDispatcher.assignClient | train | @Override
public void assignClient(long clientId) {
LOG.info("Assigning client " + clientId + " ...");
synchronized (clientModificationsLock) {
newlyAssignedClients.add(clientId);
}
} | java | {
"resource": ""
} |
q161927 | ServerDispatcher.handleFailedDispatch | train | @Override
public void handleFailedDispatch(long clientId, long failedTime) {
ClientData clientData = core.getClientData(clientId);
if (failedTime == -1 || clientData == null)
return;
// We only add it and don't update it because we are interested in
// keeping track of the first moment it f... | java | {
"resource": ""
} |
q161928 | ServerDispatcher.handleSuccessfulDispatch | train | @Override
public void handleSuccessfulDispatch(long clientId, long sentTime) {
ClientData clientData = core.getClientData(clientId);
if (sentTime == -1 || clientData == null)
return;
clientData.markedAsFailedTime = -1;
if (clientData.markedAsFailedTime != -1) {
LOG.info("Unmarking " +... | java | {
"resource": ""
} |
q161929 | ServerDispatcher.updateClients | train | private void updateClients() {
assignedClients.addAll(newlyAssignedClients);
assignedClients.removeAll(removedClients);
newlyAssignedClients.clear();
removedClients.clear();
} | java | {
"resource": ""
} |
q161930 | DBCountPageView.populateAccess | train | private void populateAccess() throws SQLException {
PreparedStatement statement = null ;
try {
statement = connection.prepareStatement(
"INSERT INTO Access(url, referrer, time)" +
" VALUES (?, ?, ?)");
Random random = new Random();
int time = random.nextInt(50) + 50;
... | java | {
"resource": ""
} |
q161931 | DBCountPageView.verify | train | private boolean verify() throws SQLException {
//check total num pageview
String countAccessQuery = "SELECT COUNT(*) FROM Access";
String sumPageviewQuery = "SELECT SUM(pageview) FROM Pageview";
Statement st = null;
ResultSet rs = null;
try {
st = connection.createStatement();
rs = s... | java | {
"resource": ""
} |
q161932 | VolumeMap.get | train | DatanodeBlockInfo get(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getBlockInfo(block);
} | java | {
"resource": ""
} |
q161933 | VolumeMap.remove | train | DatanodeBlockInfo remove(int namespaceId, Block block) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
if (datasetDelta != null) {
datasetDelta.removeBlock(namespaceId, block);
}
return nm.removeBlockInfo(block);
} | java | {
"resource": ""
} |
q161934 | VolumeMap.size | train | int size(int namespaceId) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return 0;
}
return nm.size();
} | java | {
"resource": ""
} |
q161935 | VolumeMap.getOngoingCreates | train | ActiveFile getOngoingCreates(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getOngoingCreates(block);
} | java | {
"resource": ""
} |
q161936 | DefaultJobHistoryParser.parseJobTasks | train | public static void parseJobTasks(String jobHistoryFile,
JobHistory.JobInfo job, FileSystem fs)
throws IOException {
JobHistory.parseHistoryFromFS(jobHistoryFile,
new JobTasksParseListener(job), fs);
} | java | {
"resource": ""
} |
q161937 | ConfigManager.validateAllPolicies | train | private void validateAllPolicies(Collection<PolicyInfo> all)
throws IOException, NumberFormatException {
for (PolicyInfo pinfo: all) {
Path srcPath = pinfo.getSrcPath();
if (srcPath == null) {
throw new IOException("Unable to find srcPath in policy.");
}
if (pinfo.getProperty("r... | java | {
"resource": ""
} |
q161938 | PurgeMonitor.purgeDirectories | train | private void purgeDirectories(FileSystem fs, Path root) throws IOException {
DirectoryTraversal traversal =
DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
directoryTraversalThreads, directoryTraversalShuffle);
String prefix = root.toUri().getPath();
FileStatus dir;
... | java | {
"resource": ""
} |
q161939 | PurgeMonitor.existsBetterParityFile | train | private static boolean existsBetterParityFile(
Codec codec, FileStatus srcStat, Configuration conf) throws IOException {
for (Codec c : Codec.getCodecs()) {
if (c.priority > codec.priority) {
ParityFilePair ppair = ParityFilePair.getParityFile(
c, srcStat, conf);
if (ppair !=... | java | {
"resource": ""
} |
q161940 | BytesWritable.copyTo | train | public int copyTo(byte[] dest, int start)
throws BufferTooSmallException {
if (size > (dest.length - start)) {
throw new BufferTooSmallException("size is " + size
+ ", buffer availabe size is " + (dest.length - start));
}
if (size > 0) {
System.arraycopy(bytes, 0, dest, start, si... | java | {
"resource": ""
} |
q161941 | BytesWritable.setCapacity | train | public void setCapacity(int new_cap) {
if (new_cap != getCapacity()) {
byte[] new_data = new byte[new_cap];
if (new_cap < size) {
size = new_cap;
}
if (size != 0) {
System.arraycopy(bytes, 0, new_data, 0, size);
}
bytes = new_data;
}
} | java | {
"resource": ""
} |
q161942 | BytesWritable.set | train | public void set(byte[] newData, int offset, int length) {
setSize(0);
setSize(length);
System.arraycopy(newData, offset, bytes, 0, size);
} | java | {
"resource": ""
} |
q161943 | DataTransferHeaderOptions.setBits | train | protected static long setBits(long num, int start, int len, long value){
// Get rid of illegal bits of value:
value = value & ((1L<<len)-1);
long val_mask = value << start;
long zero_mask = ~( ((1L << len) -1) << start );
return ( num & zero_mask ) | val_mask;
} | java | {
"resource": ""
} |
q161944 | LoadGenerator.initFileDirTables | train | private int initFileDirTables() {
try {
initFileDirTables(root);
} catch (IOException e) {
System.err.println(e.getLocalizedMessage());
e.printStackTrace();
return -1;
}
if (dirs.isEmpty()) {
System.err.println("The test space " + root + " is empty");
return -1;
}... | java | {
"resource": ""
} |
q161945 | LoadGenerator.initFileDirTables | train | private void initFileDirTables(Path path) throws IOException {
FileStatus[] stats = fs.listStatus(path);
if (stats != null) {
for (FileStatus stat : stats) {
if (stat.isDir()) {
dirs.add(stat.getPath().toString());
initFileDirTables(stat.getPath());
} else {
P... | java | {
"resource": ""
} |
q161946 | JobTrackerTraits.getTaskDiagnosticsImpl | train | protected String[] getTaskDiagnosticsImpl(TaskAttemptID taskId)
throws IOException {
List<String> taskDiagnosticInfo = null;
JobID jobId = taskId.getJobID();
TaskID tipId = taskId.getTaskID();
JobInProgressTraits job = getJobInProgress(jobId);
if (job != null && job.inited()) {
TaskInPro... | java | {
"resource": ""
} |
q161947 | JobTrackerTraits.getTip | train | public TaskInProgress getTip(TaskID tipid) {
JobInProgressTraits job = getJobInProgress(tipid.getJobID());
return (job == null ? null : job.getTaskInProgress(tipid));
} | java | {
"resource": ""
} |
q161948 | LightWeightLinkedSet.pollFirst | train | public T pollFirst() {
if (head == null) {
return null;
}
T first = head.element;
this.remove(first);
return first;
} | java | {
"resource": ""
} |
q161949 | LightWeightLinkedSet.pollNToList | train | public void pollNToList(int n, List<T> retList) {
if (n >= size) {
// if we need to remove all elements then do fast polling
pollAllToList(retList);
}
while (n-- > 0 && head != null) {
T curr = head.element;
this.removeElem(curr);
retList.add(curr);
}
shrinkIfNecessary(... | java | {
"resource": ""
} |
q161950 | FileOutputFormat.getTaskOutputPath | train | public static Path getTaskOutputPath(JobConf conf, String name)
throws IOException {
// ${mapred.out.dir}
Path outputPath = getOutputPath(conf);
if (outputPath == null) {
throw new IOException("Undefined job output-path");
}
OutputCommitter committer = conf.getOutputCommitter();
Path w... | java | {
"resource": ""
} |
q161951 | FileOutputFormat.getUniqueName | train | public static String getUniqueName(JobConf conf, String name) {
int partition = conf.getInt("mapred.task.partition", -1);
if (partition == -1) {
throw new IllegalArgumentException(
"This method can only be called from within a Job");
}
String taskType = (conf.getBoolean("mapred.task.is.ma... | java | {
"resource": ""
} |
q161952 | DFSInputStream.openInfo | train | synchronized void openInfo() throws IOException {
if (src == null && blocks == null) {
throw new IOException("No file provided to open");
}
LocatedBlocks newInfo = src != null ?
getLocatedBlocks(src, 0, prefetchSize) : blocks;
if (newInfo ... | java | {
"resource": ""
} |
q161953 | DFSInputStream.getBlockInfo | train | private Block getBlockInfo(LocatedBlock locatedblock) throws IOException {
if (locatedblock == null || locatedblock.getLocations().length == 0) {
return null;
}
int replicaNotFoundCount = locatedblock.getLocations().length;
for(DatanodeInfo datanode : locatedblock.getLocations()) {
Protocol... | java | {
"resource": ""
} |
q161954 | DFSInputStream.getBlockAt | train | private LocatedBlock getBlockAt(long offset, boolean updatePosition,
boolean throwWhenNotFound)
throws IOException {
assert (locatedBlocks != null) : "locatedBlocks is null";
// search cached blocks first
locatedBlocks.blockLocationInfoExpiresIfNeeded();
LocatedBlock blk = locatedBlocks.getB... | java | {
"resource": ""
} |
q161955 | DFSInputStream.getBlockRange | train | private List<LocatedBlock> getBlockRange(final long offset,
final long length) throws IOException {
List<LocatedBlock> blockRange = new ArrayList<LocatedBlock>();
// Zero length. Not sure this ever happens in practice.
if (length == 0)
return blockRange;
// A defensive measure to ensure tha... | java | {
"resource": ""
} |
q161956 | DFSInputStream.close | train | @Override
public synchronized void close() throws IOException {
try {
if (closed) {
return;
}
dfsClient.checkOpen();
if (blockReader != null) {
closeBlockReader(blockReader, false);
blockReader = null;
}
for (BlockReaderLocalBase brl : localBlockReader... | java | {
"resource": ""
} |
q161957 | DFSInputStream.read | train | @Override
public synchronized int read(byte buf[], int off, int len) throws IOException {
dfsClient.checkOpen();
if (closed) {
dfsClient.incReadExpCntToStats();
throw new IOException("Stream closed");
}
DFSClient.dfsInputStreamfailures.set(0);
long start = System.currentTimeMillis();
... | java | {
"resource": ""
} |
q161958 | DFSInputStream.closeBlockReader | train | private void closeBlockReader(BlockReader reader, boolean reuseConnection)
throws IOException {
if (reader.hasSentStatusCode()) {
Socket oldSock = reader.takeSocket();
if (dfsClient.getDataTransferProtocolVersion() <
DataTransferProtocol.READ_REUSE_CONNECTION_VERSION ||
!reus... | java | {
"resource": ""
} |
q161959 | DFSInputStream.getBlockReader | train | protected BlockReader getBlockReader(int protocolVersion,
int namespaceId,
InetSocketAddress dnAddr,
String file,
long blockId,
... | java | {
"resource": ""
} |
q161960 | DFSInputStream.read | train | public int read(long position, byte[] buffer, int offset, int length,
ReadOptions options)
throws IOException {
// sanity checks
dfsClient.checkOpen();
if (closed) {
throw new IOException("Stream closed");
}
DFSClient.dfsInputStreamfailures.set(0);
long start = System.curren... | java | {
"resource": ""
} |
q161961 | DFSInputStream.readFullyScatterGather | train | @Override
public List<ByteBuffer> readFullyScatterGather(long position, int length)
throws IOException {
// if the server does not support scatter-gather,
// then use default implementation from FSDataInputStream.
if (dfsClient.dataTransferVersion < DataTransferProtocol.SCATTERGATHER_VERSION) ... | java | {
"resource": ""
} |
q161962 | DFSInputStream.seek | train | @Override
public synchronized void seek(long targetPos) throws IOException {
if (targetPos > getFileLength()) {
throw new IOException("Cannot seek after EOF");
}
boolean done = false;
if (pos <= targetPos && targetPos <= blockEnd) {
//
// If this seek is to a positive position in the... | java | {
"resource": ""
} |
q161963 | DFSInputStream.seekToNewSource | train | public synchronized boolean seekToNewSource(long targetPos,
boolean throwWhenNotFound) throws IOException {
boolean markedDead = deadNodes.containsKey(currentNode);
addToDeadNodes(currentNode);
DatanodeInfo oldNode = currentNode;
DatanodeInfo newNode = blockSeekTo(targetPos, throwWhenNotFound);
... | java | {
"resource": ""
} |
q161964 | TaskTrackerStatus.isTaskRunning | train | private boolean isTaskRunning(TaskStatus taskStatus) {
TaskStatus.State state = taskStatus.getRunState();
return (state == State.RUNNING || state == State.UNASSIGNED ||
taskStatus.inTaskCleanupPhase());
} | java | {
"resource": ""
} |
q161965 | TaskTrackerStatus.countMapTasks | train | public int countMapTasks() {
int mapCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if (ts.getIsMap() && isTaskRunning(ts)) {
mapCount++;
}
}
return mapCount;
} | java | {
"resource": ""
} |
q161966 | TaskTrackerStatus.countOccupiedMapSlots | train | public int countOccupiedMapSlots() {
int mapSlotsCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if (ts.getIsMap() && isTaskRunning(ts)) {
mapSlotsCount += ts.getNumSlots();
}
}
return mapSlotsCount;
} | java | {
"resource": ""
} |
q161967 | TaskTrackerStatus.countReduceTasks | train | public int countReduceTasks() {
int reduceCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if ((!ts.getIsMap()) && isTaskRunning(ts)) {
reduceCount++;
}
}
return reduceCount;
} | java | {
"resource": ""
} |
q161968 | TaskTrackerStatus.countOccupiedReduceSlots | train | public int countOccupiedReduceSlots() {
int reduceSlotsCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if ((!ts.getIsMap()) && isTaskRunning(ts)) {
reduceSlotsCount += ts.getNumSlots();
}
}
return reduce... | java | {
"resource": ""
} |
q161969 | BinaryRecordInput.get | train | public static BinaryRecordInput get(DataInput inp) {
BinaryRecordInput bin = (BinaryRecordInput) bIn.get();
bin.setDataInput(inp);
return bin;
} | java | {
"resource": ""
} |
q161970 | NameNodeSafeModeInfo.canLeave | train | @Override
public boolean canLeave() {
if (reached == 0) {
return false;
}
if (namesystem.now() - reached < extension) {
reportStatus("STATE* Safe mode ON.", false);
return false;
}
return !needEnter();
} | java | {
"resource": ""
} |
q161971 | NameNodeSafeModeInfo.reportStatus | train | private void reportStatus(String msg, boolean rightNow) {
long curTime = FSNamesystem.now();
if (!rightNow && (curTime - lastStatusReport < 20 * 1000)) {
return;
}
FLOG.info(msg + " \n" + getTurnOffTip());
lastStatusReport = curTime;
} | java | {
"resource": ""
} |
q161972 | NameNodeSafeModeInfo.isConsistent | train | private boolean isConsistent() {
if (this.reached < 0) {
return true; // Safemode is off.
}
if (namesystem.getTotalBlocks() == -1 && namesystem.getSafeBlocks() == -1) {
return true; // manual safe mode
}
long activeBlocks = namesystem.getBlocksTotal()
- namesystem.getPendingDeletio... | java | {
"resource": ""
} |
q161973 | ReduceContext.nextKey | train | public boolean nextKey() throws IOException,InterruptedException {
while (hasMore && nextKeyIsSame) {
nextKeyValue();
}
if (hasMore) {
if (inputKeyCounter != null) {
inputKeyCounter.increment(1);
}
return nextKeyValue();
} else {
return false;
}
} | java | {
"resource": ""
} |
q161974 | FSImageCompression.createCompression | train | static FSImageCompression createCompression(Configuration conf, boolean forceUncompressed)
throws IOException {
boolean compressImage = (!forceUncompressed) && conf.getBoolean(
HdfsConstants.DFS_IMAGE_COMPRESS_KEY,
HdfsConstants.DFS_IMAGE_COMPRESS_DEFAULT);
if (!compressImage) {
return cr... | java | {
"resource": ""
} |
q161975 | FSImageCompression.readCompressionHeader | train | public static FSImageCompression readCompressionHeader(
Configuration conf,
DataInputStream dis) throws IOException
{
boolean isCompressed = dis.readBoolean();
if (!isCompressed) {
return createNoopCompression();
} else {
String codecClassName = Text.readString(dis);
return crea... | java | {
"resource": ""
} |
q161976 | FSImageCompression.unwrapInputStream | train | public InputStream unwrapInputStream(InputStream is) throws IOException {
if (imageCodec != null) {
return imageCodec.createInputStream(is);
} else {
return is;
}
} | java | {
"resource": ""
} |
q161977 | FSImageCompression.writeHeaderAndWrapStream | train | DataOutputStream writeHeaderAndWrapStream(OutputStream os)
throws IOException {
DataOutputStream dos = new DataOutputStream(os);
dos.writeBoolean(imageCodec != null);
if (imageCodec != null) {
String codecClassName = imageCodec.getClass().getCanonicalName();
Text.writeString(dos, codecClassN... | java | {
"resource": ""
} |
q161978 | TaskID.downgrade | train | public static TaskID downgrade(org.apache.hadoop.mapreduce.TaskID old) {
if (old instanceof TaskID) {
return (TaskID) old;
} else {
return new TaskID(JobID.downgrade(old.getJobID()), old.isMap(),
old.getId());
}
} | java | {
"resource": ""
} |
q161979 | Standby.quiesceIngestWithReprocess | train | private void quiesceIngestWithReprocess() throws IOException {
if (ingest != null) {
LOG.info("Standby: Quiescing - quiescing ongoing ingest");
quiesceIngest();
reprocessCurrentSegmentIfNeeded(ingest.getIngestStatus());
}
} | java | {
"resource": ""
} |
q161980 | Standby.quiesceIngest | train | private void quiesceIngest() throws IOException {
InjectionHandler.processEvent(InjectionEvent.STANDBY_QUIESCE_INGEST);
synchronized (ingestStateLock) {
assertState(StandbyIngestState.INGESTING_EDITS,
StandbyIngestState.NOT_INGESTING);
ingest.quiesce();
}
try {
ingestThread.j... | java | {
"resource": ""
} |
q161981 | Standby.instantiateIngest | train | private void instantiateIngest() throws IOException {
InjectionHandler.processEvent(InjectionEvent.STANDBY_INSTANTIATE_INGEST);
try {
synchronized (ingestStateLock) {
if (checkIngestState()) {
LOG.info("Standby: Ingest for txid: " + currentSegmentTxId
+ " is already running... | java | {
"resource": ""
} |
q161982 | Standby.reprocessCurrentSegmentIfNeeded | train | private void reprocessCurrentSegmentIfNeeded(boolean status)
throws IOException {
if (status) {
return;
}
assertState(StandbyIngestState.NOT_INGESTING);
LOG.info("Standby: Quiesce - reprocessing edits segment starting at: "
+ currentSegmentTxId);
instantiateIngest();
quiesceI... | java | {
"resource": ""
} |
q161983 | Standby.triggerCheckpoint | train | void triggerCheckpoint(boolean uncompressed) throws IOException {
String pref = "Standby: Checkpoint - ";
LOG.info(pref + "triggering checkpoint manually");
// check error conditions
if (uncompressed) {
throwIOException(pref + " uncompressed option not supported", null);
}
if (manualCheck... | java | {
"resource": ""
} |
q161984 | Standby.handleCheckpointFailure | train | private void handleCheckpointFailure() {
setCheckpointFailures(checkpointFailures + 1);
if (checkpointFailures > MAX_CHECKPOINT_FAILURES) {
LOG.fatal("Standby: Checkpointing - standby failed to checkpoint in "
+ checkpointFailures + " attempts. Aborting");
} else {
// We want to give s... | java | {
"resource": ""
} |
q161985 | Standby.uploadImage | train | private void uploadImage(long txid) throws IOException {
final long start = AvatarNode.now();
LOG.info("Standby: Checkpointing - Upload fsimage to remote namenode.");
checkpointStatus("Image upload started");
imageUploader = new ImageUploader(txid);
imageUploader.start();
// wait for t... | java | {
"resource": ""
} |
q161986 | Standby.putFSImage | train | private void putFSImage(long txid) throws IOException {
TransferFsImage.uploadImageFromStorage(fsName, machineName, infoPort,
fsImage.storage, txid);
} | java | {
"resource": ""
} |
q161987 | Standby.checkImageValidation | train | private void checkImageValidation() throws IOException {
try {
imageValidator.join();
} catch (InterruptedException ie) {
throw (IOException) new InterruptedIOException().initCause(ie);
}
if (!imageValidator.succeeded) {
throw new IOException("Image file validation failed",
... | java | {
"resource": ""
} |
q161988 | Standby.createImageValidation | train | private void createImageValidation(File imageFile) throws IOException {
synchronized (imageValidatorLock) {
InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE);
if (!running) {
// fails the checkpoint
InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE_... | java | {
"resource": ""
} |
q161989 | Standby.interruptImageValidation | train | private void interruptImageValidation() throws IOException {
synchronized (imageValidatorLock) {
if (imageValidator != null) {
imageValidator.interrupt();
try {
imageValidator.join();
} catch (InterruptedException e) {
throw new InterruptedIOException("Standby: rece... | java | {
"resource": ""
} |
q161990 | Standby.initSecondary | train | void initSecondary(Configuration conf) throws IOException {
fsName = AvatarNode.getRemoteNamenodeHttpName(conf,
avatarNode.getInstanceId());
// Initialize other scheduling parameters from the configuration
checkpointEnabled = conf.getBoolean("fs.checkpoint.enabled", false);
checkpointPeriod = ... | java | {
"resource": ""
} |
q161991 | Standby.assertState | train | private void assertState(StandbyIngestState... expectedStates)
throws IOException {
for (StandbyIngestState s : expectedStates) {
if (currentIngestState == s)
return;
}
throw new IOException("Standby: illegal state - current: "
+ currentIngestState);
} | java | {
"resource": ""
} |
q161992 | FSInputStream.readFullyScatterGather | train | public List<ByteBuffer> readFullyScatterGather(long position, int length)
throws IOException {
byte[] buf = new byte[length];
readFully(position, buf, 0, length);
LinkedList<ByteBuffer> results = new LinkedList<ByteBuffer>();
results.add(ByteBuffer.wrap(buf, 0, length));
return results;
} | java | {
"resource": ""
} |
q161993 | EditLogOutputStream.flush | train | public void flush(boolean durable) throws IOException {
numSync++;
long start = System.nanoTime();
flushAndSync(durable);
long time = DFSUtil.getElapsedTimeMicroSeconds(start);
totalTimeSync += time;
if (sync != null) {
sync.inc(time);
}
} | java | {
"resource": ""
} |
q161994 | RawLocalFileSystem.setOwner | train | @Override
public void setOwner(Path p, String username, String groupname
) throws IOException {
if (username == null && groupname == null) {
throw new IOException("username == null && groupname == null");
}
if (username == null) {
execCommand(pathToFile(p), Shell.SET_GROUP_COMMAND, grou... | java | {
"resource": ""
} |
q161995 | RawLocalFileSystem.setPermission | train | @Override
public void setPermission(Path p, FsPermission permission
) throws IOException {
FsAction user = permission.getUserAction();
FsAction group = permission.getGroupAction();
FsAction other = permission.getOtherAction();
File f = pathToFile(p);
// Fork chmod if group and othe... | java | {
"resource": ""
} |
q161996 | OfflineAnonymizer.anonymize | train | public void anonymize() throws Exception {
EventRecord er = null;
SerializedRecord sr = null;
BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName()
+ ".anonymized"));
System.out.println("Anonymizing log records...");
while ((er = parser.getNext()) != null) {
if (er... | java | {
"resource": ""
} |
q161997 | OneSidedPentomino.initializePieces | train | protected void initializePieces() {
pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation));
pieces.add(new Piece("v", "x /x /xxx", false, fourRotations));
pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations));
pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations));
pieces... | java | {
"resource": ""
} |
q161998 | OneSidedPentomino.main | train | public static void main(String[] args) {
Pentomino model = new OneSidedPentomino(3, 30);
int solutions = model.solve();
System.out.println(solutions + " solutions found.");
} | java | {
"resource": ""
} |
q161999 | CoronaStateUpdate.get | train | private <T> T get(Class<T> clazz) {
try {
return clazz.cast(get());
} catch (ClassCastException e) {
return null;
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.