Class: ColdpCreateDownloadJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/coldp_create_download_job.rb

Instance Method Summary collapse

Instance Method Details

#max_attemptsObject



8
9
10
# File 'app/jobs/coldp_create_download_job.rb', line 8

def max_attempts
  2
end

#max_run_timeObject



4
5
6
# File 'app/jobs/coldp_create_download_job.rb', line 4

def max_run_time
  1.hour
end

#perform(otu, download, prefer_unlabelled_otus: false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'app/jobs/coldp_create_download_job.rb', line 12

def perform(otu, download, prefer_unlabelled_otus: false)
  begin
    download.source_file_path = ::Export::Coldp.export(otu.id, prefer_unlabelled_otus: prefer_unlabelled_otus)
    download.save
  rescue => ex
    ExceptionNotifier.notify_exception(ex,
      data: { otu: otu&.id&.to_s, download: download&.id&.to_s }
    )
    raise
  end
end