Class: RocketJob::Jobs::CopyFileJob

Inherits:
RocketJob::Job show all
Includes:
Plugins::Retry
Defined in:
lib/rocket_job/jobs/copy_file_job.rb

Instance Method Summary collapse

Methods included from Plugins::Retry

#rocket_job_failure_count, #rocket_job_retry_on_fail?

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

#create_restart!, #reload, #save_with_retry!

Methods included from Plugins::Job::Model

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

Instance Method Details

#performObject



57
58
59
60
61
62
63
64
65
# File 'lib/rocket_job/jobs/copy_file_job.rb', line 57

def perform
  if source_data
    target_path.write(source_data)
  elsif target_url
    target_path.copy_from(source_path)
  end

  self.percent_complete = 100
end

#source_pathObject



67
68
69
70
71
# File 'lib/rocket_job/jobs/copy_file_job.rb', line 67

def source_path
  source = IOStreams.path(source_url, **decode_args(source_args))
  apply_streams(source, source_streams)
  source
end

#target_pathObject



73
74
75
76
77
# File 'lib/rocket_job/jobs/copy_file_job.rb', line 73

def target_path
  target = IOStreams.path(target_url, **decode_args(target_args))
  apply_streams(target, target_streams)
  target
end