Class: SampleAccessioningJob
- Inherits:
-
Struct
- Object
- Struct
- SampleAccessioningJob
- Defined in:
- app/jobs/sample_accessioning_job.rb
Overview
Sends sample data to the ENA or EGA in order to generate an accession number Records the generated accession number on the sample
Instance Attribute Summary collapse
-
#accessionable ⇒ Object
Returns the value of attribute accessionable.
Instance Method Summary collapse
- #max_attempts ⇒ Object
- #perform ⇒ Object
- #queue_name ⇒ Object
- #reschedule_at(current_time, _attempts) ⇒ Object
Instance Attribute Details
#accessionable ⇒ Object
Returns the value of attribute accessionable
8 9 10 |
# File 'app/jobs/sample_accessioning_job.rb', line 8 def accessionable @accessionable end |
Instance Method Details
#max_attempts ⇒ Object
27 28 29 |
# File 'app/jobs/sample_accessioning_job.rb', line 27 def max_attempts 3 end |
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/jobs/sample_accessioning_job.rb', line 10 def perform submission = Accession::Submission.new(User.find_by(api_key: configatron.accession_local_key), accessionable) submission.post # update_accession_number returns true if an accession has been supplied, and the sample has been saved. # If this returns false, then we fail the job. This should catch any failure situations cause = 'EBI failed to update accession number, data may be invalid' submission.update_accession_number || raise_accession_error(submission, cause) rescue AccessionService::AccessionServiceError => e handle_accession_error(e, submission, cause) end |
#queue_name ⇒ Object
31 32 33 |
# File 'app/jobs/sample_accessioning_job.rb', line 31 def queue_name 'sample_accessioning' end |
#reschedule_at(current_time, _attempts) ⇒ Object
23 24 25 |
# File 'app/jobs/sample_accessioning_job.rb', line 23 def reschedule_at(current_time, _attempts) current_time + 1.day end |