Class: ChronosEndpoint

Inherits:
Object
  • Object
show all
Includes:
HTTPUtils, Utils
Defined in:
lib/panteras_api/chronos_endpoint.rb

Instance Method Summary collapse

Methods included from Utils

fully_qualified_hostname, hostname

Methods included from HTTPUtils

#construct_uri, #get_response_with_redirect, #to_j, #valid_url

Constructor Details

#initialize(host, port = 4400) ⇒ ChronosEndpoint



5
6
7
8
# File 'lib/panteras_api/chronos_endpoint.rb', line 5

def initialize(host, port=4400)
  @host = host
  @port = port
end

Instance Method Details

#all_appsObject



10
11
12
13
14
15
16
# File 'lib/panteras_api/chronos_endpoint.rb', line 10

def all_apps
  begin
    to_j(get_response_with_redirect(@host, '/scheduler/jobs', @port))
  rescue Errno::ECONNREFUSED => e
    to_j('[]')
  end
end

#my_task_ids(hostname, framework = 'chronos') ⇒ Object



18
19
20
# File 'lib/panteras_api/chronos_endpoint.rb', line 18

def my_task_ids(hostname, framework = 'chronos')
  all_apps.collect { |a| a[:name][0..-1] }
end