summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2019-07-12 10:50:51 +0000
committergebele <gebele@in-silico.ch>2019-07-12 10:50:51 +0000
commit592fa64120e2712c46dd020fbda0c128c69467b7 (patch)
treeff0d3a2d7e55361e6ecc85010887e81e87b89826 /application.rb
parent5490f6214f3a22216f7980c7d46f6d9fe10a4924 (diff)
kill task pid if page is reloaded
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/application.rb b/application.rb
index 76137b9..0d5da57 100644
--- a/application.rb
+++ b/application.rb
@@ -221,6 +221,14 @@ get '/prediction/task/?' do
task = Task.find(params[:turi].to_s)
response['Content-Type'] = "application/json"
return JSON.pretty_generate(:percent => task.percent)
+ elsif params[:ktpid]
+ begin
+ Process.kill(9,params[:ktpid].to_i) if !params[:ktpid].blank?
+ rescue
+ nil
+ end
+ response['Content-Type'] = "application/json"
+ return JSON.pretty_generate(:ktpid => params[:ktpid])
elsif params[:predictions]
task = Task.find(params[:predictions])
pageSize = params[:pageSize].to_i - 1