Class: Quandl::Sandbox::Job
- Inherits:
-
Object
- Object
- Quandl::Sandbox::Job
- Defined in:
- lib/quandl/sandbox/job.rb
Instance Attribute Summary collapse
-
#attempts ⇒ Object
Returns the value of attribute attempts.
-
#output ⇒ Object
Returns the value of attribute output.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#server ⇒ Object
Returns the value of attribute server.
-
#server_id ⇒ Object
Returns the value of attribute server_id.
Instance Method Summary collapse
- #datasets ⇒ Object
- #execute ⇒ Object
-
#initialize(*args) ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize(*args) ⇒ Job
Returns a new instance of Job.
5 6 7 8 9 |
# File 'lib/quandl/sandbox/job.rb', line 5 def initialize(*args) = args..symbolize_keys! self.repository = Quandl::Sandbox::Repository.new([:repository]) if [:repository].present? self.server = Quandl::Sandbox::Server.find( [:server_id] ) if [:server_id].present? end |
Instance Attribute Details
#attempts ⇒ Object
Returns the value of attribute attempts.
3 4 5 |
# File 'lib/quandl/sandbox/job.rb', line 3 def attempts @attempts end |
#output ⇒ Object
Returns the value of attribute output.
3 4 5 |
# File 'lib/quandl/sandbox/job.rb', line 3 def output @output end |
#repository ⇒ Object
Returns the value of attribute repository.
3 4 5 |
# File 'lib/quandl/sandbox/job.rb', line 3 def repository @repository end |
#server ⇒ Object
Returns the value of attribute server.
3 4 5 |
# File 'lib/quandl/sandbox/job.rb', line 3 def server @server end |
#server_id ⇒ Object
Returns the value of attribute server_id.
3 4 5 |
# File 'lib/quandl/sandbox/job.rb', line 3 def server_id @server_id end |
Instance Method Details
#datasets ⇒ Object
11 12 13 |
# File 'lib/quandl/sandbox/job.rb', line 11 def datasets @datasets ||= Quandl::Sandbox::Dataset.from_output( output[:stdout] ) end |
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/quandl/sandbox/job.rb', line 15 def execute # ensure the ssh daemon has started server.ensure_connection_established! # run commands that need to happen before importer server.exec( repository.script.before_execute ) # execute importer self.output = server.exec( repository.script.execute ) rescue => err Quandl::Logger.error( err ) ensure server.delete end |