Class: DoiExtractor::CreateCommand
- Defined in:
- lib/doi_extractor/create_command.rb
Instance Attribute Summary
Attributes inherited from Command
#log, #options, #start_time, #std_out, #user_input_callback
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from DoiExtractor::Command
Instance Method Details
#_execute ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/doi_extractor/create_command.rb', line 4 def _execute say('checking existing DOI extracts', true) if any_current_doi_extracts? fail('A DOI Extract is already in progress. Nothing created.') end say('Creating DOI extract group...') ex = ipums_client.create_doi_extract(.doi_version, .year, .email) fail('Server did not return any data; extract status is unknown') unless ex fail("Server created DOI extract with ID #{ex.id} and invalid status #{ex.status}") unless ex.status == 'empty' say("DOI Extract with ID #{ex.id} submitted. To check status run the following command:\n doi_extractor status -p #{.project} -e #{.environment} -i #{ex.id}\n") if .email say("An email will be sent to #{.email} after the last extract has finished. At that time you will be able to download and archive the extracts.") end end |
#any_current_doi_extracts? ⇒ Boolean
25 26 27 28 29 |
# File 'lib/doi_extractor/create_command.rb', line 25 def any_current_doi_extracts? in_progress_status = ['empty', 'waiting_to_populate', 'populating', 'unsubmitted', 'waiting_to_submit', 'submitting', 'submitted'] recent = ipums_client.recent_doi_extracts recent.any? { |e| in_progress_status.include?(e.status) } end |