Class: Exekutor::Internal::CLI::Cleanup
- Inherits:
-
Object
- Object
- Exekutor::Internal::CLI::Cleanup
- Includes:
- ApplicationLoader
- Defined in:
- lib/exekutor/internal/cli/cleanup.rb
Overview
Cleanup for the CLI
Constant Summary
Constants included from ApplicationLoader
ApplicationLoader::LOADING_MESSAGE
Instance Method Summary collapse
-
#cleanup_jobs(options) ⇒ Object
Cleans up the jobs table.
-
#cleanup_workers(options) ⇒ Object
Cleans up the workers table.
-
#initialize(options) ⇒ Cleanup
constructor
A new instance of Cleanup.
Methods included from ApplicationLoader
#clear_application_loading_message, #different_time_zone?, #load_application, #print_time_zone_warning
Constructor Details
#initialize(options) ⇒ Cleanup
Returns a new instance of Cleanup.
16 17 18 |
# File 'lib/exekutor/internal/cli/cleanup.rb', line 16 def initialize() @global_options = end |
Instance Method Details
#cleanup_jobs(options) ⇒ Object
Cleans up the jobs table
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/exekutor/internal/cli/cleanup.rb', line 38 def cleanup_jobs() load_application [:environment], print_message: !quiet? ActiveSupport.on_load(:active_record, yield: true) do print_time_zone_warning if different_time_zone? && !quiet? timeout = job_cleanup_timeout() purged_count = cleaner.cleanup_jobs before: timeout.hours.ago, status: job_cleanup_statuses() print_job_cleanup_result(, purged_count) unless quiet? end end |
#cleanup_workers(options) ⇒ Object
Cleans up the workers table
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/exekutor/internal/cli/cleanup.rb', line 22 def cleanup_workers() load_application [:environment], print_message: !quiet? ActiveSupport.on_load(:active_record, yield: true) do print_time_zone_warning if different_time_zone? && !quiet? timeout = worker_cleanup_timeout() workers = cleaner.cleanup_workers timeout: timeout.hours print_worker_cleanup_result(, workers) unless quiet? end end |