Skip to content

Commit

Permalink
[PEx] Improve cleanup of disk tasks on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-goel committed Jul 25, 2024
1 parent b6b5828 commit 261d289
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ public static void main(String[] args) {
}
} finally {
// log end-of-run metrics
StatWriter.log("result", PExplicitGlobal.getResult());
StatWriter.log("status", String.format("%s", PExplicitGlobal.getStatus()));
StatWriter.log("exit-code", String.format("%d", exit_code));

// exit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ private static void printStats() {
PExplicitGlobal.setStatus(STATUS.VERIFIED_UPTO_MAX_STEPS);
}
}

StatWriter.log("result", PExplicitGlobal.getResult());
StatWriter.log("status", String.format("%s", PExplicitGlobal.getStatus()));
}

private static void preprocess() {
Expand Down Expand Up @@ -136,9 +139,9 @@ private static void process(boolean resume) throws Exception {
future.cancel(true);
executor.shutdownNow();
scheduler.updateResult();
SearchTask.Cleanup();
printStats();
PExplicitLogger.logEndOfRun(scheduler, Duration.between(TimeMonitor.getStart(), Instant.now()).getSeconds());
SearchTask.Cleanup();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import pexplicit.runtime.machine.PMonitor;
import pexplicit.runtime.machine.State;
import pexplicit.runtime.machine.events.PContinuation;
import pexplicit.runtime.scheduler.Schedule;
import pexplicit.runtime.scheduler.choice.ScheduleSearchUnit;
import pexplicit.runtime.scheduler.choice.SearchUnit;
import pexplicit.runtime.scheduler.explicit.ExplicitSearchScheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public int getNumPendingDataChoices() {
return numUnexplored;
}

public abstract void addNewTask(SearchTask task);

abstract SearchTask popNextTask();

public abstract void addNewTask(SearchTask task);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package pexplicit.runtime.scheduler.explicit.strategy;

import lombok.Getter;
import org.apache.commons.io.FileUtils;
import pexplicit.runtime.PExplicitGlobal;
import pexplicit.runtime.logger.PExplicitLogger;
import pexplicit.runtime.machine.PMachineId;
Expand Down Expand Up @@ -54,11 +53,13 @@ public static void Initialize() {

public static void Cleanup() {
String taskPath = PExplicitGlobal.getConfig().getOutputFolder() + "/tasks/";
try {
FileUtils.deleteDirectory(new File(taskPath));
} catch (IOException e) {
throw new RuntimeException("Failed to cleanup tasks at " + taskPath, e);
File taskDir = new File(taskPath);
String[] entries = taskDir.list();
for (String s : entries) {
File currentFile = new File(taskDir.getPath(), s);
currentFile.delete();
}
taskDir.delete();
}

public boolean isInitialTask() {
Expand Down

0 comments on commit 261d289

Please sign in to comment.