Class: Patriot::JobStore::JobTicket

Inherits:
Object
  • Object
show all
Defined in:
lib/patriot/job_store/job_ticket.rb

Overview

a ticket to execute a job.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_id, update_id, node = nil) ⇒ JobTicket

Returns a new instance of JobTicket.

Parameters:

  • job_id (String)
  • update_id (Integer)
  • node (String) (defaults to: nil)

    the name of node on which the job should be executed



15
16
17
18
19
20
# File 'lib/patriot/job_store/job_ticket.rb', line 15

def initialize(job_id, update_id, node=nil)
  raise "job_id should be Symbol but #{job_id} is a #{job_id.class}" unless job_id.is_a?(String)
  @job_id    = job_id
  @update_id = update_id
  @node      = node
end

Instance Attribute Details

#descriptionObject

attributes for completion



10
11
12
# File 'lib/patriot/job_store/job_ticket.rb', line 10

def description
  @description
end

#exec_hostObject

attributes for offer



8
9
10
# File 'lib/patriot/job_store/job_ticket.rb', line 8

def exec_host
  @exec_host
end

#exec_nodeObject

attributes for offer



8
9
10
# File 'lib/patriot/job_store/job_ticket.rb', line 8

def exec_node
  @exec_node
end

#exec_threadObject

attributes for offer



8
9
10
# File 'lib/patriot/job_store/job_ticket.rb', line 8

def exec_thread
  @exec_thread
end

#execution_idObject

attributes for offer



8
9
10
# File 'lib/patriot/job_store/job_ticket.rb', line 8

def execution_id
  @execution_id
end

#exit_codeObject

attributes for completion



10
11
12
# File 'lib/patriot/job_store/job_ticket.rb', line 10

def exit_code
  @exit_code
end

#job_idObject

default attributes



6
7
8
# File 'lib/patriot/job_store/job_ticket.rb', line 6

def job_id
  @job_id
end

#nodeObject

default attributes



6
7
8
# File 'lib/patriot/job_store/job_ticket.rb', line 6

def node
  @node
end

#update_idObject

default attributes



6
7
8
# File 'lib/patriot/job_store/job_ticket.rb', line 6

def update_id
  @update_id
end

Instance Method Details

#to_sString

Returns string expression of this instance

Returns:

  • (String)

    returns string expression of this instance



23
24
25
26
27
# File 'lib/patriot/job_store/job_ticket.rb', line 23

def to_s
  node = @node.nil? ? "any" : @node
  string = "job_id: #{job_id}, update_id: #{update_id}, node: #{node}"
  return string
end