Skip to content

Commit

Permalink
Ability to enable detailed printing in old importer surface
Browse files Browse the repository at this point in the history
Available as long as it sticks around...
  • Loading branch information
tinwelint committed Mar 8, 2018
1 parent 84df9f4 commit f02c734
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Expand Up @@ -116,7 +116,7 @@ public void doImport() throws IOException
badCollector );

ImportTool.doImport( outsideWorld.errorStream(), outsideWorld.errorStream(), outsideWorld.inStream(), storeDir, logsDir,
reportFile, fs, nodesFiles, relationshipsFiles, false, input, this.databaseConfig, badOutput, configuration );
reportFile, fs, nodesFiles, relationshipsFiles, false, input, this.databaseConfig, badOutput, configuration, false );
}

private boolean isIgnoringSomething()
Expand Down
Expand Up @@ -32,6 +32,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import org.neo4j.csv.reader.IllegalMultilineFieldException;
Expand Down Expand Up @@ -72,7 +73,9 @@
import org.neo4j.unsafe.impl.batchimport.input.csv.DataFactory;
import org.neo4j.unsafe.impl.batchimport.input.csv.Decorator;
import org.neo4j.unsafe.impl.batchimport.input.csv.IdType;
import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitor;
import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitors;
import org.neo4j.unsafe.impl.batchimport.staging.SpectrumExecutionMonitor;

import static java.lang.String.format;
import static java.nio.charset.Charset.defaultCharset;
Expand Down Expand Up @@ -260,7 +263,8 @@ enum Options
"over the heap memory" ),
HIGH_IO( "high-io", null, "Assume a high-throughput storage subsystem",
"(advanced) Ignore environment-based heuristics, and assume that the target storage subsystem can " +
"support parallel IO with high throughput." );
"support parallel IO with high throughput." ),
DETAILED_PROGRESS( "detailed-progress", false, "true/false", "Use the old detailed 'spectrum' progress printing" );

private final String key;
private final Object defaultValue;
Expand Down Expand Up @@ -474,9 +478,10 @@ public static void main( String[] incomingArguments, boolean defaultSettingsSuit
relationshipData( inputEncoding, relationshipsFiles ), defaultFormatRelationshipFileHeader(),
idType, csvConfiguration( args, defaultSettingsSuitableForTests ), badCollector );
in = defaultSettingsSuitableForTests ? new ByteArrayInputStream( EMPTY_BYTE_ARRAY ) : System.in;
boolean detailedPrinting = args.getBoolean( Options.DETAILED_PROGRESS.key(), (Boolean) Options.DETAILED_PROGRESS.defaultValue() );

doImport( out, err, in, storeDir, logsDir, badFile, fs, nodesFiles, relationshipsFiles,
enableStacktrace, input, dbConfig, badOutput, configuration );
enableStacktrace, input, dbConfig, badOutput, configuration, detailedPrinting );

success = true;
}
Expand Down Expand Up @@ -548,7 +553,7 @@ public static void doImport( PrintStream out, PrintStream err, InputStream in, F
FileSystemAbstraction fs, Collection<Option<File[]>> nodesFiles,
Collection<Option<File[]>> relationshipsFiles, boolean enableStacktrace, Input input,
Config dbConfig, OutputStream badOutput,
org.neo4j.unsafe.impl.batchimport.Configuration configuration ) throws IOException
org.neo4j.unsafe.impl.batchimport.Configuration configuration, boolean detailedProgress ) throws IOException
{
boolean success;
LifeSupport life = new LifeSupport();
Expand All @@ -559,12 +564,14 @@ public static void doImport( PrintStream out, PrintStream err, InputStream in, F
final Neo4jJobScheduler jobScheduler = life.add( new Neo4jJobScheduler() );

life.start();
ExecutionMonitor executionMonitor = detailedProgress
? new SpectrumExecutionMonitor( 2, TimeUnit.SECONDS, out, SpectrumExecutionMonitor.DEFAULT_WIDTH )
: ExecutionMonitors.defaultVisible( in, jobScheduler );
BatchImporter importer = BatchImporterFactory.withHighestPriority().instantiate( storeDir,
fs,
null, // no external page cache
configuration,
logService,
ExecutionMonitors.defaultVisible( in, jobScheduler ),
logService, executionMonitor,
EMPTY,
dbConfig,
RecordFormatSelector.selectForConfig( dbConfig, logService.getInternalLogProvider() ),
Expand Down

0 comments on commit f02c734

Please sign in to comment.