You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by zentol <gi...@git.apache.org> on 2018/04/11 11:03:43 UTC

[GitHub] flink pull request #5838: [FLINK-9156][REST][CLI] Update --jobmanager option...

GitHub user zentol opened a pull request:

    https://github.com/apache/flink/pull/5838

    [FLINK-9156][REST][CLI] Update --jobmanager option logic for REST client

    ## What is the purpose of the change
    
    With this PR the `--jobmanager` option is properly respected by the `RestClusterClient`. The problem was that the existing code was only setting `JobManagerOptions.ADDRESS` and `JobManagerOptions.PORT`, but not the corresponding `RestOptions` that are used for all REST API calls. The `RestOptions` are accessed in`HighAvailabilityServicesUtils#createHighAvailabilityServices` to create the webmonitor URL that is used by the client.
    
    ## Brief change log
    
    * set appropriate RestOptions in `CliFrontend#setJobManagerAddressInConfig`
    * add test
    
    ## Verifying this change
    
    * run `RestClusterClientTest#testRESTManualConfigurationOverride`
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (no)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
      - The serializers: (no)
      - The runtime per-record code paths (performance sensitive): (no)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
      - The S3 file system connector: (no)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (no)
      - If yes, how is the feature documented? (not applicable)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zentol/flink 9156

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/5838.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5838
    
----
commit 661c313fcb4b5f4b4d5b31d52b4d9637a081035e
Author: zentol <ch...@...>
Date:   2018-04-11T10:48:51Z

    [FLINK-9156][REST][CLI] Update --jobmanager option logic for REST client

----


---

[GitHub] flink pull request #5838: [FLINK-9156][REST][CLI] Update --jobmanager option...

Posted by GJL <gi...@git.apache.org>.
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5838#discussion_r181141707
  
    --- Diff: flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java ---
    @@ -677,6 +682,37 @@ public void testGetAccumulators() throws Exception {
     		}
     	}
     
    +	/**
    +	 * Tests that command line options override the configuration settings.
    +	 */
    +	@Test
    +	public void testRESTManualConfigurationOverride() throws Exception {
    +		final String localhost = "localhost";
    --- End diff --
    
    Maybe `configuredHostname`, to be consistent with `manualHostname`. `localhost` is an arbitrary value, and should not be the name of the variable.


---

[GitHub] flink pull request #5838: [FLINK-9156][REST][CLI] Update --jobmanager option...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/5838


---

[GitHub] flink issue #5838: [FLINK-9156][REST][CLI] Update --jobmanager option logic ...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/5838
  
    merging.


---

[GitHub] flink pull request #5838: [FLINK-9156][REST][CLI] Update --jobmanager option...

Posted by GJL <gi...@git.apache.org>.
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5838#discussion_r181140084
  
    --- Diff: flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java ---
    @@ -677,6 +682,37 @@ public void testGetAccumulators() throws Exception {
     		}
     	}
     
    +	/**
    +	 * Tests that command line options override the configuration settings.
    +	 */
    +	@Test
    +	public void testRESTManualConfigurationOverride() throws Exception {
    +		final String localhost = "localhost";
    +		final int port = 1234;
    +		final Configuration configuration = new Configuration();
    +
    +		configuration.setString(JobManagerOptions.ADDRESS, localhost);
    +		configuration.setInteger(JobManagerOptions.PORT, port);
    +		configuration.setString(RestOptions.REST_ADDRESS, localhost);
    +		configuration.setInteger(RestOptions.REST_PORT, port);
    +
    +		final DefaultCLI defaultCLI = new DefaultCLI(configuration);
    +
    +		final String manualHostname = "123.123.123.123";
    +		final int manualPort = 4321;
    +		final String[] args = {"-m", manualHostname + ':' + manualPort};
    +
    +		CommandLine commandLine = defaultCLI.parseCommandLineOptions(args, false);
    +
    +		final StandaloneClusterDescriptor clusterDescriptor = defaultCLI.createClusterDescriptor(commandLine);
    +
    +		final RestClusterClient<?> clusterClient = clusterDescriptor.retrieve(defaultCLI.getClusterId(commandLine));
    +
    +		URL webMonitorBaseUrl = clusterClient.getWebMonitorBaseUrl().get();
    +		assertThat(webMonitorBaseUrl.getHost(), Matchers.equalTo(manualHostname));
    +		assertThat(webMonitorBaseUrl.getPort(), Matchers.equalTo(manualPort));
    --- End diff --
    
    There is already a static import for `equalTo` in this file. I think it should be used, i.e.,
    
    ```
    assertThat(webMonitorBaseUrl.getHost(), equalTo(manualHostname));
    assertThat(webMonitorBaseUrl.getPort(), equalTo(manualPort));
    ```


---