diff options
author | Christoph Helma <helma@in-silico.de> | 2010-01-31 19:09:16 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2010-01-31 19:09:16 +0100 |
commit | c9d820e767a6baf6ae6fba2bb6b2e3641253b5c4 (patch) | |
tree | f55a2d4a218d1b2a6b2f909123c4bb9d3a85ed53 /lib/task.rb | |
parent | 09974c5a920bbb07475d8e48a725ef3780e60dbe (diff) |
Upload facilities added, Ambit disabled
Diffstat (limited to 'lib/task.rb')
-rw-r--r-- | lib/task.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/task.rb b/lib/task.rb index e50a982..24bd944 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -22,6 +22,11 @@ module OpenTox @@config[:services]["opentox-task"] end + def self.all + task_uris = RestClient.get(@@config[:services]["opentox-task"]).split(/\n/) + task_uris.collect{|uri| Task.new(uri)} + end + def started #LOGGER.info File.join(@uri,'started') RestClient.put File.join(@uri,'started'), {} @@ -35,6 +40,14 @@ module OpenTox RestClient.put File.join(@uri,'completed'), :resource => uri end + def created_at + RestClient.get File.join(@uri, 'created_at') + end + + def finished_at + RestClient.get File.join(@uri, 'finished_at') + end + def status RestClient.get File.join(@uri, 'status') end @@ -42,6 +55,10 @@ module OpenTox def resource RestClient.get File.join(@uri, 'resource') end + + def pid=(pid) + RestClient.put File.join(@uri, 'pid'), :pid => pid + end def completed? self.status.to_s == 'completed' @@ -49,7 +66,7 @@ module OpenTox def wait_for_completion until self.completed? - sleep 0.1 + sleep 1 end end |