You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "yaooqinn (via GitHub)" <gi...@apache.org> on 2023/11/20 06:32:16 UTC
[PR] [WIP][SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
yaooqinn opened a new pull request, #43903:
URL: https://github.com/apache/spark/pull/43903
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Create an ui-test module with Jest to test ui javascript code.
The tests below are also shipped with this PR for testing the functionality of this PR.
```
ui-test/tests/flamegraph.test.js
ui-test/tests/utils.test.js
```
Followups will focus on improving the test coverage of the rest of the javascript files.
Jest: https://jestjs.io/
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
- Developing and verifying the javascript is hard for developers while creating PRs, mainly by building distribution and running.
- Maintaining the UI javascript files is also difficult for maintainers because of the lack of CI workflows.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
no
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
New UI GitHub action workflow.
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
no
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1818735416
> For example, ui-test currently is related to core module only, isn't it?
Not exactly, the current introduced tests are only examples(yes, based on core), but the module is decoupled with core. It's easy to add other ones by direct import, i.e., https://github.com/apache/spark/pull/43903/files#diff-bdb4ec97b89679d9a7d3e2e74dbfa54e15127a031a52d9c2b7aaa1bb729e8c26R19
> Is the current ui-test layout is proper and extensible for the future?
So, this is also a yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1831086471
Sure, thank you for proceeding the process.
Merged to master.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1819949721
Thank you for sharing in advance, @yaooqinn .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1469179023
##########
core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala:
##########
@@ -35,8 +35,9 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
val lastUpdatedTime = parent.getLastUpdatedTime()
val providerConfig = parent.getProviderConfig()
val content =
- <script src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")}></script> ++
- <script src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script>
+ <script type="module"
+ src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")} /> ++
Review Comment:
Let me fix it. Thank you @dongjoon-hyun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #43903: [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code
URL: https://github.com/apache/spark/pull/43903
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1818901899
https://docs.google.com/document/d/1hWl5Q2CNNOjN5Ubyoa28XmpJtDyD9BtGtiEG2TT94rg/edit?usp=sharing
Hi, @dongjoon-hyun, please do a pre-checking for the SPIP doc before I send it to the dev@.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1819958458
In general, it looks good. I added a few comments about a few missing content, @yaooqinn .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [WIP][SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1818630923
cc @sarutak @dongjoon-hyun @HyukjinKwon , thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1831082839
Hi @dongjoon-hyun, thanks for your suggestions and vote for the SPIP. As the vote result is positive, https://lists.apache.org/thread/1m94wwkd0wfx9j7rb5p4kf1kgd8rgg89, Would you like to proceed with this pull request?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #43903:
URL: https://github.com/apache/spark/pull/43903#issuecomment-1831091175
Thank you again, @dongjoon-hyun.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1469179712
##########
core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala:
##########
@@ -35,8 +35,9 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
val lastUpdatedTime = parent.getLastUpdatedTime()
val providerConfig = parent.getProviderConfig()
val content =
- <script src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")}></script> ++
- <script src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script>
+ <script type="module"
+ src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")} /> ++
Review Comment:
I made a draft, @yaooqinn .
##########
core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala:
##########
@@ -35,8 +35,9 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
val lastUpdatedTime = parent.getLastUpdatedTime()
val providerConfig = parent.getProviderConfig()
val content =
- <script src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")}></script> ++
- <script src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script>
+ <script type="module"
+ src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")} /> ++
Review Comment:
https://github.com/apache/spark/pull/44930
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1469159085
##########
core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala:
##########
@@ -35,8 +35,9 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
val lastUpdatedTime = parent.getLastUpdatedTime()
val providerConfig = parent.getProviderConfig()
val content =
- <script src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")}></script> ++
- <script src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script>
+ <script type="module"
+ src={UIUtils.prependBaseUri(request, "/static/historypage-common.js")} /> ++
Review Comment:
Unfortunately, this seems to break `Spark History Server` currently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1467245519
##########
core/src/main/resources/org/apache/spark/ui/static/log-view.js:
##########
@@ -15,7 +15,9 @@
* limitations under the License.
*/
-/* global $, getBaseURI */
+/* global $ */
+
+import {getBaseURI} from "./utils.js";
Review Comment:
It seems that we need to recover this. Could you review this, @yaooqinn ?
- https://github.com/apache/spark/pull/44896
##########
core/src/main/resources/org/apache/spark/ui/static/log-view.js:
##########
@@ -15,7 +15,9 @@
* limitations under the License.
*/
-/* global $, getBaseURI */
+/* global $ */
+
+import {getBaseURI} from "./utils.js";
Review Comment:
It seems that we need to recover `log-view.js`. Could you review this, @yaooqinn ?
- https://github.com/apache/spark/pull/44896
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1427469572
##########
core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala:
##########
@@ -128,8 +128,15 @@ private[ui] class ExecutorThreadDumpPage(
// scalastyle:off
private def drawExecutorFlamegraph(request: HttpServletRequest, thread: Array[ThreadStackTrace]): Seq[Node] = {
+ val js =
+ s"""
+ |import {drawFlamegraph} from "/static/flamegraph.js";
Review Comment:
It makes sense to me, let me fix this. Thank you, Hyukjin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-46003][UI][TESTS] Create an ui-test module with Jest to test ui javascript code [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #43903:
URL: https://github.com/apache/spark/pull/43903#discussion_r1427397294
##########
core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala:
##########
@@ -128,8 +128,15 @@ private[ui] class ExecutorThreadDumpPage(
// scalastyle:off
private def drawExecutorFlamegraph(request: HttpServletRequest, thread: Array[ThreadStackTrace]): Seq[Node] = {
+ val js =
+ s"""
+ |import {drawFlamegraph} from "/static/flamegraph.js";
Review Comment:
Hmmm.. shouldn't we fix it as:
```scala
import {drawFlamegraph} from "${UIUtils.prependBaseUri(request, "/static/flamegraph.js")}";
```
? this and all those imports in this PR. Otherwise, I think it's a regression of SPARK-11484 and when a proxy is used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org