Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul Python C layer #1558

Merged
merged 1 commit into from Jun 1, 2015
Merged

Conversation

soltanmm
Copy link
Contributor

Change the Python C layer to better match the core; currently adapts the new C layer via _low.py to what the old _low.py looked like (sans a name change EXPIRED -> DEADLINE_EXCEEDED to match the core enums). This effectively moves the boundary between old-style and new-style APIs from the shared Python/C layer to the lowest pure Python layer.

There is much to be cleaned up in this pull request (file copyrights, doc comments, commit messages, source file organization, enum location [lingual]...), and I'd rather wait for #1472 and #1493 to go through first as they seem like potential sources of surprise (which is also a reason for the alternative, but, meh).

This is being put up as a PR to check against Travis (all tests are passing locally) and for initial comments.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@soltanmm
Copy link
Contributor Author

... and part of cleaning up the commit history will include setting the proper e-mail address.

@@ -43,4 +43,4 @@ class BlockingInvocationInlineServiceTest(


if __name__ == '__main__':
unittest.main()
unittest.main(verbosity=2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never before seen "verbosity=2" in a call to "unittest.main()". What does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes the real-time normal test output to be the test names rather than .s and Ss and Es - kinda nice when the code segfaults and Python's interpreter never gets to perform error handling. It might be prudent for me to move these little verbosity changes to a separate commit, maybe add more of them.

@soltanmm
Copy link
Contributor Author

It appears that the segfault isn't present when building with CONFIG=dbg but is present when CONFIG=opt. Fun stuff.

@nathanielmanistaatgoogle
Copy link
Member

What's the reason for having large and few C files rather than small and many? Might I push gently to move in the small-and-many direction?

@soltanmm
Copy link
Contributor Author

I did that so that I could have all the functions be declared static and still keep the forward declarations of the Python-side 'classes' in one place without resorting to preprocessor ugliness. There's no particular reason to keep everything static, though, so I'll split them up.

Besides that, fixed the segfault... but I don't see Travis running in the checks. Any ideas why that might be?

(edit: it was because the commits in this PR conflicted with master and Travis stays silent about it)

@soltanmm soltanmm force-pushed the extension branch 2 times, most recently from 2f86b17 to 4ed0abc Compare May 13, 2015 19:15
@googlebot
Copy link

CLAs look good, thanks!

@soltanmm
Copy link
Contributor Author

We are now caught up to #1472 and #1493.

@@ -1,3 +1,4 @@
/* vim: set expandtab shiftwidth=2 tabstop=2 softtabstop=2: */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop these lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Werp - I'd forgotten I had those there.

@soltanmm
Copy link
Contributor Author

I believe I've covered my error-handling-bases and have dropped @Yhg1s a line - we'll see where this PR ends up in the next few days. I guess, too, that we're sticking with C89 for the foreseeable future.

Also, at the risk of inadvertently invoking any number of corollaries of Murphy's law, I'll note that I've yet to see one of our ever-present Travis failures out of this PR...

EDIT: Murphy is alive and well.

@@ -31,21 +31,31 @@
*
*/

#ifndef _ADAPTER__SERVER_H_

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"src/python/src/grpc/_adapter/_server.h → src/python/src/grpc/_adapter/_c/module.c" is a funny move to make, and makes for a funny diff - how easily could you change this file to being a fork of something more sensible (_c.c?)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into git mv, but IIRC it's just the equivalent of git add + git rm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git autodetects moves... there's no user control over this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-(

@nathanielmanistaatgoogle
Copy link
Member

(Good work, by the way.)

@soltanmm
Copy link
Contributor Author

I managed to introduce a segfault on local testing.

EDIT: Might just be because I trashed my git repository state on this particular machine...

@soltanmm
Copy link
Contributor Author

It was a trashed local repo state.

@nathanielmanistaatgoogle
Copy link
Member

@Yhg1s I'd appreciate your eyes on this as much as they were on the first wrapping code back in February - will you be able to take a look or should we chase up @gpshead?

@soltanmm
Copy link
Contributor Author

cc #529, as this makes that issue outdated.

@Yhg1s
Copy link
Contributor

Yhg1s commented May 22, 2015

On Fri, May 22, 2015 at 2:00 AM, Nathaniel Manista <notifications@github.com

wrote:

@Yhg1s https://github.com/Yhg1s I'd appreciate your eyes on this as
much as they were on the first wrapping code back in February - will you be
able to take a look or should we chase up @gpshead
https://github.com/gpshead?

I'll take a look tonight.

Thomas Wouters thomas@python.org

Hi! I'm an email virus! Think twice before sending your email to help me
spread!

@soltanmm
Copy link
Contributor Author

@Yhg1s ping

Exposes the C core batch API to the Python layers. Provides a shim to
enable the old Python API to remain the same (for now).
@soltanmm
Copy link
Contributor Author

Updated PR to keep up with protobuf upgrades and the pattern set by #1803...

@soltanmm soltanmm mentioned this pull request May 29, 2015
@soltanmm soltanmm added this to the Beta milestone May 29, 2015
@nathanielmanistaatgoogle
Copy link
Member

Merging this; it's waited long enough and we can always do a post-commit review later.

nathanielmanistaatgoogle added a commit that referenced this pull request Jun 1, 2015
@nathanielmanistaatgoogle nathanielmanistaatgoogle merged commit faafb38 into grpc:master Jun 1, 2015
@soltanmm soltanmm deleted the extension branch June 1, 2015 21:35
@lock lock bot locked as resolved and limited conversation to collaborators Jan 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants