-
Notifications
You must be signed in to change notification settings - Fork 299
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
[wip] Replace raw.py
with flyteidl_rust.RawSynchronousFlyteClient
#2561
[wip] Replace raw.py
with flyteidl_rust.RawSynchronousFlyteClient
#2561
Conversation
5ec11e0
to
96bfefb
Compare
add_content_md5_metadata=add_content_md5_metadata, | ||
org="", |
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.
initialize org
as empty string, can be assigned later by union serverless sdk etc.
@@ -326,12 +326,12 @@ def literal_type_to_click_type(lt: LiteralType, python_type: typing.Type) -> cli | |||
Converts a Flyte LiteralType given a python_type to a click.ParamType | |||
""" | |||
if lt.simple: | |||
if lt.simple == SimpleType.STRUCT: | |||
if int(str(lt.simple)) == SimpleType.STRUCT: |
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 int(str(lt.simple_type))
because we've add __repr__
magic function for the Rust structure.
#[pymethods]
impl literal_type::Type {
fn __repr__(&self) -> String {
match self {
Self::Simple(value) => format!("{}", value),
_ => todo!(),
}
}
}
Why not just int(lt.simple_type)
? Cause, unlike most enum in Rust, literal_type.Type
is complex without int variants.
/// Nested message and enum types in `LiteralType`.
pub mod literal_type {
#[::pyo3_macro::with_pyclass]
#[derive(::pyo3_macro::WithNew)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Type {
/// A simple type that can be compared one-to-one with another.
#[prost(enumeration = "super::SimpleType", tag = "1")]
Simple(i32),
/// A complex type that requires matching of inner fields.
#[prost(message, tag = "2")]
Schema(super::SchemaType),
/// Defines the type of the value of a collection. Only homogeneous collections are allowed.
#[prost(message, tag = "3")]
CollectionType(::prost::alloc::boxed::Box<super::LiteralType>),
/// Defines the type of the value of a map type. The type of the key is always a string.
#[prost(message, tag = "4")]
MapValueType(::prost::alloc::boxed::Box<super::LiteralType>),
/// A blob might have specialized implementation details depending on associated metadata.
#[prost(message, tag = "5")]
Blob(super::BlobType),
/// Defines an enum with pre-defined string values.
#[prost(message, tag = "7")]
EnumType(super::EnumType),
/// Generalized schema support
#[prost(message, tag = "8")]
StructuredDatasetType(super::StructuredDatasetType),
/// Defines an union type with pre-defined LiteralTypes.
#[prost(message, tag = "10")]
UnionType(super::UnionType),
}
}
0019800
to
8b884e5
Compare
1d0bef5
to
076beb8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## flyrs-v2 #2561 +/- ##
===========================================
Coverage ? 49.03%
===========================================
Files ? 183
Lines ? 19009
Branches ? 4036
===========================================
Hits ? 9322
Misses ? 9171
Partials ? 516 ☔ View full report in Codecov by Sentry. |
5b69e4e
to
d393bc8
Compare
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
d393bc8
to
d074774
Compare
Signed-off-by: Austin Liu <[email protected]> rebase Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
beed28d
to
faceaa7
Compare
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
Signed-off-by: Austin Liu <[email protected]>
…t set Signed-off-by: Austin Liu <[email protected]>
Tracking issue
flyteorg/flyte#5344
Why are the changes needed?
The end game is replacing
raw.py
with fully functioned, auth-included, Pyhton binding exposed from Rust implementation ofRawSynchronousFlyteClient
through PyO3.With the helps of works in flyteorg/flyte#5525, this PR eliminates the protobuf objects serialization overhead while calling gRPC services. Unlike the original approach in flyrs, this method optimizes performance and reduces the maintenance cost.
With
flyteidl-rust
(test release) Python bindings, Flytekit can get rid of not only grpc but also protobuf Python dependencies.What changes were proposed in this pull request?
Retain model layer overhead from this PR #2536, and make current
SynchronousFlyteClient
directly inherit classRawSynchronousFlyteClient
from binding https://test.pypi.org/project/flyteidl-rust/.flyteidl
from model filesflytekit
imageflyteidl
from model filesParseFromString
,SerializeToString
andParseStruct
ParseValue
…flyteidl-rust
@pytest.mark.remote_task
to skip testspkce
client credentials
device flow
flyteidl-rust
imageInterceptors are a bit more constrained in what they can do but are implemented as middleware and requests are nit clonable in the retry loop.
gil-refs
How was this patch tested?
Two ways to install flyteidl-rust:
git clone -b flyrs https://github.com/austin362667/flyte.git
cd flyte/flyteidl/
rm -rf gen/pb_rust/* && cargo run --bin gen_flyteidl
maturin dev --release -m Cargo.toml
pip install -i https://test.pypi.org/simple/ flyteidl-rust
Use flytekit with flyteidl-rust:
git clone -b austin362667/flyrs-v2 https://github.com/austin362667/flytekit.git
docker build -f Dockerfile.rust --build-arg PYTHON_VERSION=3.12 -t localhost:30000/flytekit:rust .
docker push localhost:30000/flytekit:rust
export FLYTEKIT_IMAGE=localhost:30000/flytekit:rust
make integration_test
Setup process
austin362667:austin362667/flyrs-v2
pip uninstall grpcio grpcio-status
flyteidl-rust
pip install -i https://test.pypi.org/simple/ flyteidl-rust
pytest ./tests/flytekit/integration/remote/test_remote.py
Screenshots
PyPi (test):
Integration Test:
Follow-up PRs
Check all the applicable boxes
Related PRs
#2536
Docs link