Class: Semaph::Shells::Pipeline::JobsPollCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/shells/pipeline/jobs_poll_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_collection, list_command) ⇒ JobsPollCommand

Returns a new instance of JobsPollCommand.



9
10
11
12
13
14
# File 'lib/semaph/shells/pipeline/jobs_poll_command.rb', line 9

def initialize(job_collection, list_command)
  @job_collection = job_collection
  @list_command = list_command
  @help = "poll jobs"
  @can_notify = !`which terminal-notifier`.chomp.empty?
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



7
8
9
# File 'lib/semaph/shells/pipeline/jobs_poll_command.rb', line 7

def help
  @help
end

#job_collectionObject (readonly)

Returns the value of attribute job_collection.



7
8
9
# File 'lib/semaph/shells/pipeline/jobs_poll_command.rb', line 7

def job_collection
  @job_collection
end

#usageObject (readonly)

Returns the value of attribute usage.



7
8
9
# File 'lib/semaph/shells/pipeline/jobs_poll_command.rb', line 7

def usage
  @usage
end

Instance Method Details

#execute(_whatever = nil) ⇒ Object



16
17
18
19
20
# File 'lib/semaph/shells/pipeline/jobs_poll_command.rb', line 16

def execute(_whatever = nil)
  puts "Polling #{job_collection.pipeline.workflow.description}:"
  report_and_reload(15) while job_collection.incomplete.count.positive? && job_collection.failed.count.zero?
  report_final
end