Class: RocketJob::Jobs::DirmonJob

Inherits:
RocketJob::Job show all
Includes:
Plugins::Restart, Plugins::Singleton
Defined in:
lib/rocket_job/jobs/dirmon_job.rb

Overview

Note:

  • Jobs that do not implement #upload must have either ‘upload_file_name` or `full_file_name` as an attribute.

With RocketJob Pro, the file is automatically uploaded into the job itself using the job’s #upload method, after which the file is archived or deleted if no archive_directory was specified in the DirmonEntry.

To start Dirmon for the first time

RocketJob::Jobs::DirmonJob.create!

If another DirmonJob instance is already queued or running, then the create above will fail with:

MongoMapper::DocumentNotValid: Validation failed: State Another instance of this job is already queued or running

Or to start DirmonJob and ignore errors if already running

RocketJob::Jobs::DirmonJob.create

Instance Method Summary collapse

Methods included from Plugins::Singleton

#rocket_job_singleton_active?

Methods included from Plugins::Job::Throttle

#throttle_filter_class, #throttle_filter_id

Methods included from Plugins::Job::Worker

#fail_on_exception!, #perform_now, #rocket_job_active_workers, #rocket_job_work

Methods included from Plugins::Job::StateMachine

#pausable?

Methods included from Plugins::Job::Persistence

#reload

Methods included from Plugins::Job::Model

#as_json, #collect_nil_output?, #collect_output?, #duration, #expired?, #run_now!, #scheduled?, #scheduled_at, #seconds, #sleeping?, #status, #worker_count, #worker_names, #worker_on_server?

Instance Method Details

#performObject

Iterate over each Dirmon entry looking for new files If a new file is found, it is not processed immediately, instead it is passed to the next run of this job along with the file size. If the file size has not changed, the Job is kicked off.



57
58
59
# File 'lib/rocket_job/jobs/dirmon_job.rb', line 57

def perform
  check_directories
end