SciRuby / daru-io

daru-io is a plugin gem to the existing daru gem, which aims to add support to Importing DataFrames from / Exporting DataFrames to multiple formats.
http://www.rubydoc.info/github/athityakumar/daru-io/master/
MIT License
24 stars 9 forks source link

Handle Mongo & Redis timeouts? #45

Open athityakumar opened 7 years ago

athityakumar commented 7 years ago

@prasunanand - Thanks for pointing this out during the code review conference, I had missed to handle this error. But thinking about it, I'm not sure whether it should be handled.

Installation of Redis & Mongo should definitely be added in the README. But, should the TimeOut error be handled or left to be raised?

v0dro commented 7 years ago

Is there a way to manually check whether Mongo is installed without having to trigger the mechanism timout error?

athityakumar commented 7 years ago

@v0dro - I don't think there's a way within the gem, but checking with backticks / system calls for CLI commands would work (though hacky) -

$ echo ping: 42 | mongo --quiet
42

$ redis-cli ping
PONG
athityakumar commented 7 years ago

@v0dro @zverok - Infact, a similar check could be useful for even RData / RDS IO modules. Please share your insights (any neater methods?). 😄

zverok commented 7 years ago

Have no reasonable idea at the moment, to be honest. Probably we should just catch default "Can't connect"/timeout error and assume that target platform is not installed/running and suggest something about it. In fact, I don't think this task worth a lot of effort, because "tries to connect but forgot to run it is a marginal case, and just clear indication of "something went wrong" should be enough.

athityakumar commented 7 years ago

@zverok - Hmm, but I think Prasun's point was about why it should take time (1 minute-ish) to finally just throw a "Timeout error", when it could rather be just "Please install Mongo" without waiting for a "Timeout error" when Mongo isn't installed. Hence, I suggested the hacky workaround that echo ping: 42 | mongo --quiet is.

athityakumar commented 7 years ago

Now that the README, Contribution Guidelines and YARD Docs are documenting the points well, should we probably should just trust that the user will go through any one of these sources?

zverok commented 7 years ago

Now that the README, Contribution Guidelines and YARD Docs are documenting the points well, should we probably should just trust that the user will go through any one of these sources?

I believe so!