summaryrefslogtreecommitdiff
path: root/lib/task.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-02-15 12:23:52 +0100
committerChristoph Helma <helma@in-silico.ch>2013-02-15 12:23:52 +0100
commitdee8892491dcda0bfa68c413ee0fbbc0ddd33f12 (patch)
treec85da4fdda99e9a434bf694e8ec4b31cd5c29134 /lib/task.rb
parent83f4b12aaacfd27e7019517ac7089ddd912ba259 (diff)
error messages in tasks fixed
Diffstat (limited to 'lib/task.rb')
-rw-r--r--lib/task.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/task.rb b/lib/task.rb
index 315dc18..3d427bc 100644
--- a/lib/task.rb
+++ b/lib/task.rb
@@ -92,27 +92,30 @@ module OpenTox
while running?
sleep dur
dur = [[(Time.new - start_time)/20.0,0.3].max,300.0].min
- time_out_error "max wait time exceeded ("+DEFAULT_TASK_MAX_DURATION.to_s+"sec), task: '"+@uri.to_s+"'" if (Time.new > due_to_time)
+ request_timeout_error "max wait time exceeded ("+DEFAULT_TASK_MAX_DURATION.to_s+"sec), task: '"+@uri.to_s+"'" if (Time.new > due_to_time)
end
end
end
+ def code
+ RestClientWrapper.head(@uri).code.to_i
+ end
+
# get only header for status requests
def running?
- RestClientWrapper.head(@uri).code == 202
+ code == 202
end
def cancelled?
- RestClientWrapper.head(@uri).code == 503
+ code == 503
end
def completed?
- RestClientWrapper.head(@uri).code == 200
+ code == 200
end
def error?
- code = RestClientWrapper.head(@uri).code
code >= 400 and code != 503
end