Giter Site home page Giter Site logo

nstance's People

Contributors

brentd avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

nstance's Issues

Exception raised when output limit is exceeded ๐Ÿ™…โ€โ™€๏ธ

Hi @brentd. Thanks for working on this gem. It's great ๐ŸŽ‰

I've noticed that nstance seems to handle exceeded output limits in unexpected ways. Given a limit of 30KB bytes with container output that's roughly 107KB, I got an error about trying to map over nil, and the result object's status and error attributes weren't set. Here's an example stack trace with the output santized:

[5] pry(main)> result = instance.run("cool_parser input.csv", output_limit: 30000)
D, [2019-10-30T13:04:14.229620 #32749] DEBUG -- nstance: Command e6564917 scheduled: "cool_parser input.csv"
D, [2019-10-30T13:04:14.230081 #32749] DEBUG -- nstance: Creating container: {:Image=>"amazing-docker-image:latest", :Cmd=>["sh"], :Labels=>{"nstance"=>"6feb191d-9e1b-4a78-b0a8-5a9b474cb4f9"}, :OpenStdin=>true, :StdinOnce=>true, "name"=>"nstance_6feb191d-9e1b-4a78-b0a8-5a9b474cb4f9"}
D, [2019-10-30T13:04:14.271251 #32749] DEBUG -- nstance: Creating container: {:Image=>"amazing-docker-image:latest", :Cmd=>["sh"], :Labels=>{"nstance"=>"a8ada766-fd3c-4772-a914-61783afffb9e"}, :OpenStdin=>true, :StdinOnce=>true}
D, [2019-10-30T13:04:17.004523 #32749] DEBUG -- nstance: Command 9e0631a0 received data: [stdout] "lots of cool data"
D, [2019-10-30T13:04:17.005046 #32749] DEBUG -- nstance: Command 9e0631a0 event:chunk, payload:[:stdout, "even more cool data"]
D, [2019-10-30T13:04:17.006066 #32749] DEBUG -- nstance: Command 9e0631a0 event:line, payload:[:stdout, "wow that's a lot of cool data"]
(Imagine tons of cool data here)
D, [2019-10-30T13:04:18.265945 #32749] DEBUG -- nstance: Command e6564917 event:complete, payload:[---
stdout | "lots of cool data"
stdout | "even more cool data"
stdout | "wow that's a lot of cool data"
(Imagine tons of cool data here)
--- exit status: output_limit_exceeded]
#<Thread:0x00007fef3b87b608@~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:21 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
  9: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:21:in `block (2 levels) in run'
  8: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:52:in `perform'
  7: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:52:in `loop'
  6: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:60:in `block in perform'
  5: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:65:in `rescue in block in perform'
  4: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:103:in `receive_error'
  3: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:119:in `complete'
  2: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:146:in `emit'
  1: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:146:in `inspect'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/result.rb:15:in `inspect': undefined method `map' for nil:NilClass (NoMethodError)
D, [2019-10-30T13:04:18.198825 #32749] DEBUG -- nstance: Command 9e0631a0 event:complete, payload:[---
stdout | "lots of cool data"
stdout | "even more cool data"
stdout | "wow that's a lot of cool data"--- exit status: output_limit_exceeded]
=> #<Nstance::Result:0x3ff7a07ccd24>
#<Thread:0x00007fef3ff4b290@~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:21 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
  9: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:21:in `block (2 levels) in run'
  8: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:52:in `perform'
  7: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:52:in `loop'
  6: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:60:in `block in perform'
  5: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/drivers/docker_api/attach_driver.rb:65:in `rescue in block in perform'
  4: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:103:in `receive_error'
  3: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:119:in `complete'
  2: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:146:in `emit'
  1: from ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/run_emitter.rb:146:in `inspect'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/nstance-0f5ed4d1f1a9/lib/nstance/result.rb:15:in `inspect': undefined method `map' for nil:NilClass (NoMethodError)
[6] pry(main)> result.status
=> nil
[7] pry(main)> result
=> #<Nstance::Result:0x3ff7a07ccd24>
[8] pry(main)> result.error
=> #<NoMethodError: undefined method `<<' for nil:NilClass>
[9] pry(main)> result.lines
=> nil
[10] pry(main)> result.success?
=> false
[11] pry(main)> result.output_limit_exceeded?
=> false

For the time being I've just bumped the allowed output size to resolve the issue in production. Any clue what's happening here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.