Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KYUUBI #4028] [PYSPARK] Fix internal python code issue
### _Why are the changes needed?_ 1. wrap the code with correct delimiter Before: ``` {"code":"spark.sparkContext.setJobGroup(07753dd9-804e-478f-b84f-bf0735732334, ..., true)","cmd":"run_code"} ``` After: ``` {"code":"spark.sparkContext.setJobGroup('07753dd9-804e-478f-b84f-bf0735732334', '...', True)","cmd":"run_code"} ``` 2. using cancelJobGroup for pyspark Before: ``` 'SparkContext' object has no attribute 'clearJobGroup' ``` After: Using SparkContext.cancelJobGroup 3. Simplify the internal python code and throw exception on failure We can not trust the user code is formatted correctly and we shall ensure the internal python code is simple and correct to prevent code correctness and even cause result out of sequence. Such as, the user code might be below(maybe user invoke executePython api) ``` spark.sql('123\'\n\b\t' ``` It is difficult to escape the user code and set the job description as the statement as. So, in this pr, I simplify the job description, just record its statementId, user can check the original code from log or on UI I think. ### _How was this patch tested?_ - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4028 from turboFei/python_async_debug. Closes #4028 51a4c5e [fwang12] typo 6da88d1 [fwang12] code style 83f5a48 [fwang12] fail the internal python code 5f2db04 [fwang12] remove debug code 3a798cf [fwang12] Simplify the statement c3b4640 [fwang12] do not lock for close 009f66a [fwang12] add ReentrantLock for SessionPythonWorker run python code 39bd861 [fwang12] fix 4116dab [fwang12] job desc f16c656 [fwang12] escape 81db20c [fwang12] fix 'SparkContext' object has no attribute 'clearJobGroup' 985118e [fwang12] escape for python f7250c1 [fwang12] revert withLocalProperties 13228f9 [fwang12] debug e318c69 [fwang12] Revert "prevent timeout" f81c605 [fwang12] prevent timeout 2ca5339 [fwang12] test 1390b0f [fwang12] remove not needed 26ee602 [fwang12] remove not needed 93c08ff [fwang12] debug Authored-by: fwang12 <fwang12@ebay.com> Signed-off-by: fwang12 <fwang12@ebay.com>
- Loading branch information