Issues/features closed recently for review

39 views
Skip to first unread message

Jeff Lindsay

unread,
May 17, 2012, 8:46:03 PM5/17/12
to ginkg...@googlegroups.com
Closing out the last non-test, non-docs related items in issues for v1.0.0. Here are recently closed issues:

 * Add configuration context manager
 * Config Group should be/act as a dict
 * Don't hardcode pid/log files in /tmp
 * default pidfile put in home directory
 * Only make pidfile when daemonizing
 * Add pre-wrapped gevent servers in async.gevent module
 * Add module level docstrings
 * Sanity check configuration when reloading

More information:

 # Add configuration context manager

In our review, we talked about how you should be able to use different Configs when writing tests. This is mainly because the main Ginkgo API assumes you use the global singletons in the top level ginkgo module. Process had a context manager that would temporarily replace this singleton object, similar to how Flask request context managers work. We wanted the same, separately, for Config. Since the config module does not assume dependency on any other modules besides util, we also needed implement this is a way where the class definition isn't coupled to a singleton location. The result is a mixin called GlobalContext, which is now used for both Process and Config.


# Config Group should be/act as a dict

Groups are a great way to access configuration data outside of Setting descriptors, and now they're even better! Any Group object now acts like a dict by implementing the collections.Mapping base class. That means if you want to define configuration for another framework within Ginkgo (like Flask) and it takes a dictionary, you can just define that configuration in your ginkgo configuration as a group!


# Don't hardcode pid/log files in /tmp
# default pidfile put in home directory
# Only make pidfile when daemonizing

These are all related, so they were taken care of at once. One notable difference is that there is now a DaemonProcess subclass of Process that's used when you want to daemonize. Also, the builtin configuration setting "daemon" has been removed in favor of an optional argument in the ginkgo command. This helps avoid confusion when you set daemon = True and use ginkgo expecting it to be in the foreground. ginkgoctl still forces daemonization. 

We now put nothing in /tmp directly. I considered using tempfile for logs, but this results in the default case of a new log file every time you run ginkgo, often in an obscure location. So default log files are put in the same place pid files are now: ~/.<service name>.log. As dot files, you can assume they are hidden, by consistently using the service name, you always know where that log file is. If you're running multiple instances of a service, this is when you should start specifying your own logfile and pidfile.


# Add pre-wrapped gevent servers in async.gevent module

As mentioned previously, ginkgo.async.gevent.ServerWrapper is deprecated in favor of pre-wrapped versions of the builtin gevent servers. 


# Add module level docstrings
# Sanity check configuration when reloading

These are pretty straightforward.

--
Jeff Lindsay
http://progrium.com
Reply all
Reply to author
Forward
0 new messages