Skip to content

python binding of librados with cython#7621

Merged
jdurgin merged 7 commits intoceph:masterfrom
sileht:sileht/rados-cython
Feb 17, 2016
Merged

python binding of librados with cython#7621
jdurgin merged 7 commits intoceph:masterfrom
sileht:sileht/rados-cython

Conversation

@sileht
Copy link
Contributor

@sileht sileht commented Feb 12, 2016

Hi,

This change move the librados python binding from ctypes to cython.

Cheers,

@sileht sileht force-pushed the sileht/rados-cython branch from 8d19910 to 4ba8cb0 Compare February 12, 2016 12:34
@sileht sileht force-pushed the sileht/rados-cython branch 3 times, most recently from 8ddc2dc to a41bec9 Compare February 15, 2016 08:53
@sileht
Copy link
Contributor Author

sileht commented Feb 15, 2016

Hi,
I just finish to move all methods to Cython, all unit tests in test_rados.py pass locally
Let's see want the CI think, now.

Just to be sure, I can continue to work on this, Can you confirm that this feature is something your are interested in ?

Cheers,

@jdurgin
Copy link
Member

jdurgin commented Feb 15, 2016

Yes, I'm excited by this! @marcan is likely interested as well.

I haven't looked closely yet, but I think we'll want make ceph.in (turns into /usr/bin/ceph) do the run-in-thread dance itself, so it can be interrupted with ^C. I agree getting rid of it in the python bindings is the way to go.

Thanks for adding tests and keeping things backwards-compatible too!
We don't have it automated yet, but if you could verify that test_rados.py still works with python3 that'd be great. After this change, we'll definitely want to make separate python3 build steps and packages, since they need recompiling rather than just copying .py files around (http://tracker.ceph.com/issues/13959).

@sileht
Copy link
Contributor Author

sileht commented Feb 15, 2016

I work on Gnocchi project (http://gnocchi.xyz/), we uses rados API to store object. The current rados python binding is slow as hell, that why I started this.

About run_in_thread, it should not leave into the lib. Into our application we already use threads to do concurrency IO, this additional thread (run_in_thread) on each C call is an useless big overhead for us (We currently monkeypatch the lib to disable this thread).

I run some preliminary benchmark of our application today, the result is just impressive. We now process 10000 measures in 30 secs instead of 8 minutes with the Ceph backend.

So I will continue on this:

  • By providing a patch to ceph.in to keep CTRL+C fast as before (even it's already better with cython than ctypes)
  • And ensuring that tests pass with python3 too and post the result.

@marcan
Copy link
Contributor

marcan commented Feb 15, 2016

Yes, this is something I was looking to get around to doing sooner or later. Thanks for taking the lead!

Looks like you have some spurious egg-info files in here. I assume you're still working on this and pending some cleanup/rewriting of the commits.

@sileht sileht force-pushed the sileht/rados-cython branch 3 times, most recently from cb13f53 to 2b59ca8 Compare February 16, 2016 10:05
@sileht
Copy link
Contributor Author

sileht commented Feb 16, 2016

I have:

  • fixes a couple of str/bytes issues to pass tests in python 3.
  • fixes the rpm/deb package of python-rados (for python 2)
  • fixes ceph.in to load the new rados modules and adds run_in_thread

todo:

  • fixes python-rbd to use cluster handle from the new rados binding

I think I can propose something for python3-rados and python3-rbd packaging but in other PR to not put much code into this PR.

@sileht sileht force-pushed the sileht/rados-cython branch from 2b59ca8 to 10e4c2e Compare February 16, 2016 11:16
@sileht
Copy link
Contributor Author

sileht commented Feb 16, 2016

I have done the last todo item

@sileht sileht force-pushed the sileht/rados-cython branch from 10e4c2e to edb8f43 Compare February 16, 2016 12:46
@jdurgin
Copy link
Member

jdurgin commented Feb 16, 2016

That was fast! I'll take a close look today.

@sileht sileht force-pushed the sileht/rados-cython branch from edb8f43 to ac1986d Compare February 16, 2016 17:38
To allow to create a autonomous rados module with cython.
We move the current librbdpy to the rbd sub directory.

Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
@sileht sileht force-pushed the sileht/rados-cython branch 2 times, most recently from 16b9cc0 to ef8ae20 Compare February 16, 2016 23:37
@jdurgin
Copy link
Member

jdurgin commented Feb 17, 2016

The rest looks good! Just one other thing: for the docs can you update the admin/build-doc script? To extract the docstrings sphinx imports the module, so that script builds a dummy version of the python rbd module just for the docstrings. Can you add the same thing for librados, and make sure the paths still work for rbd.so? Thanks!

BTW the rbd python tests pass as well.

@jdurgin
Copy link
Member

jdurgin commented Feb 17, 2016

Oh, and adding python3 packages in a separate PR would be great.

@sileht sileht force-pushed the sileht/rados-cython branch from ef8ae20 to e7b048b Compare February 17, 2016 09:19
@sileht
Copy link
Contributor Author

sileht commented Feb 17, 2016

I have fixed your remarks.

@sileht sileht force-pushed the sileht/rados-cython branch from e7b048b to 78c8b6f Compare February 17, 2016 09:21
Mehdi Abaakouk added 3 commits February 17, 2016 12:32
Notable changes:

* run_in_thread have disapeared
* timeout argument of some methods are ignored
* rados_create_write_op/rados_create_read_op returns WriteOp/ReadOp
  instead of the pointer address
* rados_monitor_log callback 'arg' arguments was broken in previous python
  binding (callback was called with the pointer address instead pointed object)
* object attributes that was pointer addresses are now private and not accessible in python

Some tests have been added to cover all methods

Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
Mehdi Abaakouk added 2 commits February 17, 2016 12:32
This implements run_in_thread inside the ceph command itself.

And fixes the ceph command bootstrap when it run inside the
source tree to correctly load the new rados python module.

Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
@sileht sileht force-pushed the sileht/rados-cython branch 2 times, most recently from a830a6f to c5f79b3 Compare February 17, 2016 14:04
Signed-off-by: Mehdi Abaakouk <sileht@redhat.com>
@sileht sileht force-pushed the sileht/rados-cython branch from c5f79b3 to 67f95c8 Compare February 17, 2016 14:17
jdurgin added a commit that referenced this pull request Feb 17, 2016
python binding of librados with cython

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
@jdurgin jdurgin merged commit 196d324 into ceph:master Feb 17, 2016
@jdurgin
Copy link
Member

jdurgin commented Feb 17, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants