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

#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



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

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



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

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

#target_pathObject



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

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