namanmishra91 opened a new pull request #307:
URL: https://github.com/apache/incubator-livy/pull/307


   ## What changes were proposed in this pull request?
   Currently, cancelling a statement on an interactive session only cancels the 
jobs running on Spark executors but anything running on the Driver keeps 
running and keeps the session busy. This can be seen by running a sleep in code 
and running something immediately after cancelling it. This change fixes the 
cancellation of such tasks for Scala and Python interpreters.
   
   https://issues.apache.org/jira/projects/LIVY/issues/LIVY-786
   
   ## How was this patch tested?
   Tested manually on local setup. Sequence of steps followed:
   For Python:
   `curl localhost:8998/sessions/0/statements -X POST -H 'Content-Type: 
application/json' -d '{"code":"import time\ntime.sleep(60)"}'
   curl -X POST localhost:8998/sessions/0/statements/0/cancel
   curl localhost:8998/sessions/0/statements -X POST -H 'Content-Type: 
application/json' -d '{"code":"print(\"hello\")"}'`
   
   The result of second statement was available immediately, meaning that the 
repl was free.
   
   For Scala:
   `curl localhost:8998/sessions/0/statements -X POST -H 'Content-Type: 
application/json' -d '{"code":"Thread.sleep(60000)", "kind":"scala"}'
   curl -X POST localhost:8998/sessions/0/statements/2/cancel
   curl localhost:8998/sessions/0/statements -X POST -H 'Content-Type: 
application/json' -d '{"code":"val a=1", "kind":"scala"}'`
   
   Similar result seen as above. 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to