Skip to content

Commit

Permalink
remove temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
takashi310 committed Jul 6, 2021
1 parent f71ed17 commit 242e49c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public class SliceTiffToVVDSpark {
public static final String PIXEL_RESOLUTION_ATTRIBUTE_KEY = "pixelResolution";

public static final String TEMP_N5_DIR = "temp_n5_dir_tif";
public static final String TEMP_N5_DATASET = "temp_n5_dataset";

public static < T extends NativeType< T > > void createTempN5DatasetFromTiff(
final JavaSparkContext sparkContext,
Expand Down Expand Up @@ -272,6 +273,7 @@ public static void main( final String... args ) throws IOException, CmdLineExcep

final String inputDirPath = parsedArgs.getInputDirPath();
final String outputDatasetPath = parsedArgs.getOutputDatasetPath();
final String tempN5Path = outputDatasetPath + File.separator + TEMP_N5_DIR;
double[][] downsamplingFactors = parsedArgs.getDownsamplingFactors();
double[] minDownsamplingFactors = parsedArgs.getMinDownsamplingFactors();
double[] maxDownsamplingFactors = parsedArgs.getMaxDownsamplingFactors();
Expand All @@ -287,9 +289,9 @@ public static void main( final String... args ) throws IOException, CmdLineExcep
.set( "spark.serializer", "org.apache.spark.serializer.KryoSerializer" )
) )
{
final N5WriterSupplier n5OutputSupplier = () -> new N5FSWriter( parsedArgs.getOutputN5Path() );
final N5WriterSupplier n5OutputSupplier = () -> new N5FSWriter( tempN5Path );

final String tmpDataset = TEMP_N5_DIR;
final String tmpDataset = TEMP_N5_DATASET;
createTempN5DatasetFromTiff(
sparkContext,
inputDirPath,
Expand Down Expand Up @@ -421,7 +423,7 @@ public static void main( final String... args ) throws IOException, CmdLineExcep
));
}

N5RemoveSpark.remove( sparkContext, n5OutputSupplier, tmpDataset );
N5RemoveSpark.remove( sparkContext, n5OutputSupplier );
}

final Path xmlpath = Paths.get(outputDatasetPath, Paths.get(outputDatasetPath).getFileName() + ".vvd");
Expand Down

0 comments on commit 242e49c

Please sign in to comment.