Class: Marathon::Queue

Inherits:
Base
  • Object
show all
Defined in:
lib/marathon/queue.rb

Overview

This class represents a Marathon Queue element. See mesosphere.github.io/marathon/docs/rest-api.html#queue for full list of API’s methods.

Instance Attribute Summary collapse

Attributes inherited from Base

#info

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Methods included from Error

error_class, error_message, from_response

Constructor Details

#initialize(hash) ⇒ Queue

Create a new queue element object. hash: Hash returned by API, including ‘app’ and ‘delay’



9
10
11
12
# File 'lib/marathon/queue.rb', line 9

def initialize(hash)
  super(hash, %w[delay])
  @app = Marathon::App.new(info[:app], true)
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



5
6
7
# File 'lib/marathon/queue.rb', line 5

def app
  @app
end

Class Method Details

.listObject

Show content of the task queue. Returns Array of Queue objects.



22
23
24
25
# File 'lib/marathon/queue.rb', line 22

def list
  json = Marathon.connection.get('/v2/queue')['queue']
  json.map { |j| new(j) }
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/marathon/queue.rb', line 14

def to_s
  "Marathon::Queue { :appId => #{app.id} :delay => #{delay} }"
end