Skip to content

Commit ec55b63

Browse files
committed
Set destination permissions for genomicsdb
1 parent a745453 commit ec55b63

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/util/AbstractGenomicsDBImportHandler.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ Set<String> getContigsInInputs(List<File> inputVCFs, Logger log) throws Pipeline
301301
return _contigsInInputs;
302302
}
303303

304-
private void copyToLevelFiles(PipelineJob job, File sourceWorkspace, File destinationWorkspace, boolean removeOtherFiles, boolean overwriteExisting) throws IOException
304+
private void copyTopLevelFiles(PipelineJob job, File sourceWorkspace, File destinationWorkspace, boolean removeOtherFiles, boolean overwriteExisting) throws IOException, PipelineJobException
305305
{
306306
job.getLogger().info("Copying top-level files from: " + sourceWorkspace.getPath());
307307
if (removeOtherFiles)
@@ -333,6 +333,26 @@ private void copyToLevelFiles(PipelineJob job, File sourceWorkspace, File destin
333333

334334
FileUtils.copyFile(source, dest);
335335
}
336+
337+
File metaDir = new File(sourceWorkspace, "genomicsdb_meta_dir");
338+
File metaDirDest = new File(sourceWorkspace, "genomicsdb_meta_dir");
339+
if (metaDirDest.exists())
340+
{
341+
if (!overwriteExisting)
342+
{
343+
job.getLogger().debug("workspace file exists, will not overwrite: " + metaDirDest.getPath());
344+
}
345+
346+
FileUtils.deleteDirectory(metaDirDest);
347+
}
348+
349+
if (!metaDirDest.exists())
350+
{
351+
job.getLogger().debug("Copying directory with rsync: " + metaDir.getPath());
352+
new SimpleScriptWrapper(job.getLogger()).execute(Arrays.asList(
353+
"rsync", "-r", "-a", "--delete", "--no-owner", "--no-group", "--no-perms", "--chmod=D2770,F660", metaDir.getPath(), metaDirDest.getParentFile().getPath()
354+
));
355+
}
336356
}
337357

338358
protected File getMarkerFile(File workspace)
@@ -684,7 +704,7 @@ private void copyWorkspace(JobContext ctx, File sourceWorkspace, File destinatio
684704

685705
if (!haveCopiedTopLevelFiles)
686706
{
687-
copyToLevelFiles(ctx.getJob(), sourceWorkspace, destinationWorkspaceFolder, removeExistingTopLevelFiles, overwriteTopLevelFiles);
707+
copyTopLevelFiles(ctx.getJob(), sourceWorkspace, destinationWorkspaceFolder, removeExistingTopLevelFiles, overwriteTopLevelFiles);
688708
haveCopiedTopLevelFiles = true;
689709
}
690710

@@ -707,7 +727,6 @@ private void copyWorkspace(JobContext ctx, File sourceWorkspace, File destinatio
707727
}
708728
else
709729
{
710-
//TODO: dest permissions?
711730
ctx.getLogger().debug("Copying directory with rsync: " + sourceFolder.getPath());
712731
//NOTE: since neither path will end in slashes, rsync to the parent folder should result in the correct placement
713732
new SimpleScriptWrapper(ctx.getLogger()).execute(Arrays.asList(

0 commit comments

Comments
 (0)