Skip to content

Conversation

@rohitagarwal003
Copy link
Contributor

No description provided.

@JoshRosen
Copy link
Contributor

Jenkins, this is ok to test.

@JoshRosen
Copy link
Contributor

I don't know who is the best person to review this. @vanzin and @imran, maybe, given that you guys have worked with Jetty? @zsxwing, perhaps, given your recent UI work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you're copying & pasting the code from above, but I wonder how is this any different than just always returning basePath + relativePath.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, the conditional makes sense in the original method, because of the stripSuffix call, but does not make sense here - nor does the copied scaladoc about "avoid returning an empty path".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on both counts. Updated.

@vanzin
Copy link
Contributor

vanzin commented Aug 7, 2015

Makes sense after looking at how WebUI.attachPage works.

@SparkQA
Copy link

SparkQA commented Aug 7, 2015

Test build #40129 has finished for PR 8014 at commit b257844.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Aug 7, 2015

Test build #40143 has finished for PR 8014 at commit 8a977cd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rohitagarwal003
Copy link
Contributor Author

Can this be merged now @vanzin?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these methods seems superfluous. They're trivial and each called once. I don't see why basePath == "" is treated separately, like, why the trailing slash wouldn't be stripped. In fact, there's only one way a call sets basePath to anything but "" and it's the /jobs servlet below - not clear why only that is special cased?

Anyway I'd suggest removing the methods and removing the special-casing -- it's just the combination of two strings, with a trailing / stripped in one case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basePath == "" is treated separately because there is a case when basePath = "" and relativePath = "/". In that case, we would return an empty string if we don't treat basePath == "" separately.

Here are the various cases:

                                          + /
                                          + /json

  /history/application_1438648766072_0009 + /jobs
  /history/application_1438648766072_0009 + /jobs/json
  /history/application_1438648766072_0009 + /jobs/job
  /history/application_1438648766072_0009 + /jobs/job/json
  /history/application_1438648766072_0009 + /stages
  /history/application_1438648766072_0009 + /stages/json
  /history/application_1438648766072_0009 + /stages/stage
  /history/application_1438648766072_0009 + /stages/stage/json
  /history/application_1438648766072_0009 + /stages/pool
  /history/application_1438648766072_0009 + /stages/pool/json
  /history/application_1438648766072_0009 + /storage
  /history/application_1438648766072_0009 + /storage/json
  /history/application_1438648766072_0009 + /storage/rdd
  /history/application_1438648766072_0009 + /storage/rdd/json
  /history/application_1438648766072_0009 + /environment
  /history/application_1438648766072_0009 + /environment/json
  /history/application_1438648766072_0009 + /executors
  /history/application_1438648766072_0009 + /executors/json
* /history/application_1438648766072_0009 + /jobs/
  /history/application_1438648766072_0009 + /
*                                         + /stages/
                                          + /stages/stage/kill

The ones with asterisk are for attachPrefixForRedirect, the other ones are for attachPrefix.

Earlier attachPrefix was called from two places, but now from one of these places attachPrefixForRedirect is being called. Let me know if you want me to inline these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but I'm curious why basePath == "" plus relativePath == "foo/" should retain its trailing slash but not when basePath is non-empty. Is it really basePath =="" && relativePath =="/" that should be handled specially?

I do think it would be better to inline them. I am not sure why the suffix-stripping logic exists in the first place but that may be too far afield.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why the suffix-stripping logic exists in the first place but that may be too far afield.

That's because contextHandler.setContextPath() which uses the result of attachPrefix, throws an IllegalArgumentException when the path ends with /.

Yes but I'm curious why basePath == "" plus relativePath == "foo/" should retain its trailing slash but not when basePath is non-empty. Is it really basePath =="" && relativePath =="/" that should be handled specially?

Yes, it seems like only basePath =="" && relativePath =="/" should be handled specially. In fact, basePath == "" plus relativePath == "foo/" would result in the IllegalArgumentException mentioned above. I guess we just never encountered that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen I have inlined the methods and fixed the if condition for calculating prefixedPath.

@SparkQA
Copy link

SparkQA commented Aug 11, 2015

Test build #40364 timed out for PR 8014 at commit a7af5ff after a configured wait of 175m.

@SparkQA
Copy link

SparkQA commented Aug 11, 2015

Test build #1445 has finished for PR 8014 at commit a7af5ff.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rohitagarwal003
Copy link
Contributor Author

Can we retest this? The test failures seem unrelated to my changes.

@zsxwing
Copy link
Member

zsxwing commented Aug 12, 2015

retest this please.

@SparkQA
Copy link

SparkQA commented Aug 12, 2015

Test build #40629 has finished for PR 8014 at commit a7af5ff.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rohitagarwal003
Copy link
Contributor Author

@vanzin, @srowen Does this look good now?

@vanzin
Copy link
Contributor

vanzin commented Aug 13, 2015

LGTM.

@vanzin
Copy link
Contributor

vanzin commented Aug 13, 2015

Merged to master. Thanks!

@asfgit asfgit closed this in 0d1d146 Aug 13, 2015
CodingCat pushed a commit to CodingCat/spark that referenced this pull request Aug 17, 2015
Author: Rohit Agarwal <rohita@qubole.com>

Closes apache#8014 from mindprince/SPARK-9724 and squashes the following commits:

a7af5ff [Rohit Agarwal] [SPARK-9724] [WEB UI] Inline attachPrefix and attachPrefixForRedirect. Fix logic of attachPrefix
8a977cd [Rohit Agarwal] [SPARK-9724] [WEB UI] Address review comments: Remove unneeded code, update scaladoc.
b257844 [Rohit Agarwal] [SPARK-9724] [WEB UI] Avoid unnecessary redirects in the Spark Web UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants