Java Code Examples for org.datavec.api.split.FileSplit#bootStrapForWrite()
The following examples show how to use
org.datavec.api.split.FileSplit#bootStrapForWrite() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PartitionerTests.java From DataVec with Apache License 2.0 | 6 votes |
@Test public void testInputAddFile() throws Exception { Partitioner partitioner = new NumberOfRecordsPartitioner(); File tmpDir = Files.createTempDir(); FileSplit fileSplit = new FileSplit(tmpDir); assertTrue(fileSplit.needsBootstrapForWrite()); fileSplit.bootStrapForWrite(); Configuration configuration = new Configuration(); configuration.set(NumberOfRecordsPartitioner.RECORDS_PER_FILE_CONFIG,String.valueOf(5)); partitioner.init(configuration,fileSplit); partitioner.updatePartitionInfo(PartitionMetaData.builder().numRecordsUpdated(5).build()); assertTrue(partitioner.needsNewPartition()); OutputStream os = partitioner.openNewStream(); os.close(); assertNotNull(os); //run more than once to ensure output stream creation works properly partitioner.updatePartitionInfo(PartitionMetaData.builder().numRecordsUpdated(5).build()); os = partitioner.openNewStream(); os.close(); assertNotNull(os); }
Example 2
Source File: PartitionerTests.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Test public void testInputAddFile() throws Exception { Partitioner partitioner = new NumberOfRecordsPartitioner(); File tmpDir = Files.createTempDir(); FileSplit fileSplit = new FileSplit(tmpDir); assertTrue(fileSplit.needsBootstrapForWrite()); fileSplit.bootStrapForWrite(); Configuration configuration = new Configuration(); configuration.set(NumberOfRecordsPartitioner.RECORDS_PER_FILE_CONFIG,String.valueOf(5)); partitioner.init(configuration,fileSplit); partitioner.updatePartitionInfo(PartitionMetaData.builder().numRecordsUpdated(5).build()); assertTrue(partitioner.needsNewPartition()); OutputStream os = partitioner.openNewStream(); os.close(); assertNotNull(os); //run more than once to ensure output stream creation works properly partitioner.updatePartitionInfo(PartitionMetaData.builder().numRecordsUpdated(5).build()); os = partitioner.openNewStream(); os.close(); assertNotNull(os); }
Example 3
Source File: PartitionerTests.java From DataVec with Apache License 2.0 | 5 votes |
@Test public void testRecordsPerFilePartition() { Partitioner partitioner = new NumberOfRecordsPartitioner(); File tmpDir = Files.createTempDir(); FileSplit fileSplit = new FileSplit(tmpDir); assertTrue(fileSplit.needsBootstrapForWrite()); fileSplit.bootStrapForWrite(); partitioner.init(fileSplit); assertEquals(1,partitioner.numPartitions()); }
Example 4
Source File: PartitionerTests.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testRecordsPerFilePartition() { Partitioner partitioner = new NumberOfRecordsPartitioner(); File tmpDir = Files.createTempDir(); FileSplit fileSplit = new FileSplit(tmpDir); assertTrue(fileSplit.needsBootstrapForWrite()); fileSplit.bootStrapForWrite(); partitioner.init(fileSplit); assertEquals(1,partitioner.numPartitions()); }