You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by mxm <gi...@git.apache.org> on 2016/08/01 13:39:41 UTC

[GitHub] flink pull request #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

GitHub user mxm opened a pull request:

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

    [FLINK-4297][yarn] decode URL encoded fat jar path

    This solves problems with spaces and special characters in the
    automatically determined fat jar path which is returned URL encoded.

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

    $ git pull https://github.com/mxm/flink FLINK-4297

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

    https://github.com/apache/flink/pull/2320.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 #2320
    
----
commit 76dc43ac69e374482894fa15d67f001fc5030be0
Author: Maximilian Michels <mx...@apache.org>
Date:   2016-08-01T13:19:15Z

    [FLINK-4297][yarn] decode URL encoded fat jar path
    
    This solves problems with spaces and special characters in the
    automatically determined fat jar path which is returned URL encoded.

----


---
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 #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320#discussion_r73333859
  
    --- Diff: flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java ---
    @@ -260,8 +263,15 @@ public AbstractYarnClusterDescriptor createDescriptor(String defaultApplicationN
     		} else {
     			LOG.info("No path for the flink jar passed. Using the location of "
     				+ yarnClusterDescriptor.getClass() + " to locate the jar");
    -			localJarPath = new Path("file://" +
    -				yarnClusterDescriptor.getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
    +			String encodedJarPath =
    +				yarnClusterDescriptor.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
    +			try {
    +				// we have to decode the url encoded parts of the path
    +				localJarPath = new Path("file://" + URLDecoder.decode(encodedJarPath, Charset.defaultCharset().name()));
    --- End diff --
    
    I think manually coding the `file:// + path` URIs have cross-platform issues.
    
    For File URIs, I found it to be best to go with 
    ```java
    new File(string).toURI()
    ```
    or in that specific case:
    ```java
    localJarPath = new Path(new File(URLDecoder.decode(encodedJarPath, Charset.defaultCharset().name())).toURI());
    or
    localJarPath = new Path(new URI("file", null, URLDecoder.decode(encodedJarPath, Charset.defaultCharset().name()), null));
    ```


---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    Tested this with Hadoop 2.4.1 and it works as expected with `bin/flink run -m yarn-cluster`:
    ```
    2016-08-01 16:32:06,214 INFO  org.apache.flink.yarn.Utils - Copying from 2016-08-01 16:32:06,214 INFO  org.apache.flink.yarn.Utils - Copying from file:/home/hadoop/mxm/flink/flink-dist/target/flink-1.1-SNAPSHOT-bin/flink with spaces/conf/log4j.properties to gs://.../user/hadoop/.flink/application_1470041666362_0007/log4j.properties
    ...
    08/01/2016 16:33:24	Job execution switched to status FINISHED.
    ```
    
    But YARN sessions don't work. I get:
    ```
    $ bin/yarn-session.sh
    Error: Could not find or load main class with
    ```



---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    One comment inline, otherwise looks good.


---
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 #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

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


---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    It didn't fix it unfortunately.


---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    Should be good to go now.


---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    Thanks for trying it out @uce! There was an unrelated quoting issue in `yarn-session.sh`. I pushed another fix.


---
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 issue #2320: [FLINK-4297][yarn] decode URL encoded fat jar path

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

    https://github.com/apache/flink/pull/2320
  
    Will address the comment and merge this...


---
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.
---