Skip to content

Commit

Permalink
[FLINK-2459] [cli] Cli API and doc fixes.
Browse files Browse the repository at this point in the history
1. Remove CliFrontendLoggingTest. Test directly that the logging flag is interpreted correctly.
2. Doc fix for cli api
3. Info command shouldn't print logging option for help.

This closes apache#971
  • Loading branch information
sachingoel0101 authored and StephanEwen committed Aug 2, 2015
1 parent 40eef52 commit 81f9b21
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 118 deletions.
5 changes: 5 additions & 0 deletions docs/apis/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ Action "run" compiles and runs a program.
program. Optional flag to override the
default value specified in the
configuration.
-q --sysoutLogging Specfying this flag will disable log messages
being reported on the console. All messages
however will still be logged by SLF4J loggers,
regardless of this setting.
Additional arguments if -m yarn-cluster is set:
-yD <arg> Dynamic properties
-yd,--yarndetached Start detached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ private static Options getInfoOptions(Options options) {
}

private static Options getInfoOptionsWithoutDeprecatedOptions(Options options) {
options = getProgramSpecificOptionsWithoutDeprecatedOptions(options);
options.addOption(CLASS_OPTION);
options.addOption(PARALLELISM_OPTION);
options = getJobManagerAddressOption(options);
return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ public void setPrintStatusDuringExecution(boolean print) {
this.printStatusDuringExecution = print;
}

/**
* @return whether the client will print progress updates during the execution to {@code System.out}
*/
public boolean getPrintStatusDuringExecution() {
return this.printStatusDuringExecution;
}

/**
* @return -1 if unknown. The maximum number of available processing slots at the Flink cluster
* connected to this client.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,24 @@ public void testRun() {
// test without parallelism
{
String[] parameters = {"-v", getTestJarPath()};
RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(-1);
RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(-1, true);
assertEquals(0, testFrontend.run(parameters));
}

// test configure parallelism
{
String[] parameters = {"-v", "-p", "42", getTestJarPath()};
RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(42);
RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(42, true);
assertEquals(0, testFrontend.run(parameters));
}


// test configure sysout logging
{
String[] parameters = {"-p", "2", "-q", getTestJarPath()};
RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(2, false);
assertEquals(0, testFrontend.run(parameters));
}

// test configure parallelism with non integer value
{
String[] parameters = {"-v", "-p", "text", getTestJarPath()};
Expand All @@ -86,15 +93,18 @@ public void testRun() {
public static final class RunTestingCliFrontend extends CliFrontend {

private final int expectedParallelim;
private final boolean sysoutLogging;

public RunTestingCliFrontend(int expectedParallelim) throws Exception {
public RunTestingCliFrontend(int expectedParallelim, boolean logging) throws Exception {
super(CliFrontendTestUtils.getConfigDir());
this.expectedParallelim = expectedParallelim;
this.sysoutLogging = logging;
}

@Override
protected int executeProgram(PackagedProgram program, Client client, int parallelism, boolean wait) {
assertEquals(this.expectedParallelim, parallelism);
assertEquals(client.getPrintStatusDuringExecution(), sysoutLogging);
return 0;
}
}
Expand Down

0 comments on commit 81f9b21

Please sign in to comment.