Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEZ-4451: ThreadLevel IO Stats Support for TEZ. #331

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.security.PrivilegedExceptionAction;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.statistics.IOStatisticsLogging;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.tez.common.CallableWithNdc;
import org.apache.tez.common.TezCommonUtils;
Expand All @@ -28,6 +30,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.apache.hadoop.fs.statistics.IOStatisticsContext.getCurrentIOStatisticsContext;
Copy link
Contributor

@abstractdog abstractdog Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we import some classes from org.apache.hadoop.fs.statistics, couldn't we import them in the same way? is there a specific reason for static importing this method?
I guess these would look better together, like:

import org.apache.hadoop.fs.statistics.IOStatisticsLogging;
import org.apache.hadoop.fs.statistics.IOStatisticsContext;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it, somehow my IDE did that automatically...


/**
* This class is responsible for running a {@link LogicalIOProcessorRuntimeTask}.
* It does not worry about reporting errors, heartbeats etc.
Expand Down Expand Up @@ -75,6 +79,7 @@ public TaskRunner2CallableResult run() throws Exception {
LOG.info("Initializing task" + ", taskAttemptId={}", task.getTaskAttemptID());
TezUtilsInternal.setHadoopCallerContext(task.getHadoopShim(), task.getTaskAttemptID());
TezCommonUtils.logCredentials(LOG, ugi.getCredentials(), "taskInit");
getCurrentIOStatisticsContext().reset();
task.initialize();

if (!stopRequested.get() && !Thread.currentThread().isInterrupted()) {
Expand Down Expand Up @@ -116,6 +121,11 @@ public TaskRunner2CallableResult run() throws Exception {
// For a successful task, however, this should be almost no delay since close has already happened.
maybeFixInterruptStatus();
LOG.info("Cleaning up task {}, stopRequested={}", task.getTaskAttemptID(), stopRequested.get());
String ioStats =
IOStatisticsLogging.ioStatisticsToPrettyString(getCurrentIOStatisticsContext().getIOStatistics());
if (StringUtils.isNotEmpty(ioStats)) {
LOG.info("TaskAttemptId={}, {}", task.getTaskAttemptID(), ioStats);
}
task.getOutputContexts().forEach(outputContext
-> outputContext.trapEvents(new TezTrapEventHandler(outputContext,
this.tezUmbilical)));
Expand Down
Loading