-
Notifications
You must be signed in to change notification settings - Fork 25
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
Issue 83: Enable Python bindings for StreamManager and EventWriter. #104
Conversation
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
@@ -229,7 +229,7 @@ pub struct ControllerClientImpl { | |||
channel: RwLock<ControllerServiceClient<Channel>>, | |||
} | |||
|
|||
fn get_channel(config: &ClientConfig) -> Channel { | |||
async fn get_channel(config: &ClientConfig) -> Channel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be async? I don't see any IO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Channel::balance_list(iterable_endpoints) |
this internally spawns a tokio task. This mandates the use of Tokio runtime. Hence marking it under an async block will ensure the user invokes it in a Tokio runtime.
We have a similar issue with
pravega-client-rust/src/event_stream_writer.rs
Lines 60 to 64 in fa5239a
tokio::spawn(Processor::run(processor)); | |
EventStreamWriter { | |
writer_id: Uuid::new_v4(), | |
sender: tx, | |
} |
Perhaps we can use the same approach here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #107 as a way to resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean our current creating controller client in the wrong way?
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
bindings/Cargo.toml
Outdated
#javascript_dev = ["wasm-bindgen"] | ||
|
||
# python binding is enabled by default | ||
# This causes cargo test to break ref: https://github.com/PyO3/pyo3/issues/341 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need it enabled by default? It seems reasonable that you should specify the "feature" of the language you want to link. Perhaps that can act as a flag to enable this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updaetd the default feature to include pyo3. maturin develop
command with enabling a specific feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good, but the build issues need to be resolved before merging.
Ideally we could do #107 first or right after because it would make this a lot nicer.
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
|
||
#[macro_use] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably add a dummy main to keep the test suite happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried with a dummy main, it too fails. We need to use the workaround mentioined @ https://pyo3.rs/master/advanced.html#testing
bindings/Cargo.toml
Outdated
#javascript_dev = ["wasm-bindgen"] | ||
|
||
# python binding is enabled by default | ||
# This causes cargo test to break ref: https://github.com/PyO3/pyo3/issues/341 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need it enabled by default? It seems reasonable that you should specify the "feature" of the language you want to link. Perhaps that can act as a flag to enable this?
rust-toolchain
Outdated
@@ -1,2 +1,3 @@ | |||
stable | |||
# Change to stable once issue https://github.com/PyO3/pyo3/issues/5 is resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, progress is being tracked here:
PyO3/pyo3#210
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Signed-off-by: Sandeep <[email protected]>
Note: rustc nightly version is required to generate the bindings.
Change log description
Enable Python bindings for the native client. StreamManager and EventWriter apis have been enabled in this Pull request.
Purpose of the change
Fixes #83
What the code does
This PR uses https://github.com/PyO3/PyO3 to generate Python bindings.
https://github.com/PyO3/maturin has been used to generate the python packages and can also be used to upload it https://pypi.org/
This PR does not generate async bindings
How to verify it
This has been verified against Pravega-standalone.