You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/26 05:25:03 UTC

[GitHub] [kyuubi] turboFei opened a new pull request, #4028: debug

turboFei opened a new pull request, #4028:
URL: https://github.com/apache/kyuubi/pull/4028

   <!--
   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://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a 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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei commented on pull request #4028: debug

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365174714

   <img width="1315" alt="image" src="https://user-images.githubusercontent.com/6757692/209553759-e718dd2f-14f1-4d18-b2d0-d99162938737.png">
   
   out of sequence


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei commented on pull request #4028: debug

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365147450

   ```
   {"code":"spark.sparkContext.setJobGroup('991250a5-0cb6-42c0-b438-160133616a2d', '\nspark.sql(\"set hello=kyuubi\").show()\n', True)","cmd":"run_code"} -> {"msg_type": "execute_reply", "content": {"ename": "SyntaxError", "evalue": "EOL while scanning string literal (<stdin>, line 1)", "traceback": ["  File \"<stdin>\", line 1\n", "    spark.sparkContext.setJobGroup('991250a5-0cb6-42c0-b438-160133616a2d', '\n", "                                                                            ^\n", "SyntaxError: EOL while scanning string literal\n"], "status": "error"}}
   
   ```


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei commented on pull request #4028: debug

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1364940974

   <img width="1329" alt="image" src="https://user-images.githubusercontent.com/6757692/209514783-51be26f5-5bad-4949-bde2-a8325069ba6d.png">
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] cfmcgrady commented on pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
cfmcgrady commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365555737

   thank you for the fix. cc @bowenliang123 @pan3793 


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei commented on pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365555039

   all UT passed. @cfmcgrady 


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] bowenliang123 commented on pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
bowenliang123 commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365577450

   late LGTM, thx for the fix.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei closed pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
turboFei closed pull request #4028: [PYSPARK] Fix internal python code issue
URL: https://github.com/apache/kyuubi/pull/4028


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] turboFei commented on pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#issuecomment-1365572949

   thanks, merging 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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #4028: [PYSPARK] Fix internal python code issue

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #4028:
URL: https://github.com/apache/kyuubi/pull/4028#discussion_r1057407347


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/ExecutePython.scala:
##########
@@ -168,15 +176,38 @@ case class SessionPythonWorker(
   private val stdin: PrintWriter = new PrintWriter(workerProcess.getOutputStream)
   private val stdout: BufferedReader =
     new BufferedReader(new InputStreamReader(workerProcess.getInputStream), 1)
+  private val lock = new ReentrantLock()
 
-  def runCode(code: String): Option[PythonResponse] = {
+  private def withLockRequired[T](block: => T): T = {
+    try {
+      lock.lock()
+      block
+    } finally lock.unlock()
+  }
+
+  /**
+   * Run the python code and return the response. This method maybe invoked internally,
+   * such as setJobGroup and cancelJobGroup, if the internal python is not formatted correct,
+   * it might impact the code correctness and even cause result out of sequence. To prevent that,
+   * please make sure the internal python code simple and set internal flay, to be aware of the

Review Comment:
   typo? flay => flag



##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/ExecutePython.scala:
##########
@@ -129,14 +130,20 @@ class ExecutePython(
   override def setSparkLocalProperty: (String, String) => Unit =
     (key: String, value: String) => {
       val valueStr = if (value == null) "None" else s"'$value'"
-      worker.runCode(s"spark.sparkContext.setLocalProperty('$key', $valueStr)")
+      worker.runCode(s"spark.sparkContext.setLocalProperty('$key', $valueStr)", internal = true)
       ()
     }
 
   override protected def withLocalProperties[T](f: => T): T = {
     try {
-      worker.runCode("spark.sparkContext.setJobGroup" +
-        s"($statementId, $redactedStatement, $forceCancel)")
+      // to prevent the transferred set job group python code broken
+      val jobDesc = s"Python statement: $statementId"
+      // for python, the boolean value is capitalized
+      val pythonForceCancel = forceCancel.toString.capitalize

Review Comment:
   ```suggestion
         val pythonForceCancel = if (forceCancel) "True" else "False"
   ```



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org