Class: Hammer::CronServer::Job
- Inherits:
-
Struct
- Object
- Struct
- Hammer::CronServer::Job
- Defined in:
- lib/hammer/cron_server.rb
Overview
One scheduled task. pid doubles as the running flag: nil when
idle, :starting between due-check and spawn, then the child pid.
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#exit_code ⇒ Object
Returns the value of attribute exit_code.
-
#last_run ⇒ Object
Returns the value of attribute last_run.
-
#path ⇒ Object
Returns the value of attribute path.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#schedule ⇒ Object
Returns the value of attribute schedule.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#file_slug ⇒ Object
Log-safe file name: 'db:backup' -> 'db-backup'.
- #running? ⇒ Boolean
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def command @command end |
#duration ⇒ Object
Returns the value of attribute duration
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def duration @duration end |
#exit_code ⇒ Object
Returns the value of attribute exit_code
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def exit_code @exit_code end |
#last_run ⇒ Object
Returns the value of attribute last_run
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def last_run @last_run end |
#path ⇒ Object
Returns the value of attribute path
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def path @path end |
#pid ⇒ Object
Returns the value of attribute pid
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def pid @pid end |
#schedule ⇒ Object
Returns the value of attribute schedule
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def schedule @schedule end |
#status ⇒ Object
Returns the value of attribute status
22 23 24 |
# File 'lib/hammer/cron_server.rb', line 22 def status @status end |
Instance Method Details
#file_slug ⇒ Object
Log-safe file name: 'db:backup' -> 'db-backup'.
29 30 31 |
# File 'lib/hammer/cron_server.rb', line 29 def file_slug path.tr(':', '-').gsub(/[^\w.-]/, '-') end |
#running? ⇒ Boolean
24 25 26 |
# File 'lib/hammer/cron_server.rb', line 24 def running? !pid.nil? end |