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

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

GitHub user tillrohrmann opened a pull request:

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

    [FLINK-3774] [shell] Forwards Flink configuration to PlanExecutor

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [X] General
      - The pull request references the related JIRA issue
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message
    
    - [X] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [X] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed
    
    The ScalaShellRemoteEnvironment did not properly forward the given Flink configuration
    to the PlanExecutor. Consequently, it was not possible to configure the Client to connect
    to an HA cluster. This PR corrects the forwarding.

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

    $ git pull https://github.com/tillrohrmann/flink fixScalaShell

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

    https://github.com/apache/flink/pull/1904.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 #1904
    
----
commit 427fe789dcd20ba94dc9cebcef85b629ada6ce9c
Author: Till Rohrmann <tr...@apache.org>
Date:   2016-04-18T15:41:47Z

    [FLINK-3774] [shell] Forwards Flink configuration to PlanExecutor
    
    The ScalaShellRemoteEnvironment did not properly forward the given Flink configuration
    to the PlanExecutor. Consequently, it was not possible to configure the Client to connect
    to an HA cluster. This PR corrects the forwarding.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60235985
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    +			this.jarFiles = new ArrayList<URL>(jarFiles.length);
    --- End diff --
    
    Will fix it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/1904#issuecomment-214328347
  
    Failing test case is unrelated. Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60231836
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    +			this.jarFiles = new ArrayList<URL>(jarFiles.length);
    --- End diff --
    
    Nitpick - No need of <URL> :( 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/1904#issuecomment-214241269
  
    Thanks for the review @uce, @smarthi and @zentol. Will fix the test problem with Scala 2.11 and then merge this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60238192
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    +			this.jarFiles = new ArrayList<URL>(jarFiles.length);
     			for (int i = 0; i < jarFiles.length; i++) {
     				try {
    -					this.jarFiles[i] = new File(jarFiles[i]).getAbsoluteFile().toURI().toURL();
    +					this.jarFiles.add(new File(jarFiles[i]).getAbsoluteFile().toURI().toURL());
     				} catch (MalformedURLException e) {
     					throw new IllegalArgumentException("JAR file path invalid", e);
     				}
     			}
     		}
     		else {
    -			this.jarFiles = null;
    +			this.jarFiles = Collections.emptyList();
    +		}
    +
    +		if (globalClasspaths == null) {
    +			this.globalClasspaths = Collections.emptyList();
    +		} else {
    +			this.globalClasspaths = Arrays.asList(globalClasspaths);
     		}
    -		this.globalClasspaths = globalClasspaths;
     	}
     
     	// ------------------------------------------------------------------------
     
     	@Override
     	public JobExecutionResult execute(String jobName) throws Exception {
    -		ensureExecutorCreated();
    +		PlanExecutor executor = getExecutor();
    --- End diff --
    
    You're right, it's bad that the `PlanExecutor` is not stopped after it has been used. I will fix this by checking in `ScalaShellRemoteEnvironment` whether `this.executor` is set. If true, then it will call `this.executor.stop()`. That way, there will always be at most one `PlanExecutor` active and the last one is stopped by the `dispose` call.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60885454
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    -			for (int i = 0; i < jarFiles.length; i++) {
    +			this.jarFiles = new ArrayList<>(jarFiles.length);
    +			for(String jarFile : jarFiles) {
    --- End diff --
    
    Will fix it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60883547
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    -			for (int i = 0; i < jarFiles.length; i++) {
    +			this.jarFiles = new ArrayList<>(jarFiles.length);
    +			for(String jarFile : jarFiles) {
    --- End diff --
    
    whitespace missing after `for`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

    https://github.com/apache/flink/pull/1904#discussion_r60217702
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/RemoteEnvironment.java ---
    @@ -133,26 +137,31 @@ public RemoteEnvironment(String host, int port, Configuration clientConfig,
     		this.port = port;
     		this.clientConfiguration = clientConfig == null ? new Configuration() : clientConfig;
     		if (jarFiles != null) {
    -			this.jarFiles = new URL[jarFiles.length];
    +			this.jarFiles = new ArrayList<URL>(jarFiles.length);
     			for (int i = 0; i < jarFiles.length; i++) {
     				try {
    -					this.jarFiles[i] = new File(jarFiles[i]).getAbsoluteFile().toURI().toURL();
    +					this.jarFiles.add(new File(jarFiles[i]).getAbsoluteFile().toURI().toURL());
     				} catch (MalformedURLException e) {
     					throw new IllegalArgumentException("JAR file path invalid", e);
     				}
     			}
     		}
     		else {
    -			this.jarFiles = null;
    +			this.jarFiles = Collections.emptyList();
    +		}
    +
    +		if (globalClasspaths == null) {
    +			this.globalClasspaths = Collections.emptyList();
    +		} else {
    +			this.globalClasspaths = Arrays.asList(globalClasspaths);
     		}
    -		this.globalClasspaths = globalClasspaths;
     	}
     
     	// ------------------------------------------------------------------------
     
     	@Override
     	public JobExecutionResult execute(String jobName) throws Exception {
    -		ensureExecutorCreated();
    +		PlanExecutor executor = getExecutor();
    --- End diff --
    
    would it make sense to move the assignment to ```this.executor``` from ```getExecutor()``` to this line? as it stands the ScalaShellRemoteEnvironment executor is never closed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3774] [shell] Forwards Flink configurat...

Posted by uce <gi...@git.apache.org>.
Github user uce commented on the pull request:

    https://github.com/apache/flink/pull/1904#issuecomment-214224099
  
    Changes look good! +1 to merge 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---