Module: MaintenanceTasks
- Defined in:
- lib/maintenance_tasks.rb,
lib/maintenance_tasks/cli.rb,
lib/maintenance_tasks/engine.rb,
app/models/maintenance_tasks/run.rb,
app/models/maintenance_tasks/task.rb,
app/jobs/maintenance_tasks/task_job.rb,
app/models/maintenance_tasks/runner.rb,
app/models/maintenance_tasks/ticker.rb,
app/models/maintenance_tasks/progress.rb,
app/models/maintenance_tasks/runs_page.rb,
app/helpers/maintenance_tasks/tasks_helper.rb,
app/models/maintenance_tasks/task_data_show.rb,
app/models/maintenance_tasks/task_data_index.rb,
app/models/maintenance_tasks/application_record.rb,
lib/generators/maintenance_tasks/task_generator.rb,
app/helpers/maintenance_tasks/application_helper.rb,
app/controllers/maintenance_tasks/runs_controller.rb,
app/models/concerns/maintenance_tasks/run_concern.rb,
app/controllers/maintenance_tasks/tasks_controller.rb,
app/models/maintenance_tasks/no_collection_builder.rb,
lib/generators/maintenance_tasks/install_generator.rb,
app/models/maintenance_tasks/csv_collection_builder.rb,
app/jobs/concerns/maintenance_tasks/task_job_concern.rb,
app/models/maintenance_tasks/null_collection_builder.rb,
app/validators/maintenance_tasks/run_status_validator.rb,
app/controllers/maintenance_tasks/application_controller.rb,
app/models/maintenance_tasks/batch_csv_collection_builder.rb
Overview
The engine’s namespace module. It provides isolation between the host application’s code and the engine-specific code. Top-level engine constants and variables are defined under this module.
Defined Under Namespace
Modules: ApplicationHelper, RunConcern, Runner, TaskJobConcern, TasksHelper Classes: ApplicationController, ApplicationRecord, BatchCsvCollectionBuilder, CLI, CsvCollectionBuilder, Engine, InstallGenerator, NoCollectionBuilder, NullCollectionBuilder, Progress, Run, RunStatusValidator, RunsController, RunsPage, Task, TaskDataIndex, TaskDataShow, TaskGenerator, TaskJob, TasksController, Ticker
Class Attribute Summary collapse
-
.active_storage_service ⇒ Symbol
The Active Storage service to use for uploading CSV file blobs.
-
.backtrace_cleaner ⇒ ActiveSupport::BacktraceCleaner?
The Active Support backtrace cleaner that will be used to clean the backtrace of a Task that errors.
-
.job ⇒ String
The name of the job to be used to perform Tasks.
-
.parent_controller ⇒ String
The parent controller all web UI controllers will inherit from.
-
.report_errors_as_handled ⇒ Boolean
How unexpected errors are reported to Rails.error.report.
-
.serialize_cursors_as_json ⇒ Boolean
Controls whether or not cursor values are stored as JSON in the database.
-
.status_reload_frequency ⇒ ActiveSupport::Duration, Numeric
The frequency at which to reload the run status during iteration.
-
.stuck_task_duration ⇒ ActiveSupport::Duration
The duration after which a task is considered stuck and can be force cancelled.
-
.task_staleness_threshold ⇒ ActiveSupport::Duration, false
The threshold after which a task is considered stale.
-
.tasks_module ⇒ String
The module to namespace Tasks in, as a String.
-
.ticker_delay ⇒ ActiveSupport::Duration, Numeric
The delay between updates to the tick count.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.deprecator ⇒ Object
@api-private.
- .error_handler ⇒ Object deprecated Deprecated.
- .error_handler=(proc) ⇒ Object deprecated Deprecated.
Class Attribute Details
.active_storage_service ⇒ Symbol
The Active Storage service to use for uploading CSV file blobs.
52 |
# File 'lib/maintenance_tasks.rb', line 52 mattr_accessor :active_storage_service |
.backtrace_cleaner ⇒ ActiveSupport::BacktraceCleaner?
The Active Support backtrace cleaner that will be used to clean the backtrace of a Task that errors.
62 |
# File 'lib/maintenance_tasks.rb', line 62 mattr_accessor :backtrace_cleaner |
.job ⇒ String
The name of the job to be used to perform Tasks. Defaults to ‘“MaintenanceTasks::TaskJob”`. This job must be either a class that inherits from TaskJob or a class that includes TaskJobConcern.
30 |
# File 'lib/maintenance_tasks.rb', line 30 mattr_accessor :job, default: "MaintenanceTasks::TaskJob" |
.parent_controller ⇒ String
The parent controller all web UI controllers will inherit from. Must be a class that inherits from ‘ActionController::Base`. Defaults to `“ActionController::Base”`
72 |
# File 'lib/maintenance_tasks.rb', line 72 mattr_accessor :parent_controller, default: "ActionController::Base" |
.report_errors_as_handled ⇒ Boolean
How unexpected errors are reported to Rails.error.report.
When an error occurs that isn’t explicitly handled (e.g., via ‘report_on`), it gets reported to Rails.error.report. This setting determines whether these errors are marked as “handled” or “unhandled”.
The current default of ‘true` is for backwards compatibility, but it prevents error subscribers from distinguishing between expected and unexpected errors. Setting this to `false` provides more accurate error reporting and will become the default in v3.0.
110 |
# File 'lib/maintenance_tasks.rb', line 110 mattr_accessor :report_errors_as_handled, default: true |
.serialize_cursors_as_json ⇒ Boolean
Controls whether or not cursor values are stored as JSON in the database. Defaults to false.
Storing cursors as JSON enables more complex cursor structures. For example, with JSON cursors a task can iterate over collections using multiple fields or columns to track progress. This is particularly useful for iterating over models with composite primary keys.
Be advised that this feature comes with a few caveats:
-
Cursor values must be capable of being serialized to JSON and parsed from JSON. If they are not, errors will occur during task execution.
-
If a cursor contains a value that loses precision when serialized, it may lead to unexpected behaviour.
-
This feature utilizes a string column to store the JSON data. If your database has a hard limit on how big a string value can be, be mindful that certain cursor structures could result in a value that could exceed that limit and cause issues.
A new column was added to discern JSON cursors from plain string cursors. Make sure you have run the latest database migrations provided by the gem before enabling this feature.
138 |
# File 'lib/maintenance_tasks.rb', line 138 mattr_accessor :serialize_cursors_as_json, default: false |
.status_reload_frequency ⇒ ActiveSupport::Duration, Numeric
The frequency at which to reload the run status during iteration. Defaults to 1 second, meaning reload status every second.
94 |
# File 'lib/maintenance_tasks.rb', line 94 mattr_accessor :status_reload_frequency, default: 1.second |
.stuck_task_duration ⇒ ActiveSupport::Duration
The duration after which a task is considered stuck and can be force cancelled.
86 |
# File 'lib/maintenance_tasks.rb', line 86 mattr_accessor :stuck_task_duration, default: 5.minutes |
.task_staleness_threshold ⇒ ActiveSupport::Duration, false
The threshold after which a task is considered stale. Defaults to 30 days. Can be disabled by setting this to ‘false`.
146 |
# File 'lib/maintenance_tasks.rb', line 146 mattr_accessor :task_staleness_threshold, default: 30.days |
.tasks_module ⇒ String
The module to namespace Tasks in, as a String. Defaults to ‘Maintenance’.
20 |
# File 'lib/maintenance_tasks.rb', line 20 mattr_accessor :tasks_module, default: "Maintenance" |
.ticker_delay ⇒ ActiveSupport::Duration, Numeric
The delay between updates to the tick count. After each iteration, the progress of the Task may be updated. This duration in seconds limits these updates, skipping if the duration since the last update is lower than this value, except if the job is interrupted, in which case the progress will always be recorded.
43 |
# File 'lib/maintenance_tasks.rb', line 43 mattr_accessor :ticker_delay, default: 1.second |
Instance Attribute Details
#metadata ⇒ Object
79 |
# File 'lib/maintenance_tasks.rb', line 79 mattr_accessor :metadata, default: nil |
Class Method Details
.deprecator ⇒ Object
@api-private
169 170 171 |
# File 'lib/maintenance_tasks.rb', line 169 def deprecator @deprecator ||= ActiveSupport::Deprecation.new("3.0", "MaintenanceTasks") end |
.error_handler ⇒ Object
155 156 157 158 159 |
# File 'lib/maintenance_tasks.rb', line 155 def error_handler deprecator.warn(DEPRECATION_MESSAGE) @error_handler end |
.error_handler=(proc) ⇒ Object
162 163 164 165 166 |
# File 'lib/maintenance_tasks.rb', line 162 def error_handler=(proc) deprecator.warn(DEPRECATION_MESSAGE) @error_handler = proc end |