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, marathon_instance = Marathon.singleton) ⇒ Queue

Create a new queue element object. hash: Hash returned by API, including ‘app’ and ‘delay’ marathon_instance: MarathonInstance holding a connection to marathon



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

def initialize(hash, marathon_instance = Marathon.singleton)
  super(hash, %w[delay])
  @app = Marathon::App.new(info[:app], marathon_instance, true)
  @marathon_instance = marathon_instance
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.



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

def list
  Marathon.singleton.queues.list
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/marathon/queue.rb', line 16

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