Shopify / pyoozie

Library for querying and scheduling with Apache Oozie
https://py-oozie.readthedocs.io
MIT License
11 stars 12 forks source link

OozieClient constructor should not perform actual network communication #63

Closed pior closed 6 years ago

pior commented 6 years ago

When instantiating a OozieClient, the url is checked by performing a request to Oozie.

Code: https://github.com/Shopify/pyoozie/blob/master/pyoozie/client.py#L81

Constructors usually don't perform actual work, so it's counter-intuitive and can make testing harder than it should be.

kmtaylor-github commented 6 years ago

The only alternatives would be:

pior commented 6 years ago

What about an having the "user" of this lib explicitly call a method to check the connection?

Silently checking a remote connection is a rather unusual practice.

cfournie commented 6 years ago

We could add a keyword argument to disable testing on init (leave it on by default) and make the connection test method public.

That'd allow users to control when testing occurs during the lifecycle of their app if they know what they're doing, but by default it'd still be proactive about checking the connection for users out of the box.

pior commented 6 years ago

I will try to find the time to ship a PR for that soon.