When possible, use python-couchdb directly rather than desktopcouch
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dmedia |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
dmedia is obviously very focused on desktop use, for which desktopcouch is a godsend.
But dmedia also needs to run on headless, minimal servers. In this case, we should start dmedia using upstart (rather than as a per-user D-Bus service), and talk to the system wide CouchDB (rather than to a per user instance started with desktopcouch).
Long term, I'd love to see some abstractions in desktopcouch to make it easy to run an application against either desktopcouch or system wide CouchDB without the application knowing the difference. I expect a lot of the really cool use cases for desktopcouch will also involve a server component. And that basically the same component will run on the desktop as well (so that functionality is available whether or not you have network connectivity). That's the case with dmedia anyway.
By taking a stab at this in dmedia, I hope to gain some insights so that this can be further discussed with the desktopcouch people at UDS-O.
My basic plan is to add a get_couchdb_
I also want to talk to CouchDB using a couchdb.Database rather than a desktopcouch.
Actually, for my tastes python-couchdb itself has far too much wrapper, far too little CouchDB REST API, although that's another story. But a small rant: I'm personally appalled that python-couchdb wraps every dict in its basically useless Row. The Python builtin data types are wicked fast and quite memory efficient... but if a library (like python-couchdb) gets a bad case of wrapper-itis, there's a big performance and memory hit. Rant rant...
Related branches
- Jason Gerard DeRose: Approve
- David Jordan: Approve
-
Diff: 2046 lines (+951/-306)19 files modifieddmedia-gtk (+2/-1)
dmedia-service (+21/-12)
dmedia/__init__.py (+28/-0)
dmedia/abstractcouch.py (+158/-0)
dmedia/constants.py (+6/-1)
dmedia/importer.py (+47/-51)
dmedia/metastore.py (+13/-14)
dmedia/service.py (+26/-15)
dmedia/tests/__init__.py (+35/-0)
dmedia/tests/couch.py (+63/-0)
dmedia/tests/helpers.py (+1/-21)
dmedia/tests/test_abstractcouch.py (+207/-0)
dmedia/tests/test_client.py (+4/-1)
dmedia/tests/test_importer.py (+151/-136)
dmedia/tests/test_metastore.py (+11/-14)
dmedia/tests/test_service.py (+6/-5)
dmedia/tests/test_workers.py (+116/-24)
dmedia/workers.py (+51/-11)
setup.py (+5/-0)
Changed in dmedia: | |
status: | In Progress → Fix Committed |
Changed in dmedia: | |
status: | Fix Committed → Fix Released |
Ah, something important I forgot to note: in case anyone is wondering why I'm making this seemingly aggressive change so near the 0.4 release, it's because this should fix lp:710405 "Fix 400 error in test_Client. test_import( )":
https:/ /bugs.launchpad .net/dmedia/ +bug/710405
With this change, I'll only call desktopcouch. find_port( ) in the main process, and then just pass a dict with the CouchDB info to subprocesses creating with `multiprocessing`. Longterm, this is the way dmedia needs to work anyway, and making this change will probably take less time than resolving the mysterious D-Bus + Python multiprocessing issue that sprung up under Natty.