Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1634 from finos/feature/1597-default-to-generator…
Browse files Browse the repository at this point in the history
…-command

#1451- default to generator command
  • Loading branch information
Simon Laing authored Jan 17, 2020
2 parents 645f44f + 66e8c0b commit 139217e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ When manually writing profiles, we recommend using a text editor which can valid
Now place the `generator.jar` file (downloaded from the [GitHub releases page](https://github.com/finos/datahelix/releases/)) in the same folder as the profile, open up a terminal, and execute the following:

```
$ java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv
$ java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv
```

The generator is a command line tool which reads a profile, and outputs data in CSV or JSON format. The `--max-rows=100` option tells the generator to create 100 rows of data, and the `--replace` option tells it to overwrite previously generated files. The compulsory `--profile-file` option specifies the name of the input profile, and the `--output-path` option specifies the location to write the output to. In `generate` mode `--output-path` is optional; the generator will default to standard output if it is not supplied. By default the generator outputs progress, in rows per second, to the standard error output. This can be useful when generating large volumes of data.
Expand Down Expand Up @@ -248,7 +248,7 @@ The mode is specified via the `--generation-type` option.
The generator has been designed to be fast and efficient, allowing you to generate large quantities of test and simulation data. If you supply a large number for the `--max-rows` option, the data will be streamed to the output file, with the progress / velocity reported during generation.

```
$ java -jar generator.jar generate --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv
$ java -jar generator.jar --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv
Generation started at: 16:41:44
Number of rows | Velocity (rows/sec) | Velocity trend
Expand Down
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ Profiles can be run against a jar using the command line.

Currently the only mode fully supported by the data helix is generate mode. An example command would be something like

`java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv`
`java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv`

### Command Line Arguments for Generate Mode
<div id="Command-Line-Arguments-for-Generate-Mode"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,7 @@
name = "datahelix",
version = { ProfileConfiguration.PROFILE_SCHEMA_VERSION_TEXT })
public class App implements Runnable {
@CommandLine.Option(
names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION },
versionHelp = true,
description = CommonOptionInfo.VERSION_DESCRIPTION)
boolean versionRequested;

@CommandLine.Option(
names = { CommonOptionInfo.HELP_SHORT_OPTION, CommonOptionInfo.HELP_LONG_OPTION },
usageHelp = true,
description = CommonOptionInfo.HELP_DESCRIPTION)
private boolean help;

private static final CommandLine picoCliCommandLine = new CommandLine(new App())
.addSubcommand("generate", new GenerateCommandLine())
private static final CommandLine picoCliCommandLine = new CommandLine(new GenerateCommandLine())
.addSubcommand("violate", new ViolateCommandLine())
.setCaseInsensitiveEnumValuesAllowed(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* This class holds the generate specific command line options.
*/
@picocli.CommandLine.Command(
name = "generate",
name = "",
description = "Produces data using any options provided.",
descriptionHeading = "%nDescription:%n",
parameterListHeading = "%nParameters:%n",
Expand All @@ -67,6 +67,13 @@ private void checkForAlphaGenerationDataTypes() {
}
}

@CommandLine.Option(
names = { "generate" },
description = "Included for backward compatibility with command-based invocation",
hidden = true
)
boolean generateCommandUsed;

@CommandLine.Option(
names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION },
versionHelp = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private Process setupProcess(final String profile) throws IOException {
"java",
"-jar",
"build/libs/generator.jar",
"generate",
profile,
"--max-rows=1",
"--quiet");
Expand Down

0 comments on commit 139217e

Please sign in to comment.