Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -43,6 +43,8 @@ public interface GobblinTemporalConfigurationKeys {

String GOBBLIN_TEMPORAL_JOB_LAUNCHER_ARG_PREFIX = GOBBLIN_TEMPORAL_JOB_LAUNCHER_PREFIX + "arg.";
String GOBBLIN_TEMPORAL_JOB_LAUNCHER_CONFIG_OVERRIDES = GOBBLIN_TEMPORAL_JOB_LAUNCHER_PREFIX + "config.overrides";
String GOBBLIN_TEMPORAL_CLEAN_UP_WORK_DIR = PREFIX + "clean.up.work.dir";
String DEFAULT_GOBBLIN_TEMPORAL_CLEAN_UP_WORK_DIR = "true";

/**
* Suffix for metrics emitted by GobblinTemporalJobLauncher for preventing collisions with prod jobs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
import org.apache.gobblin.source.workunit.WorkUnit;
import org.apache.gobblin.util.ConfigUtils;
import org.apache.gobblin.util.ParallelRunner;
import org.apache.gobblin.temporal.ddm.util.JobStateUtils;
import org.apache.gobblin.temporal.GobblinTemporalConfigurationKeys;

/**
* An implementation of {@link JobLauncher} that launches a Gobblin job using the Temporal task framework.
Expand Down Expand Up @@ -134,7 +136,11 @@ public void close() throws IOException {
try {
executeCancellation();
} finally {
super.close();
try {
cleanupWorkingDirectory();
} finally {
super.close();
}
}
}

Expand Down Expand Up @@ -277,6 +283,13 @@ protected void cleanupWorkingDirectory() throws IOException {
GobblinClusterUtils.getJobStateFilePath(false, this.appWorkDir, this.jobContext.getJobId());
this.fs.delete(jobStateFilePath, false);
}

if (Boolean.parseBoolean(this.jobProps.getProperty(GobblinTemporalConfigurationKeys.GOBBLIN_TEMPORAL_CLEAN_UP_WORK_DIR,
GobblinTemporalConfigurationKeys.DEFAULT_GOBBLIN_TEMPORAL_CLEAN_UP_WORK_DIR))) {
Path workDirRootPath = JobStateUtils.getWorkDirRoot(this.jobContext.getJobState());
log.info("Cleaning up work directory : {} for job : {}", workDirRootPath, this.jobContext.getJobId());
this.fs.delete(workDirRootPath, true);
}
}
}