Class: Blender::Task::SerfAsync

Inherits:
Base
  • Object
show all
Defined in:
lib/blender/tasks/serf_async.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ SerfAsync

Returns a new instance of SerfAsync.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/blender/tasks/serf_async.rb', line 24

def initialize(name, options = {})
  super
  @start_query = Blender::Task::Serf.new(name)
  @start_query.payload([:start])
  @start_query.timeout([:timeout])
  @start_query.no_ack([:no_ack])
  @start_query.process(&[:process])

  @stop_query = Blender::Task::Serf.new(name)
  @stop_query.payload([:stop])
  @stop_query.timeout([:timeout])
  @stop_query.no_ack([:no_ack])
  @stop_query.process(&[:process])

  @check_query = Blender::Task::Serf.new(name)
  @check_query.payload([:check])
  @check_query.timeout([:timeout])
  @check_query.no_ack([:no_ack])
  @check_query.process(&[:process])
end

Instance Attribute Details

#check_queryObject (readonly)

Returns the value of attribute check_query.



22
23
24
# File 'lib/blender/tasks/serf_async.rb', line 22

def check_query
  @check_query
end

#start_queryObject (readonly)

Returns the value of attribute start_query.



22
23
24
# File 'lib/blender/tasks/serf_async.rb', line 22

def start_query
  @start_query
end

#stop_queryObject (readonly)

Returns the value of attribute stop_query.



22
23
24
# File 'lib/blender/tasks/serf_async.rb', line 22

def stop_query
  @stop_query
end

Instance Method Details

#check(&block) ⇒ Object



53
54
55
# File 'lib/blender/tasks/serf_async.rb', line 53

def check(&block)
  @check_query.instance_eval(&block)
end

#commandObject



60
61
# File 'lib/blender/tasks/serf_async.rb', line 60

def command
end

#default_metadataObject



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/blender/tasks/serf_async.rb', line 67

def 
  {
    ignore_failure: false,
    start: 'start',
    stop: 'stop',
    check: 'check',
    timeout: 5,
    no_ack: false,
    process: nil,
    retry_options: { max_elapsed_time: 180 }
  }
end

#executeObject



57
58
# File 'lib/blender/tasks/serf_async.rb', line 57

def execute
end

#retry_options(options = {}) ⇒ Object



63
64
65
# File 'lib/blender/tasks/serf_async.rb', line 63

def retry_options(options = {})
  @metadata[:retry_options].merge!(options)
end

#start(&block) ⇒ Object



45
46
47
# File 'lib/blender/tasks/serf_async.rb', line 45

def start(&block)
  @start_query.instance_eval(&block)
end

#stop(&block) ⇒ Object



49
50
51
# File 'lib/blender/tasks/serf_async.rb', line 49

def stop(&block)
  @stop_query.instance_eval(&block)
end