Skip to content

Commit

Permalink
Fix issue azkaban#1559: Error writing out logs for job on a retry att…
Browse files Browse the repository at this point in the history
…empt
  • Loading branch information
juhoautio committed Nov 14, 2017
1 parent 089a755 commit ae43931
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Expand Up @@ -63,7 +63,7 @@ public class ExecutableNode {
private Set<String> outNodes = new HashSet<>();
private Props inputProps;
private Props outputProps;
private int attempt = 0;
private volatile int attempt = 0;
private long delayExecution = 0;
private ArrayList<ExecutionAttempt> pastAttempts = null;

Expand Down Expand Up @@ -235,7 +235,9 @@ public void setAttempt(final int attempt) {

public void resetForRetry() {
final ExecutionAttempt pastAttempt = new ExecutionAttempt(this.attempt, this);
this.attempt++;
synchronized (this) {
this.attempt++;
}

synchronized (this) {
if (this.pastAttempts == null) {
Expand Down
14 changes: 9 additions & 5 deletions azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java
Expand Up @@ -609,11 +609,15 @@ private void doRun() {
"Finishing job " + this.jobId + getNodeRetryLog() + " at " + this.node.getEndTime()
+ " with status " + this.node.getStatus());

fireEvent(Event.create(this, EventType.JOB_FINISHED,
new EventData(finalStatus, this.node.getNestedId())), false);
finalizeLogFile(this.node.getAttempt());
finalizeAttachmentFile();
writeStatus();
try {
finalizeLogFile(this.node.getAttempt());
finalizeAttachmentFile();
writeStatus();
} finally {
// note that FlowRunner thread does node.attempt++ when it receives the JOB_FINISHED event
fireEvent(Event.create(this, EventType.JOB_FINISHED,
new EventData(finalStatus, this.node.getNestedId())), false);
}
}

private String getNodeRetryLog() {
Expand Down

0 comments on commit ae43931

Please sign in to comment.