progrium/gservice — Issue #35: support module service lookup
Author: progrium
Created: 2011-12-24 03:08:29+00:00
State: open

You should be able to specify a module instead of a configuration file such as:

gservice path.to.service.module start

This module will contain a service factory function (service()). Note that -C is not necessary, as it will attempt to use default configuration values. If -C is used, the configuration file will be used for configuration. However, if a service factory is in the configuration file, it will use that factory instead.

The canonical way to define a service factory is in the module that defines the top level service. You should always prefer to use the module lookup unless you need to override the service factory for some reason (however, if configuration is done correctly, you shouldn't have to).

Here is an example service module called package.myservice (in, say, package/myservice.py):
```python
from gservice.core import Service

class MyService(Service):
def do_start(self):
pass

def service():
return MyService()
```

Now you can run `gservice package.myservice start`