feat(sql lab): display presto and trino tracking url#20799
feat(sql lab): display presto and trino tracking url#20799ktmud merged 3 commits intoapache:masterfrom
Conversation
67595f3 to
fe967b8
Compare
Codecov Report
@@ Coverage Diff @@
## master #20799 +/- ##
==========================================
+ Coverage 66.23% 66.24% +0.01%
==========================================
Files 1757 1757
Lines 66978 67031 +53
Branches 7117 7118 +1
==========================================
+ Hits 44360 44408 +48
- Misses 20801 20806 +5
Partials 1817 1817
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. |
6068fee to
6f74d4a
Compare
There was a problem hiding this comment.
Could this just be a method called get_tracking_url and then you wouldn't need to rename the column virtually or have a getter/setter.
There was a problem hiding this comment.
I want the FAB-based API to always return the transformed url but I couldn't find a clean way to do it without adding an (unnecessary) new field.
There was a problem hiding this comment.
@dpgaspar @betodealmeida do you have any recommendation on what's the best practice for such use case?
There was a problem hiding this comment.
info_uri is only available in the latest version of the Trino client, which we haven't upgrade to yet.
There was a problem hiding this comment.
I want the FAB-based API to always return the transformed url but I couldn't find a clean way to do it without adding an (unnecessary) new field.
afe9f3e to
07f3687
Compare
07f3687 to
a7cb2fd
Compare
|
@john-bodley I addressed your comments and added some integration tests. Can you take another look? |
a7cb2fd to
83d165f
Compare
There was a problem hiding this comment.
| pass | |
| return None |
There was a problem hiding this comment.
Final return is expected to be explicit if you have a return statement earlier. I think there is a pylint or mypy warning for this.
There was a problem hiding this comment.
| return None |
There was a problem hiding this comment.
@ktmud per you PR description this logic has changed. Can we confirmed that the previous behavior is preserved? I just want to confirm this isn't a breaking change.
There was a problem hiding this comment.
Yes, there is a test case for it: https://github.com/apache/superset/pull/20799/files#diff-bbedc6245e80199586380e684695b5a8e275fd95c46f6770b91eb0bb918e2bf5R52-R53
83d165f to
11a0658
Compare
There was a problem hiding this comment.
Bycatch: this test is flaky. [QUERY_1, QUERY_2, QUERY_3] are executed consequently, with supposedly increasing start_time.
Since the original code int(...) basically rounded down the float epoch, the actual query results returned [QUERY_1, QUERY_2]---even though we filtered second_query_time by QUERY_3. But this still sometimes fail because the rounded down time can be anywhere between QUERY_1 start time and QUERY_3 start time, so if QUERY_1 and QUERY_2 are executed within the same second, we wouldn't have QUERY_2 in the filtered results. E.g. when the start time for the queries are 1.1, 1.5, 2---we'd be filtered to between [1, 1].
84ded7a to
d400ac4
Compare
| resp = self.get_resp("/superset/search_queries?" + "&".join(params)) | ||
| data = json.loads(resp) | ||
| self.assertEqual(2, len(data)) | ||
| # pylint: disable=line-too-long |
There was a problem hiding this comment.
I would add this at the end of line #420, otherwise I think it disables the error for the entire block.
There was a problem hiding this comment.
I reformatted it so pylint disable isn't necessary.
SUMMARY
Enable tracking URL for Presto and Trino (previously it is only available for Hive queries) and also change
TRACKING_URL_TRANSFORMERto run at runtime (as opposed to when queries are fetched) so that we can display different tracking URL based on query age (most tracking URLs will expire after a certain amount of time---in Trino/Preso, this is configured byquery.min-expire-age.Had to update query execution logics to add end time for failed executions, too.
While debugging, I also realized the TIMED_OUT status isn't actually in use---and now the frontend also cannot handle that status. We should probably add it back, but let's save it for another PR.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
When queries are still running:
We will now display the tracking url even for failed jobs, this is useful for users to debug their failed queries:
TESTING INSTRUCTIONS
TRACKING_URL_TRANSFORMER. For example, following setting will only display tracking urls for queries finished within the last 5 minutes:ADDITIONAL INFORMATION