-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-47276][PYTHON][CONNECT] Introduce spark.profile.clear for SparkSession-based profiling
#45378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-47276][PYTHON][CONNECT] Introduce spark.profile.clear for SparkSession-based profiling
#45378
Changes from 6 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -531,6 +531,33 @@ def test_dump_invalid_type(self): | |
| }, | ||
| ) | ||
|
|
||
| def test_clear_memory_type(self): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit, it seems we don't have a parity test for
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! For now, all logic tested by SparkSessionProfileTests is directly imported in Spark Connect with no modification. But I do agree separating it later will improve readability and ensure future parity. I'll refactor later. Thanks! |
||
| self.profile.clear(type="memory") | ||
| self.profiler_collector_mock.clear_memory_profiles.assert_called_once() | ||
| self.profiler_collector_mock.clear_perf_profiles.assert_not_called() | ||
|
|
||
| def test_clear_perf_type(self): | ||
| self.profile.clear(type="perf") | ||
| self.profiler_collector_mock.clear_perf_profiles.assert_called_once() | ||
| self.profiler_collector_mock.clear_memory_profiles.assert_not_called() | ||
|
|
||
| def test_clear_no_type(self): | ||
| self.profile.clear() | ||
| self.profiler_collector_mock.clear_perf_profiles.assert_called_once() | ||
| self.profiler_collector_mock.clear_memory_profiles.assert_called_once() | ||
|
|
||
| def test_clear_invalid_type(self): | ||
| with self.assertRaises(PySparkValueError) as e: | ||
| self.profile.clear(type="invalid") | ||
| self.check_error( | ||
| exception=e.exception, | ||
| error_class="VALUE_NOT_ALLOWED", | ||
| message_parameters={ | ||
| "arg_name": "type", | ||
| "allowed_values": str(["perf", "memory"]), | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| class SparkExtensionsTest(unittest.TestCase): | ||
| # These tests are separate because it uses 'spark.sql.extensions' which is | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a user-facing API? If not, we don't need this version directive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a user-facing API, along with
profile.showandprofile.dump. We will also add it to API doc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is not. The
clearinProfileshould be a user-facing API.