Prefetch inputs before acquiring a worker
This reduces the how long we hold exclusive access to a worker
and will make it easier to measure the queuing time (acquiring
both a worker and the necessary resources).
RELNOTES: None.
@@ -342,6 +342,13 @@ final class WorkerSpawnRunner implements SpawnRunner {
throw createUserExecException(e, message, Code.VIRTUAL_INPUT_MATERIALIZATION_FAILURE);
}
+ try {
+ context.prefetchInputs();
+ } catch (IOException e) {
+ String message = "IOException while prefetching for worker:";
+ throw createUserExecException(e, message, Code.PREFETCH_FAILURE);
+ }
+
try {
worker = workers.borrowObject(key);
request =
@@ -351,13 +358,6 @@ final class WorkerSpawnRunner implements SpawnRunner {
throw createUserExecException(e, message, Code.BORROW_FAILURE);
}
- try {
- context.prefetchInputs();
- } catch (IOException e) {
- String message = "IOException while prefetching for worker:";
- throw createUserExecException(e, message, Code.PREFETCH_FAILURE);
- }
-
try (ResourceHandle handle =
resourceManager.acquireResources(owner, spawn.getLocalResources())) {
context.report(ProgressStatus.EXECUTING, WorkerKey.makeWorkerTypeName(key.getProxied()));
