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

Add log #2302

Closed

Add log #2302

Show file tree
Hide file tree
Changes from all 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 @@ -274,7 +274,6 @@ public Throwable wrapFailure(NexusTask task, Throwable failure) {
private void handleNexusTask(NexusTask task, Scope metricsScope) {
PollNexusTaskQueueResponseOrBuilder pollResponse = task.getResponse();
ByteString taskToken = pollResponse.getTaskToken();

NexusTaskHandler.Result result;

Stopwatch sw = metricsScope.timer(MetricsType.NEXUS_EXEC_LATENCY).start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import java.util.concurrent.TimeUnit;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CleanNexusWorkerShutdownTest {

Expand Down Expand Up @@ -133,6 +135,7 @@ public String execute(String now) {

@ServiceImpl(service = TestNexusServices.TestNexusService1.class)
public static class TestNexusServiceImpl {
private final Logger logger = LoggerFactory.getLogger(TestNexusServiceImpl.class);
private final CountDownLatch shutdownLatch;
private final CountDownLatch shutdownNowLatch;

Expand All @@ -145,9 +148,12 @@ public TestNexusServiceImpl(CountDownLatch shutdownLatch, CountDownLatch shutdow
public OperationHandler<String, String> operation() {
return OperationHandler.sync(
(ctx, details, now) -> {
logger.info("Operation started");
if (now == null) {
logger.info("Waiting for shutdown");
shutdownLatch.countDown();
} else {
logger.info("Waiting for shutdownNow");
shutdownNowLatch.countDown();
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
import io.temporal.api.history.v1.History;
import io.temporal.api.nexus.v1.Endpoint;
import io.temporal.api.workflowservice.v1.WorkflowServiceGrpc;
import io.temporal.client.WorkflowClient;
import io.temporal.client.WorkflowClientOptions;
import io.temporal.client.WorkflowOptions;
import io.temporal.client.WorkflowStub;
import io.temporal.client.*;
import io.temporal.common.Experimental;
import io.temporal.common.SearchAttributeKey;
import io.temporal.common.interceptors.WorkerInterceptor;
Expand Down Expand Up @@ -113,7 +110,27 @@ public class TestWorkflowRule implements TestRule {
new TestWatcher() {
@Override
protected void failed(Throwable e, Description description) {
System.err.println("WORKFLOW EXECUTION HISTORIES:\n" + testEnvironment.getDiagnostics());
if (useExternalService) {
StringBuilder result = new StringBuilder();
WorkflowClient client = getWorkflowClient();
result.append("WORKFLOW EXECUTION HISTORIES:\n");
client
.listExecutions("TaskQueue='" + taskQueue + "'")
.forEach(
(we) -> {
WorkflowExecution exec = we.getWorkflowExecutionInfo().getExecution();
result.append(exec);
result.append("\n\n");
result.append(
client
.fetchHistory(exec.getWorkflowId(), exec.getRunId())
.toProtoText(true));
result.append("\n");
});
} else {
System.err.println(
"WORKFLOW EXECUTION HISTORIES:\n" + testEnvironment.getDiagnostics());
}
}
};

Expand Down
Loading