From 37763b8d6ba9fb685c27a65126e9ff8b9cc11206 Mon Sep 17 00:00:00 2001 From: Cedric Zhuang Date: Mon, 21 Aug 2023 16:36:28 +0800 Subject: [PATCH] Refresh the workDir if not empty. For some shared file system, we need to refresh the work directory before we access the files in this folder. The refresh operation makes sure the content of the folder is updated. --- .../com/memverge/nextflow/FloatGridExecutor.groovy | 6 +++++- .../src/main/com/memverge/nextflow/FloatJobs.groovy | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/nf-float/src/main/com/memverge/nextflow/FloatGridExecutor.groovy b/plugins/nf-float/src/main/com/memverge/nextflow/FloatGridExecutor.groovy index c6e58c9..e2ed4c0 100644 --- a/plugins/nf-float/src/main/com/memverge/nextflow/FloatGridExecutor.groovy +++ b/plugins/nf-float/src/main/com/memverge/nextflow/FloatGridExecutor.groovy @@ -509,7 +509,11 @@ class FloatGridExecutor extends AbstractGridExecutor { log.debug "[float] task id: $taskId, nf-job-id: $job.nfJobID, " + "float-job-id: $job.floatJobID, " + "float status: $job.status, nf status: $st" - return st == QueueStatus.DONE || st == QueueStatus.ERROR + boolean finished = st == QueueStatus.DONE || st == QueueStatus.ERROR + if (finished) { + floatJobs.refreshWorkDir(job.nfJobID) + } + return finished } static private Map STATUS_MAP = [ diff --git a/plugins/nf-float/src/main/com/memverge/nextflow/FloatJobs.groovy b/plugins/nf-float/src/main/com/memverge/nextflow/FloatJobs.groovy index 59e6fab..6597e48 100644 --- a/plugins/nf-float/src/main/com/memverge/nextflow/FloatJobs.groovy +++ b/plugins/nf-float/src/main/com/memverge/nextflow/FloatJobs.groovy @@ -84,6 +84,14 @@ class FloatJobs { return job.status } + def refreshWorkDir(String nfJobID) { + def workDir = nfJobID2workDir.get(nfJobID) + if (workDir) { + // call list files to update the folder cache + FileHelper.listDirectory(workDir) + } + } + @WithWriteLock def updateOcStatus(String oc, String text) { def stMap = FloatJob.parseJobMap(text) @@ -96,8 +104,7 @@ class FloatJobs { def workDir = nfJobID2workDir.get(job.nfJobID) if (workDir) { // check the availability of result files - // call list files to update the folder cache - FileHelper.listDirectory(workDir) + refreshWorkDir(job.nfJobID) def files = ['.command.out', '.command.err', '.exitcode'] if (currentSt != Completed && job.status == Completed) { for (filename in files) {