Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change failure mode for missing YAML parser (PyYAML) dependency #49

Open
earl opened this issue Jun 22, 2014 · 2 comments
Open

Change failure mode for missing YAML parser (PyYAML) dependency #49

earl opened this issue Jun 22, 2014 · 2 comments
Labels
Milestone

Comments

@earl
Copy link
Owner

earl commented Jun 22, 2014

Currently, beanstalkc for all practical purposes depends on PyYAML. Unless told otherwise, instantiating a Connection will try to import PyYAML; if that import fails, beanstalkc will log an error (using logging.error) but will continue working, by switching to a YAML-less operating mode.

I'm now convinced, that this failure mode is a mistake; it's the opposite of "fail-fast". In practice, the automatic fail-over to YAML-less operation has done more harm than good. Basically, it made (though typically brief) debugging necessary, instead of properly failing right away and making the error condition obvious.

Therefore, I plan to switch the default failure mode: in the future, when PyYAML is missing, beanstalkc won't handle the ImportError itself, but just pass it through. This is a more transparent fail-fast.

However, PyYAML won't become a hard dependency. You'll still be able to operate beanstalkc without PyYAML, explicitly switching to YAML-less operation by passing parse_yaml=False to the Connection constructor. Explicitly switching to YAML-less operation has been supported for a long time, so that's nothing new. It is already used by all real-world YAML-less deployments I know of.

So the main thing that'll change, is switching the default to a more sensible fail-fast behaviour.

Unless there is major opposition against this change, or someone suggests something better, the new default behaviour will be switched for the next feature release (beanstalkc 0.5.0).

@ptjm
Copy link

ptjm commented Aug 12, 2014

I don't have a strong opinion one way or another, but before you do it consider my recent pull request #51. That wasn't a response to this issue, but I guess it was my idea for dealing with the same problem.

@Rogdham
Copy link

Rogdham commented May 27, 2016

👍

This could potentially only affect the users who do not have installed PyYAML, and still don't disable it explicitly. I would argue that they are probably not many: the logger part is set to the error level (which may not be the right level btw). This alone is pretty annoying when looking at the console during development / debug times, and quite bad during production where logs are stored, monitored, etc.

Failing shortly in that case leads to a choice being made during development, which is a good thing imho. Plus it makes beanstalkc's code cleaner, which is always nice :-)

@earl earl added this to the 0.5.0 milestone Sep 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants