diff --git a/flyrs/Cargo.lock b/flyrs/Cargo.lock new file mode 100644 index 0000000000..e04ccd3d02 --- /dev/null +++ b/flyrs/Cargo.lock @@ -0,0 +1,1097 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anyhow" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" + +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" + +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backtrace" +version = "0.3.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cc" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "either" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "flyrs" +version = "0.1.0" +dependencies = [ + "flyteidl", + "prost", + "pyo3", + "tokio", + "tonic", +] + +[[package]] +name = "flyteidl" +version = "0.1.0" +source = "git+https://github.com/flyteorg/flyte.git?branch=master#f0d645b6659ba55740a2ed0a994b947b64c5c87b" +dependencies = [ + "prost", + "prost-types", + "tonic", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "getrandom" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "indoc" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +dependencies = [ + "prost", +] + +[[package]] +name = "pyo3" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" +dependencies = [ + "cfg-if", + "indoc", + "libc", + "memoffset", + "parking_lot", + "portable-atomic", + "pyo3-build-config", + "pyo3-ffi", + "pyo3-macros", + "unindent", +] + +[[package]] +name = "pyo3-build-config" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" +dependencies = [ + "once_cell", + "target-lexicon", +] + +[[package]] +name = "pyo3-ffi" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" +dependencies = [ + "libc", + "pyo3-build-config", +] + +[[package]] +name = "pyo3-macros" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" +dependencies = [ + "proc-macro2", + "pyo3-macros-backend", + "quote", + "syn", +] + +[[package]] +name = "pyo3-macros-backend" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" +dependencies = [ + "heck", + "proc-macro2", + "pyo3-build-config", + "quote", + "syn", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustversion" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.198" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.198" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "syn" +version = "2.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + +[[package]] +name = "tokio" +version = "1.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64", + "bytes", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unindent" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/flyrs/Cargo.toml b/flyrs/Cargo.toml new file mode 100644 index 0000000000..0a75d7f0ad --- /dev/null +++ b/flyrs/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "flyrs" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "flyrs" +crate-type = ["cdylib"] + +[dependencies] +pyo3 = "0.21.2" +flyteidl = { git = "https://github.com/flyteorg/flyte.git", branch = "master" } +prost = "0.12.4" +tonic = "0.11.0" +tokio = "1.37.0" diff --git a/flyrs/pyproject.toml b/flyrs/pyproject.toml new file mode 100644 index 0000000000..044979e547 --- /dev/null +++ b/flyrs/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["maturin>=1.5,<2.0"] +build-backend = "maturin" + +[project] +name = "flyrs" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", +] +dynamic = ["version"] +[tool.maturin] +features = ["pyo3/extension-module"] diff --git a/flyrs/src/lib.rs b/flyrs/src/lib.rs new file mode 100644 index 0000000000..3c4c8179c0 --- /dev/null +++ b/flyrs/src/lib.rs @@ -0,0 +1,211 @@ +use flyteidl::flyteidl::admin; +use flyteidl::flyteidl::service::admin_service_client::AdminServiceClient; +use prost::{DecodeError, EncodeError, Message}; +use pyo3::exceptions::{PyOSError, PyValueError}; +use pyo3::prelude::*; +use pyo3::types::{PyBytes, PyDict}; +use pyo3::PyErr; +use std::fmt; +use std::sync::Arc; +use tokio::runtime::{Builder, Runtime}; +use tonic::{ + transport::{Channel, Uri}, + Request, Response, +}; + +// Foreign Rust error types: https://pyo3.rs/main/function/error-handling#foreign-rust-error-types +// Create a newtype wrapper, e.g. MyOtherError. Then implement From for PyErr (or PyErrArguments), as well as From for MyOtherError. + +// Failed at encoding responded object to bytes string +struct MessageEncodeError(EncodeError); +// Failed at decoding requested object from bytes string +struct MessageDecodeError(DecodeError); + +impl fmt::Display for MessageEncodeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "") + } +} + +impl fmt::Display for MessageDecodeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "") + } +} + +impl std::convert::From for PyErr { + fn from(err: MessageEncodeError) -> PyErr { + PyOSError::new_err(err.to_string()) + } +} + +impl std::convert::From for PyErr { + fn from(err: MessageDecodeError) -> PyErr { + PyOSError::new_err(err.to_string()) + } +} + +impl std::convert::From for MessageEncodeError { + fn from(other: EncodeError) -> Self { + Self(other) + } +} + +impl std::convert::From for MessageDecodeError { + fn from(other: DecodeError) -> Self { + Self(other) + } +} + +/// A Python class constructs the gRPC service stubs and a Tokio asynchronous runtime in Rust. +#[pyclass(subclass)] +pub struct FlyteClient { + admin_service: AdminServiceClient, + runtime: Runtime, +} + +pub fn decode_proto(bytes_obj: &PyBytes) -> Result +where + T: Message + Default, +{ + let bytes = bytes_obj.as_bytes(); + let de = Message::decode(&bytes.to_vec()[..]); + Ok(de?) +} + +pub fn encode_proto(res: T) -> Result, MessageEncodeError> +where + T: Message + Default, +{ + let mut buf = vec![]; + res.encode(&mut buf)?; + Ok(buf) +} + +#[pymethods] +impl FlyteClient { + #[new] // Without this, you cannot construct the underlying class in Python. + #[pyo3(signature = (endpoint, **kwargs))] + pub fn new(endpoint: &str, kwargs: Option<&Bound<'_, PyDict>>) -> PyResult { + // Use Atomic Reference Counting abstractions as a cheap way to pass string reference into another thread that outlives the scope. + let s = Arc::new(endpoint); + // Check details for constructing Tokio asynchronous `runtime`: https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.new_current_thread + let rt = match Builder::new_current_thread().enable_all().build() { + Ok(rt) => rt, + Err(error) => panic!("Failed to initiate Tokio multi-thread runtime: {:?}", error), + }; + // Check details for constructing `channel`: https://docs.rs/tonic/latest/tonic/transport/struct.Channel.html#method.builder + // TODO: generally handle more protocols, e.g., `https://` + let endpoint_uri = match format!("http://{}", *s.clone()).parse::() { + Ok(uri) => uri, + Err(error) => panic!( + "Got invalid endpoint when parsing endpoint_uri: {:?}", + error + ), + }; + // `Channel::builder(endpoint_uri)` returns type `tonic::transport::Endpoint`. + let channel = match rt.block_on(Channel::builder(endpoint_uri).connect()) { + Ok(ch) => ch, + Err(error) => panic!( + "Failed at connecting to endpoint when constructing channel: {:?}", + error + ), + }; + // Binding connected channel into service client stubs. + let stub = AdminServiceClient::new(channel); + Ok(FlyteClient { + runtime: rt, // The tokio runtime is used in a blocking manner for now. + admin_service: stub, + }) + } + + pub fn get_task(&mut self, py: Python, bytes_obj: &PyBytes) -> PyResult { + // Receive the request object in bytes from Python: flytekit remote + let bytes = bytes_obj.as_bytes(); + // Deserialize bytes object into flyteidl type + let decoded: admin::ObjectGetRequest = decode_proto(bytes_obj)?; + // Prepare request object for gRPC services + let req = Request::new(decoded); + + // Interacting with the gRPC service server: flyteadmin + let res = (match self.runtime.block_on(self.admin_service.get_task(req)) { + Ok(res) => res, + Err(error) => panic!( + "Failed at awaiting response from gRPC service server: {:?}", + error + ), + }) + .into_inner(); + + // Serialize service response object into flyteidl bytes buffer + let buf: Vec = encode_proto(res)?; + + // Returning bytes buffer back to Python: flytekit remote for further parsing. + Ok(PyBytes::new_bound(py, &buf).into()) + } + + pub fn create_task(&mut self, py: Python, bytes_obj: &PyBytes) -> PyResult { + let decoded: admin::TaskCreateRequest = decode_proto(bytes_obj)?; + let req = tonic::Request::new(decoded); + + let res = (match self.runtime.block_on(self.admin_service.create_task(req)) { + Ok(res) => res, + Err(error) => panic!( + "Failed at awaiting response from gRPC service server: {:?}", + error + ), + }) + .into_inner(); + + let buf: Vec = encode_proto(res)?; + + Ok(PyBytes::new_bound(py, &buf).into()) + } + + pub fn list_task_ids_paginated( + &mut self, + py: Python, + bytes_obj: &PyBytes, + ) -> PyResult { + let decoded: admin::NamedEntityIdentifierListRequest = decode_proto(bytes_obj)?; + let req = tonic::Request::new(decoded); + + let res = (match self.runtime.block_on(self.admin_service.list_task_ids(req)) { + Ok(res) => res, + Err(error) => panic!( + "Failed at awaiting response from gRPC service server: {:?}", + error + ), + }) + .into_inner(); + + let buf: Vec = encode_proto(res)?; + + Ok(PyBytes::new_bound(py, &buf).into()) + } + + pub fn list_tasks_paginated(&mut self, py: Python, bytes_obj: &PyBytes) -> PyResult { + let decoded: admin::ResourceListRequest = decode_proto(bytes_obj)?; + let req = tonic::Request::new(decoded); + + let res = (match self.runtime.block_on(self.admin_service.list_tasks(req)) { + Ok(res) => res, + Err(error) => panic!( + "Failed at awaiting response from gRPC service server: {:?}", + error + ), + }) + .into_inner(); + + let buf: Vec = encode_proto(res)?; + + Ok(PyBytes::new_bound(py, &buf).into()) + } +} + +/// A Python module implemented in Rust. +#[pymodule] +fn flyrs(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_class::()?; + Ok(()) +} diff --git a/flytekit/clients/friendly_rs.py b/flytekit/clients/friendly_rs.py new file mode 100644 index 0000000000..7fdb18df2f --- /dev/null +++ b/flytekit/clients/friendly_rs.py @@ -0,0 +1,165 @@ +from flyteidl.admin import common_pb2 as _common_pb2 +from flyteidl.admin import task_pb2 as _task_pb2 + +from flytekit.clients.friendly import SynchronousFlyteClient as _SynchronousFlyteClient +from flytekit.configuration import PlatformConfig +from flytekit.lazy_import.lazy_module import lazy_module +from flytekit.models import common as _common +from flytekit.models import filters as _filters +from flytekit.models import task as _task +from flytekit.models.core import identifier as _identifier + + +### This currently only works with unauthenticated requests +class RustSynchronousFlyteClient(_SynchronousFlyteClient): + """ + This is a low-level client that users can use to make direct gRPC service calls to the control plane. See the + :std:doc:`service spec `. This is more user-friendly interface than the + :py:class:`raw client ` so users should try to use this class + first. Create a client by :: + + RustSynchronousFlyteClient("your.domain:port", insecure=True) + # insecure should be True if your flyteadmin deployment doesn't have SSL enabled + + """ + + def __init__(self, cfg: PlatformConfig): + flyrs = lazy_module("flyrs") + self.cfg = cfg + self._raw = flyrs.FlyteClient(endpoint=self.cfg.endpoint) + + @property + def raw(self): + """ + Gives access to the raw client + :rtype: flyrs.FlyteClient + """ + return self._raw + + #################################################################################################################### + # + # Task Endpoints + # + #################################################################################################################### + + def create_task(self, task_identifer, task_spec): + """ + This will create a task definition in the Admin database. Once successful, the task object can be + retrieved via the client or viewed via the UI or command-line interfaces. + + .. note :: + + Overwrites are not supported so any request for a given project, domain, name, and version that exists in + the database must match the existing definition exactly. Furthermore, as long as the request + remains identical, calling this method multiple times will result in success. + + :param flytekit.models.core.identifier.Identifier task_identifer: The identifier for this task. + :param flytekit.models.task.TaskSpec task_spec: This is the actual definition of the task that + should be created. + :raises: TODO + """ + self._raw.create_task( + _task_pb2.TaskCreateRequest( + id=task_identifer.to_flyte_idl(), spec=task_spec.to_flyte_idl() + ).SerializeToString() + ) + + def list_task_ids_paginated(self, project, domain, limit=100, token=None, sort_by=None): + """ + This returns a page of identifiers for the tasks for a given project and domain. Filters can also be + specified. + + .. note :: + + This is a paginated API. Use the token field in the request to specify a page offset token. + The user of the API is responsible for providing this token. + + .. note :: + + If entries are added to the database between requests for different pages, it is possible to receive + entries on the second page that also appeared on the first. + + :param Text project: The namespace of the project to list. + :param Text domain: The domain space of the project to list. + :param int limit: [Optional] The maximum number of entries to return. Must be greater than 0. The maximum + page size is determined by the Flyte Admin Service configuration. If limit is greater than the maximum + page size, an exception will be raised. + :param Text token: [Optional] If specified, this specifies where in the rows of results to skip before reading. + If you previously retrieved a page response with token="foo" and you want the next page, + specify token="foo". Please see the notes for this function about the caveats of the paginated API. + :param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted. + :raises: TODO + :rtype: list[flytekit.models.common.NamedEntityIdentifier], Text + """ + identifier_list = self._raw.list_task_ids_paginated( + _common_pb2.NamedEntityIdentifierListRequest( + project=project, + domain=domain, + limit=limit, + token=token, + sort_by=None if sort_by is None else sort_by.to_flyte_idl(), + ).SerializeToString() + ) + ids = _task_pb2.IdentifierList() + ids.ParseFromString(identifier_list) + return ( + [_common.NamedEntityIdentifier.from_flyte_idl(identifier_pb) for identifier_pb in ids.entities], + str(ids.token), + ) + + def list_tasks_paginated(self, identifier, limit=100, token=None, filters=None, sort_by=None): + """ + This returns a page of task metadata for tasks in a given project and domain. Optionally, + specifying a name will limit the results to only tasks with that name in the given project and domain. + + .. note :: + + This is a paginated API. Use the token field in the request to specify a page offset token. + The user of the API is responsible for providing this token. + + .. note :: + + If entries are added to the database between requests for different pages, it is possible to receive + entries on the second page that also appeared on the first. + + :param flytekit.models.common.NamedEntityIdentifier identifier: NamedEntityIdentifier to list. + :param int limit: [Optional] The maximum number of entries to return. Must be greater than 0. The maximum + page size is determined by the Flyte Admin Service configuration. If limit is greater than the maximum + page size, an exception will be raised. + :param int token: [Optional] If specified, this specifies where in the rows of results to skip before reading. + If you previously retrieved a page response with token="foo" and you want the next page, + specify token="foo". Please see the notes for this function about the caveats of the paginated API. + :param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to + the query. If the filter is not supported, an exception will be raised. + :param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted. + :raises: TODO + :rtype: list[flytekit.models.task.Task], Text + """ + task_list = self._raw.list_tasks_paginated( + _common_pb2.ResourceListRequest( + id=identifier.to_flyte_idl(), + limit=limit, + token=token, + filters=_filters.FilterList(filters or []).to_flyte_idl(), + sort_by=None if sort_by is None else sort_by.to_flyte_idl(), + ).SerializeToString() + ) + tasks = _task_pb2.TaskList() + tasks.ParseFromString(task_list) + for pb in tasks.tasks: + pb.id.resource_type = _identifier.ResourceType.TASK + return ( + [_task.Task.from_flyte_idl(task_pb2) for task_pb2 in tasks.tasks], + str(tasks.token), + ) + + def get_task(self, id): + """ + This returns a single task for a given identifier. + :param flytekit.models.core.identifier.Identifier id: The ID representing a given task. + :raises: TODO + :rtype: flytekit.models.task.Task + """ + task = _task_pb2.Task() + task.ParseFromString(self._raw.get_task(_common_pb2.ObjectGetRequest(id=id.to_flyte_idl()).SerializeToString())) + return _task.Task.from_flyte_idl(task) diff --git a/flytekit/clients/raw.py b/flytekit/clients/raw.py index b9e35a8290..67a0baa770 100644 --- a/flytekit/clients/raw.py +++ b/flytekit/clients/raw.py @@ -2,21 +2,10 @@ import typing -import grpc from flyteidl.admin.project_pb2 import ProjectListRequest from flyteidl.admin.signal_pb2 import SignalList, SignalListRequest, SignalSetRequest, SignalSetResponse -from flyteidl.service import admin_pb2_grpc as _admin_service from flyteidl.service import dataproxy_pb2 as _dataproxy_pb2 -from flyteidl.service import dataproxy_pb2_grpc as dataproxy_service -from flyteidl.service import signal_pb2_grpc as signal_service -from flyteidl.service.dataproxy_pb2_grpc import DataProxyServiceStub - -from flytekit.clients.auth_helper import ( - get_channel, - upgrade_channel_to_authenticated, - upgrade_channel_to_proxy_authenticated, - wrap_exceptions_channel, -) + from flytekit.configuration import PlatformConfig from flytekit.loggers import logger @@ -35,8 +24,6 @@ class RawSynchronousFlyteClient(object): SynchronousFlyteClient(PlatformConfig(endpoint="a.b.com", insecure=True)) """ - _dataproxy_stub: DataProxyServiceStub - def __init__(self, cfg: PlatformConfig, **kwargs): """ Initializes a gRPC channel to the given Flyte Admin service. @@ -45,6 +32,17 @@ def __init__(self, cfg: PlatformConfig, **kwargs): url: The server address. insecure: if insecure is desired """ + from flyteidl.service import admin_pb2_grpc as _admin_service + from flyteidl.service import dataproxy_pb2_grpc as dataproxy_service + from flyteidl.service import signal_pb2_grpc as signal_service + + from flytekit.clients.auth_helper import ( + get_channel, + upgrade_channel_to_authenticated, + upgrade_channel_to_proxy_authenticated, + wrap_exceptions_channel, + ) + # Set the value here to match the limit in Admin, otherwise the client will cut off and the user gets a # StreamRemoved exception. # https://github.com/flyteorg/flyte/blob/e8588f3a04995a420559327e78c3f95fbf64dc01/flyteadmin/pkg/common/constants.go#L14 @@ -68,6 +66,8 @@ def __init__(self, cfg: PlatformConfig, **kwargs): @classmethod def with_root_certificate(cls, cfg: PlatformConfig, root_cert_file: str) -> RawSynchronousFlyteClient: + import grpc + b = None with open(root_cert_file, "rb") as fp: b = fp.read() diff --git a/flytekit/remote/remote.py b/flytekit/remote/remote.py index 5e1d3fb589..135af82a52 100644 --- a/flytekit/remote/remote.py +++ b/flytekit/remote/remote.py @@ -31,6 +31,7 @@ from flytekit import ImageSpec from flytekit.clients.friendly import SynchronousFlyteClient +from flytekit.clients.friendly_rs import RustSynchronousFlyteClient from flytekit.clients.helpers import iterate_node_executions, iterate_task_executions from flytekit.configuration import Config, FastSerializationSettings, ImageConfig, SerializationSettings from flytekit.core import constants, utils @@ -196,6 +197,7 @@ def __init__( config: Config, default_project: typing.Optional[str] = None, default_domain: typing.Optional[str] = None, + enable_rust: typing.Optional[bool] = False, data_upload_location: str = "flyte://my-s3-bucket/", **kwargs, ): @@ -216,6 +218,7 @@ def __init__( self._kwargs = kwargs self._client_initialized = False self._config = config + self.enable_rust = enable_rust # read config files, env vars, host, ssl options for admin client self._default_project = default_project self._default_domain = default_domain @@ -239,7 +242,10 @@ def context(self) -> FlyteContext: def client(self) -> SynchronousFlyteClient: """Return a SynchronousFlyteClient for additional operations.""" if not self._client_initialized: - self._client = SynchronousFlyteClient(self.config.platform, **self._kwargs) + if self.enable_rust: + self._client = RustSynchronousFlyteClient(self.config.platform, **self._kwargs) + else: + self._client = SynchronousFlyteClient(self.config.platform, **self._kwargs) self._client_initialized = True return self._client diff --git a/tests/flytekit/unit/clients/test_raw.py b/tests/flytekit/unit/clients/test_raw.py index ee4e516354..0534e1e481 100644 --- a/tests/flytekit/unit/clients/test_raw.py +++ b/tests/flytekit/unit/clients/test_raw.py @@ -6,19 +6,19 @@ from flytekit.configuration import PlatformConfig -@mock.patch("flytekit.clients.raw._admin_service") -@mock.patch("flytekit.clients.raw.grpc.insecure_channel") +@mock.patch("flyteidl.service.admin_pb2_grpc.AdminServiceStub") +@mock.patch("grpc.insecure_channel") def test_update_project(mock_channel, mock_admin): client = RawSynchronousFlyteClient(PlatformConfig(endpoint="a.b.com", insecure=True)) project = _project_pb2.Project(id="foo", name="name", description="description", state=_project_pb2.Project.ACTIVE) client.update_project(project) - mock_admin.AdminServiceStub().UpdateProject.assert_called_with(project, metadata=None) + mock_admin().UpdateProject.assert_called_with(project, metadata=None) -@mock.patch("flytekit.clients.raw._admin_service") -@mock.patch("flytekit.clients.raw.grpc.insecure_channel") +@mock.patch("flyteidl.service.admin_pb2_grpc.AdminServiceStub") +@mock.patch("grpc.insecure_channel") def test_list_projects_paginated(mock_channel, mock_admin): client = RawSynchronousFlyteClient(PlatformConfig(endpoint="a.b.com", insecure=True)) project_list_request = _project_pb2.ProjectListRequest(limit=100, token="", filters=None, sort_by=None) client.list_projects(project_list_request) - mock_admin.AdminServiceStub().ListProjects.assert_called_with(project_list_request, metadata=None) + mock_admin().ListProjects.assert_called_with(project_list_request, metadata=None)