summaryrefslogtreecommitdiff
path: root/lib/task.rb
diff options
context:
space:
mode:
authorMartin Gütlein <martin.guetlein@gmail.com>2010-04-27 12:18:35 +0200
committerMartin Gütlein <martin.guetlein@gmail.com>2010-04-27 12:18:35 +0200
commit9f61630a6fadb0f4050eff8912f6c250924f6055 (patch)
tree80d538833e96b362ec591f0f243d8267caef013a /lib/task.rb
parentac5a07c294bba699d6517d5be1548a33455b87c8 (diff)
readded pid for tasks
Diffstat (limited to 'lib/task.rb')
-rw-r--r--lib/task.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/task.rb b/lib/task.rb
index 178f744..03d5330 100644
--- a/lib/task.rb
+++ b/lib/task.rb
@@ -82,6 +82,10 @@ module OpenTox
RestClientWrapper.put(File.join(@uri,'Error'),{:description => description})
reload
end
+
+ def pid=(pid)
+ RestClientWrapper.put(File.join(@uri,'pid'), {:pid => pid})
+ end
def running?
@hasStatus.to_s == 'Running'
@@ -120,7 +124,7 @@ module OpenTox
#return yield nil
task = OpenTox::Task.create(max_duration)
- Spork.spork(:logger => LOGGER) do
+ task_pid = Spork.spork(:logger => LOGGER) do
LOGGER.debug "Task #{task.uri} started #{Time.now}"
$self_task = task
@@ -141,6 +145,7 @@ module OpenTox
task.error(ex.message)
end
end
+ task.pid = task_pid
LOGGER.debug "Started task: "+task.uri.to_s
task.uri
end