Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1d83d38dd | ||
|
|
d9d0dafe45 | ||
|
|
c3eaf0bf4a | ||
|
|
18b5bc6bd3 | ||
|
|
60ff7d06b0 | ||
|
|
2bbd0b34b5 | ||
|
|
36e46e2e47 | ||
|
|
eec7d83d98 | ||
|
|
d2b3026032 | ||
|
|
8275602372 |
@@ -56,7 +56,7 @@ https://github.com/windmill-labs/windmill/assets/122811744/0b132cd1-ee67-4505-82
|
||||
- [Architecture](#architecture)
|
||||
- [How to self-host](#how-to-self-host)
|
||||
- [Docker compose](#docker-compose)
|
||||
- [Kubernetes (k8s) and Helm chartss](#kubernetes-k8s-and-helm-chartss)
|
||||
- [Kubernetes (k8s) and Helm charts](#kubernetes-k8s-and-helm-charts)
|
||||
- [Run from binaries](#run-from-binaries)
|
||||
- [OAuth, SSO \& SMTP](#oauth-sso--smtp)
|
||||
- [Commercial license](#commercial-license)
|
||||
@@ -240,7 +240,7 @@ From there, you can follow the setup app and create other users.
|
||||
|
||||
More details in [Self-Host Documention](https://www.windmill.dev/docs/advanced/self_host#docker).
|
||||
|
||||
### Kubernetes (k8s) and Helm chartss
|
||||
### Kubernetes (k8s) and Helm charts
|
||||
|
||||
We publish helm charts at:
|
||||
<https://github.com/windmill-labs/windmill-helm-charts>.
|
||||
@@ -363,7 +363,7 @@ it being synced automatically everyday.
|
||||
| SMTP_PASSWORD | None | password for the smtp server to send invite emails | Server |
|
||||
| SMTP_TLS_IMPLICIT | false | https://docs.rs/mail-send/latest/mail_send/struct.SmtpClientBuilder.html#method.implicit_tlsemails | Server |
|
||||
| CREATE_WORKSPACE_REQUIRE_SUPERADMIN | true | If true, only superadmin can create workspaces | Server |
|
||||
| GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE | None | Path to a script to run when a root job fails. The script will be run in and from the admins workspace | Server |
|
||||
| GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE | None | Path to a script or flow to run when a root job fails. The path needs to be prefixed with either `script/` or `flow/` to indicate the kind of error handler being used (assuming `script/` by default). The error handler will be run in and from the admins workspace | Server |
|
||||
| WHITELIST_ENVS | None | List of envs variables, separated by a ',' that are whitelisted as being safe to passthrough the workers | Worker |
|
||||
| SAML_METADATA | None | SAML Metadata URL to enable SAML SSO (EE only) | Server |
|
||||
| SECRET_SALT | None | Secret Salt used for encryption and decryption of secrets. If defined, the secrets will not be decryptable unless the right salt is passed in, which is the case for the workers and the server | Server + Worker |
|
||||
@@ -416,4 +416,4 @@ running options.
|
||||
|
||||
## Copyright
|
||||
|
||||
Windmill Labs, Inc 2023
|
||||
Windmill Labs, Inc 2023
|
||||
|
||||
393
backend/Cargo.lock
generated
393
backend/Cargo.lock
generated
@@ -587,23 +587,23 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "aws-config"
|
||||
version = "0.57.2"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2bf00cb9416daab4ce4927c54ebe63c08b9caf4d7b9314b6d7a4a2c5a1afb09"
|
||||
checksum = "8e245d7c741a8e4b23133f36750c4bcb3938a66ac49510caaf8b83afd52db1ec"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-runtime",
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-http 0.60.0",
|
||||
"aws-runtime 1.0.0",
|
||||
"aws-sdk-sso",
|
||||
"aws-sdk-ssooidc",
|
||||
"aws-sdk-sts",
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-json",
|
||||
"aws-smithy-runtime",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-json 0.60.0",
|
||||
"aws-smithy-runtime 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-types 1.0.0",
|
||||
"bytes",
|
||||
"fastrand 2.0.1",
|
||||
"hex",
|
||||
@@ -622,9 +622,21 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb9073c88dbf12f68ce7d0e149f989627a1d1ae3d2b680459f04ccc29d1cbd0f"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-credential-types"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6dec6f3d42983be70a113f999476185e124884f43f4d60129c7157aede7bda1"
|
||||
dependencies = [
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@@ -634,10 +646,26 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24067106d09620cf02d088166cdaedeaca7146d4d499c41b37accecbea11b246"
|
||||
dependencies = [
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"aws-types 0.57.2",
|
||||
"bytes",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-http"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "361c4310fdce94328cc2d1ca0c8a48c13f43009c61d3367585685a50ca8c66b6"
|
||||
dependencies = [
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-types 1.0.0",
|
||||
"bytes",
|
||||
"http",
|
||||
"http-body",
|
||||
@@ -651,15 +679,36 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc6ee0152c06d073602236a4e94a8c52a327d310c1ecd596570ce795af8777ff"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-sigv4",
|
||||
"aws-smithy-async",
|
||||
"aws-credential-types 0.57.2",
|
||||
"aws-http 0.57.2",
|
||||
"aws-sigv4 0.57.2",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-eventstream",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"aws-types 0.57.2",
|
||||
"fastrand 2.0.1",
|
||||
"http",
|
||||
"percent-encoding",
|
||||
"tracing",
|
||||
"uuid 1.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-runtime"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36ba3ad97d674bfaeed684d528a07cee6e81cbf16e6d6c7e272a130b5e71e6b9"
|
||||
dependencies = [
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-http 0.60.0",
|
||||
"aws-sigv4 1.0.0",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-types 1.0.0",
|
||||
"fastrand 2.0.1",
|
||||
"http",
|
||||
"percent-encoding",
|
||||
@@ -673,20 +722,20 @@ version = "0.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf188e8af89adb0b41ae2f21b6c666c618959e40242e79aaa43fafa9c0c90a8a"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-runtime",
|
||||
"aws-sigv4",
|
||||
"aws-smithy-async",
|
||||
"aws-credential-types 0.57.2",
|
||||
"aws-http 0.57.2",
|
||||
"aws-runtime 0.57.2",
|
||||
"aws-sigv4 0.57.2",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-checksums",
|
||||
"aws-smithy-eventstream",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-json",
|
||||
"aws-smithy-runtime",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-xml",
|
||||
"aws-types",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-json 0.57.2",
|
||||
"aws-smithy-runtime 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"aws-smithy-xml 0.57.2",
|
||||
"aws-types 0.57.2",
|
||||
"bytes",
|
||||
"http",
|
||||
"http-body",
|
||||
@@ -699,20 +748,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-sso"
|
||||
version = "0.36.0"
|
||||
version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2eb8158015232b4596ccef74a205600398e152d704b40b7ec9f486092474d7fa"
|
||||
checksum = "5786afe1fd164e53f108b2bd4982a31c5a821dc1677d05a12de65ebcc6ede52a"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-runtime",
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-json",
|
||||
"aws-smithy-runtime",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-http 0.60.0",
|
||||
"aws-runtime 1.0.0",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-json 0.60.0",
|
||||
"aws-smithy-runtime 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-types 1.0.0",
|
||||
"bytes",
|
||||
"http",
|
||||
"regex",
|
||||
@@ -721,20 +770,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-ssooidc"
|
||||
version = "0.36.0"
|
||||
version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36a1493e1c57f173e53621935bfb5b6217376168dbdb4cd459aebcf645924a48"
|
||||
checksum = "31569ac7750ebc3097058c1e72d79576e16b3fb262aa0d6510188bff623f9804"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-runtime",
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-json",
|
||||
"aws-smithy-runtime",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-http 0.60.0",
|
||||
"aws-runtime 1.0.0",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-json 0.60.0",
|
||||
"aws-smithy-runtime 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-types 1.0.0",
|
||||
"bytes",
|
||||
"http",
|
||||
"regex",
|
||||
@@ -743,22 +792,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-sts"
|
||||
version = "0.36.0"
|
||||
version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e032b77f5cd1dd3669d777a38ac08cbf8ec68e29460d4ef5d3e50cffa74ec75a"
|
||||
checksum = "9b1d955bacd8c3637908a40a4af2f7a732461ee7d95ec02599a3610ee55781d7"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
"aws-runtime",
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-json",
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-http 0.60.0",
|
||||
"aws-runtime 1.0.0",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-json 0.60.0",
|
||||
"aws-smithy-query",
|
||||
"aws-smithy-runtime",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-xml",
|
||||
"aws-types",
|
||||
"aws-smithy-runtime 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"aws-smithy-xml 0.60.0",
|
||||
"aws-types 1.0.0",
|
||||
"http",
|
||||
"regex",
|
||||
"tracing",
|
||||
@@ -770,10 +819,10 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64f81a6abc4daab06b53cabf27c54189928893283093e37164ca53aa47488a5b"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-credential-types 0.57.2",
|
||||
"aws-smithy-eventstream",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
"hex",
|
||||
@@ -791,6 +840,29 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-sigv4"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4d07e2f2fc32acb7423d054ec8ba2b361dafc95fabc5a211baf4a566571d20e"
|
||||
dependencies = [
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
"hex",
|
||||
"hmac",
|
||||
"http",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"regex",
|
||||
"sha2 0.10.8",
|
||||
"time",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-async"
|
||||
version = "0.57.2"
|
||||
@@ -802,14 +874,25 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-async"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbfa248f7f966d73e325dbc85851a5500042b6d96e3c3b535a8527707f36fe4"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-checksums"
|
||||
version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fb5701fbfb40600cc0fa547f318552dfd4e632b2099bd75d95fb0faae70675d"
|
||||
dependencies = [
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"bytes",
|
||||
"crc32c",
|
||||
"crc32fast",
|
||||
@@ -829,7 +912,7 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b33fa99f928a5815b94ee07e1377901bcf51aa749034a2c802dc38f9dcfacf5"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"bytes",
|
||||
"crc32fast",
|
||||
]
|
||||
@@ -841,8 +924,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7972373213d1d6e619c0edc9dda2d6634154e4ed75c5e0b2bf065cd5ec9f0d1"
|
||||
dependencies = [
|
||||
"aws-smithy-eventstream",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"bytes",
|
||||
"bytes-utils",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-http"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b1de8aee22f67de467b2e3d0dd0fb30859dc53f579a63bd5381766b987db644"
|
||||
dependencies = [
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"bytes",
|
||||
"bytes-utils",
|
||||
"futures-core",
|
||||
@@ -861,16 +964,25 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6d64d5af16dd585de9ff6c606423c1aaad47c6baa38de41c2beb32ef21c6645"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-types 0.57.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-json"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a46dd338dc9576d6a6a5b5a19bd678dcad018ececee11cf28ecd7588bd1a55c"
|
||||
dependencies = [
|
||||
"aws-smithy-types 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-query"
|
||||
version = "0.57.2"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7527bf5335154ba1b285479c50b630e44e93d1b4a759eaceb8d0bf9fbc82caa5"
|
||||
checksum = "feb5b8c7a86d4b6399169670723b7e6f21a39fc833a30f5c5a2f997608178129"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"urlencoding",
|
||||
]
|
||||
|
||||
@@ -880,10 +992,34 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "839b363adf3b2bdab2742a1f540fec23039ea8bc9ec0f9f61df48470cfe5527b"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-http 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"bytes",
|
||||
"fastrand 2.0.1",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"rustls 0.21.9",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-runtime"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "064b808143d80b50744b1b22cce801238a545b84859c6cf8e275997252dd1d25"
|
||||
dependencies = [
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-http 0.60.0",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"bytes",
|
||||
"fastrand 2.0.1",
|
||||
"http",
|
||||
@@ -904,8 +1040,23 @@ version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f24ecc446e62c3924539e7c18dec8038dba4fdf8718d5c2de62f9d2fecca8ba9"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-types",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"bytes",
|
||||
"http",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-runtime-api"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d27c3235d4972ed976b5c1a82286e7c4457f618f3c2ae6d4ae44f081dd24575"
|
||||
dependencies = [
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"bytes",
|
||||
"http",
|
||||
"pin-project-lite",
|
||||
@@ -937,6 +1088,27 @@ dependencies = [
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-types"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fc32035dc0636a8583cf0c6dd7f1e6d5404103b836d26228b8730907a88d9f"
|
||||
dependencies = [
|
||||
"base64-simd",
|
||||
"bytes",
|
||||
"bytes-utils",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"itoa",
|
||||
"num-integer",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"ryu",
|
||||
"serde",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-xml"
|
||||
version = "0.57.2"
|
||||
@@ -946,16 +1118,40 @@ dependencies = [
|
||||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-xml"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ec40d74a67fd395bc3f6b4ccbdf1543672622d905ef3f979689aea5b730cb95"
|
||||
dependencies = [
|
||||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-types"
|
||||
version = "0.57.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "048bbf1c24cdf4eb1efcdc243388a93a90ebf63979e25fc1c7b8cbd9cb6beb38"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-runtime-api",
|
||||
"aws-smithy-types",
|
||||
"aws-credential-types 0.57.2",
|
||||
"aws-smithy-async 0.57.2",
|
||||
"aws-smithy-runtime-api 0.57.2",
|
||||
"aws-smithy-types 0.57.2",
|
||||
"http",
|
||||
"rustc_version 0.4.0",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-types"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b18c0eb301cce69298555c4884795497c67b3bd511aa3f07470382f4bf3ef043"
|
||||
dependencies = [
|
||||
"aws-credential-types 1.0.0",
|
||||
"aws-smithy-async 1.0.1",
|
||||
"aws-smithy-runtime-api 1.0.1",
|
||||
"aws-smithy-types 1.0.1",
|
||||
"http",
|
||||
"rustc_version 0.4.0",
|
||||
"tracing",
|
||||
@@ -9701,6 +9897,7 @@ dependencies = [
|
||||
"rsmq_async",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sql-builder",
|
||||
"sqlx 0.7.3",
|
||||
"tokio",
|
||||
|
||||
@@ -83,7 +83,7 @@ candle-core.workspace = true
|
||||
candle-transformers.workspace = true
|
||||
candle-nn.workspace = true
|
||||
aws-sdk-s3 = "0.36.0"
|
||||
aws-config = "0.57.2"
|
||||
aws-config = "1.0.0"
|
||||
polars = { version = "0.35.2", features = ["lazy", "parquet", "aws", "csv", "dtype-full"] }
|
||||
polars-io = { version = "0.35.2", features = ["csv"] }
|
||||
object_store = { version = "0.8.0", features = ["aws"] }
|
||||
|
||||
@@ -36,7 +36,7 @@ use sqlx::{query_scalar, types::Uuid, FromRow, Postgres, Transaction};
|
||||
use tower_http::cors::{Any, CorsLayer};
|
||||
use urlencoding::encode;
|
||||
use windmill_audit::{audit_log, ActionKind};
|
||||
use windmill_common::worker::{CUSTOM_TAGS_PER_WORKSPACE, SERVER_CONFIG};
|
||||
use windmill_common::worker::{to_raw_value, CUSTOM_TAGS_PER_WORKSPACE, SERVER_CONFIG};
|
||||
use windmill_common::{
|
||||
db::UserDB,
|
||||
error::{self, to_anyhow, Error},
|
||||
@@ -50,8 +50,8 @@ use windmill_common::{
|
||||
};
|
||||
use windmill_common::{get_latest_deployed_hash_for_path, BASE_URL};
|
||||
use windmill_queue::{
|
||||
add_completed_job_error, empty_args, get_queued_job, get_result_by_id_from_running_flow,
|
||||
job_is_complete, push, CanceledBy, PushArgs, PushIsolationLevel,
|
||||
add_completed_job_error, get_queued_job, get_result_by_id_from_running_flow, job_is_complete,
|
||||
push, CanceledBy, PushArgs, PushIsolationLevel,
|
||||
};
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
@@ -1564,6 +1564,53 @@ fn decode_payload<D: DeserializeOwned>(t: String) -> anyhow::Result<D> {
|
||||
serde_json::from_slice(vec.as_slice()).context("invalid json")
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct DecodeQuery {
|
||||
pub include_query: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct IncludeQuery {
|
||||
pub include_query: Option<String>,
|
||||
}
|
||||
|
||||
pub struct DecodeQueries(pub HashMap<String, Box<RawValue>>);
|
||||
|
||||
#[axum::async_trait]
|
||||
impl<S> FromRequest<S, axum::body::Body> for DecodeQueries
|
||||
where
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = Response;
|
||||
|
||||
async fn from_request(
|
||||
req: Request<axum::body::Body>,
|
||||
_state: &S,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
let query = req.uri().query().unwrap_or("");
|
||||
let include_query = serde_urlencoded::from_str::<IncludeQuery>(query)
|
||||
.map(|x| x.include_query)
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap_or_default();
|
||||
let parse_query_args = include_query
|
||||
.split(",")
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
let mut args = HashMap::new();
|
||||
if !parse_query_args.is_empty() {
|
||||
let queries =
|
||||
serde_urlencoded::from_str::<HashMap<String, String>>(query).unwrap_or_default();
|
||||
parse_query_args.iter().for_each(|h| {
|
||||
if let Some(v) = queries.get(h) {
|
||||
args.insert(h.to_string(), to_raw_value(v));
|
||||
}
|
||||
});
|
||||
}
|
||||
Ok(DecodeQueries(args))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_raw_string(
|
||||
raw_string: Option<String>,
|
||||
mut args: serde_json::Map<String, serde_json::Value>,
|
||||
@@ -1949,6 +1996,7 @@ pub async fn run_wait_result_job_by_path_get(
|
||||
Extension(db): Extension<DB>,
|
||||
Path((w_id, script_path)): Path<(String, StripPath)>,
|
||||
Query(run_query): Query<RunJobQuery>,
|
||||
DecodeQueries(queries): DecodeQueries,
|
||||
) -> error::Result<Response> {
|
||||
#[cfg(feature = "enterprise")]
|
||||
check_license_key_valid().await?;
|
||||
@@ -1961,13 +2009,17 @@ pub async fn run_wait_result_job_by_path_get(
|
||||
.map(decode_payload)
|
||||
.map(|x| x.map_err(|e| Error::InternalErr(e.to_string())));
|
||||
|
||||
let payload_args = if let Some(payload) = payload_r {
|
||||
let mut payload_args = if let Some(payload) = payload_r {
|
||||
payload?
|
||||
} else {
|
||||
HashMap::new()
|
||||
};
|
||||
queries.iter().for_each(|(k, v)| {
|
||||
payload_args.insert(k.to_string(), v.clone());
|
||||
});
|
||||
|
||||
let args = PushArgs { extra: payload_args, args: sqlx::types::Json(empty_args()) };
|
||||
let inner_args: HashMap<String, Box<RawValue>> = HashMap::new();
|
||||
let args = PushArgs { extra: payload_args, args: sqlx::types::Json(inner_args) };
|
||||
|
||||
check_queue_too_long(&db, QUEUE_LIMIT_WAIT_RESULT.or(run_query.queue_limit)).await?;
|
||||
let script_path = script_path.to_path();
|
||||
@@ -2013,8 +2065,8 @@ pub async fn run_wait_result_flow_by_path_get(
|
||||
Extension(user_db): Extension<UserDB>,
|
||||
Extension(db): Extension<DB>,
|
||||
Path((w_id, flow_path)): Path<(String, StripPath)>,
|
||||
|
||||
Query(run_query): Query<RunJobQuery>,
|
||||
DecodeQueries(queries): DecodeQueries,
|
||||
) -> error::Result<Response> {
|
||||
#[cfg(feature = "enterprise")]
|
||||
check_license_key_valid().await?;
|
||||
@@ -2028,12 +2080,16 @@ pub async fn run_wait_result_flow_by_path_get(
|
||||
.map(decode_payload)
|
||||
.map(|x| x.map_err(|e| Error::InternalErr(e.to_string())));
|
||||
|
||||
let payload_args = if let Some(payload) = payload_r {
|
||||
let mut payload_args = if let Some(payload) = payload_r {
|
||||
payload?
|
||||
} else {
|
||||
HashMap::new()
|
||||
};
|
||||
|
||||
queries.iter().for_each(|(k, v)| {
|
||||
payload_args.insert(k.to_string(), v.clone());
|
||||
});
|
||||
|
||||
let args = PushArgs { extra: payload_args, args: sqlx::types::Json(HashMap::new()) };
|
||||
|
||||
run_wait_result_flow_by_path_internal(
|
||||
|
||||
@@ -814,6 +814,8 @@ async fn raw_script_by_path(
|
||||
}
|
||||
let path = path
|
||||
.trim_end_matches(".py")
|
||||
.trim_end_matches(".bun.ts")
|
||||
.trim_end_matches(".deno.ts")
|
||||
.trim_end_matches(".ts")
|
||||
.trim_end_matches(".go")
|
||||
.trim_end_matches(".sh");
|
||||
|
||||
@@ -38,4 +38,5 @@ futures-core.workspace = true
|
||||
itertools.workspace = true
|
||||
async-recursion.workspace = true
|
||||
bigdecimal.workspace = true
|
||||
axum.workspace = true
|
||||
axum.workspace = true
|
||||
serde_urlencoded.workspace = true
|
||||
@@ -50,8 +50,7 @@ use windmill_common::{
|
||||
},
|
||||
flows::{add_virtual_items_if_necessary, FlowModuleValue, FlowValue},
|
||||
jobs::{
|
||||
get_payload_tag_from_prefixed_path, script_path_to_payload, CompletedJob, JobKind,
|
||||
JobPayload, QueuedJob, RawCode,
|
||||
get_payload_tag_from_prefixed_path, CompletedJob, JobKind, JobPayload, QueuedJob, RawCode,
|
||||
},
|
||||
oauth2::WORKSPACE_SLACK_BOT_TOKEN_PATH,
|
||||
schedule::Schedule,
|
||||
@@ -579,12 +578,13 @@ pub async fn run_error_handler<
|
||||
is_global: bool,
|
||||
) -> Result<(), Error> {
|
||||
let w_id = &queued_job.workspace_id;
|
||||
let script_w_id = if is_global { "admins" } else { w_id }; // script workspace id
|
||||
let handler_w_id = if is_global { "admins" } else { w_id }; // script workspace id
|
||||
let job_id = queued_job.id;
|
||||
let (job_payload, tag) = script_path_to_payload(&error_handler_path, db, script_w_id).await?;
|
||||
let (job_payload, tag) =
|
||||
get_payload_tag_from_prefixed_path(&error_handler_path, db, handler_w_id).await?;
|
||||
|
||||
let mut extra = HashMap::new();
|
||||
extra.insert("workspace_id".to_string(), to_raw_value(&w_id));
|
||||
extra.insert("workspace_id".to_string(), to_raw_value(&handler_w_id));
|
||||
extra.insert("job_id".to_string(), to_raw_value(&job_id));
|
||||
extra.insert("path".to_string(), to_raw_value(&queued_job.script_path));
|
||||
extra.insert(
|
||||
@@ -604,7 +604,7 @@ pub async fn run_error_handler<
|
||||
// TODO(gbouv): REMOVE THIS after December 1st 2023 and ping users to re-save their error handlers
|
||||
if error_handler_path
|
||||
.to_string()
|
||||
.eq("hub/5792/workspace-or-schedule-error-handler-slack")
|
||||
.eq("script/hub/5792/workspace-or-schedule-error-handler-slack")
|
||||
{
|
||||
// default slack error handler being used -> we need to inject the slack token
|
||||
let slack_resource = format!("$res:{WORKSPACE_SLACK_BOT_TOKEN_PATH}");
|
||||
@@ -628,7 +628,7 @@ pub async fn run_error_handler<
|
||||
let (uuid, tx) = push(
|
||||
&db,
|
||||
tx,
|
||||
script_w_id,
|
||||
handler_w_id,
|
||||
job_payload,
|
||||
PushArgs { extra, args: result.to_owned() },
|
||||
if is_global {
|
||||
@@ -682,12 +682,19 @@ pub async fn send_error_to_global_handler<
|
||||
result: Json<&'a T>,
|
||||
) -> Result<(), Error> {
|
||||
if let Some(ref global_error_handler) = *GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE {
|
||||
let prefixed_global_error_handler_path = if global_error_handler.starts_with("script/")
|
||||
|| global_error_handler.starts_with("flow/")
|
||||
{
|
||||
global_error_handler.clone()
|
||||
} else {
|
||||
format!("script/{}", global_error_handler)
|
||||
};
|
||||
run_error_handler(
|
||||
rsmq,
|
||||
queued_job,
|
||||
db,
|
||||
result,
|
||||
global_error_handler,
|
||||
&prefixed_global_error_handler_path,
|
||||
None,
|
||||
true,
|
||||
)
|
||||
@@ -754,7 +761,7 @@ pub async fn send_error_to_workspace_handler<
|
||||
queued_job,
|
||||
db,
|
||||
result,
|
||||
&error_handler.strip_prefix("script/").unwrap(),
|
||||
&error_handler,
|
||||
error_handler_extra_args,
|
||||
false,
|
||||
)
|
||||
@@ -1979,12 +1986,9 @@ where
|
||||
let content_type_header = headers_map.get(CONTENT_TYPE);
|
||||
let content_type = content_type_header.and_then(|value| value.to_str().ok());
|
||||
let query = Query::<RequestQuery>::try_from_uri(req.uri()).unwrap().0;
|
||||
let extra = build_extra(&headers_map, query.include_header);
|
||||
let raw = query.raw.as_ref().is_some_and(|x| *x);
|
||||
(
|
||||
content_type,
|
||||
build_extra(&headers_map, query.include_header),
|
||||
raw,
|
||||
)
|
||||
(content_type, extra, raw)
|
||||
};
|
||||
|
||||
if content_type.is_none() || content_type.unwrap().starts_with("application/json") {
|
||||
@@ -2067,7 +2071,7 @@ impl PushArgs<HashMap<String, Box<RawValue>>> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn empty_args() -> Box<RawValue> {
|
||||
pub fn empty_result() -> Box<RawValue> {
|
||||
return JsonRawValue::from_string("{}".to_string()).unwrap();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ use windmill_common::{
|
||||
DB, IS_READY, METRICS_DEBUG_ENABLED, METRICS_ENABLED,
|
||||
};
|
||||
use windmill_queue::{
|
||||
canceled_job_to_result, empty_args, get_queued_job, pull, push, register_metric, CanceledBy,
|
||||
canceled_job_to_result, empty_result, get_queued_job, pull, push, register_metric, CanceledBy,
|
||||
PushArgs, PushIsolationLevel, WrappedError, HTTP_CLIENT,
|
||||
};
|
||||
|
||||
@@ -1466,7 +1466,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
|
||||
.send(JobCompleted {
|
||||
job: Arc::new(job),
|
||||
success: true,
|
||||
result: empty_args(),
|
||||
result: empty_result(),
|
||||
logs: String::new(),
|
||||
mem_peak: 0,
|
||||
cached_res_path: None,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import AutoComplete from 'simple-svelte-autocomplete'
|
||||
import { Pen } from 'lucide-svelte'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export let customValue: boolean
|
||||
@@ -13,16 +13,11 @@
|
||||
export let valid: boolean
|
||||
export let disableCustomValue: boolean = false
|
||||
|
||||
let autoCompleteItems = enum_ ?? []
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
onMount(() => {
|
||||
autoCompleteItems = enum_ ?? []
|
||||
})
|
||||
</script>
|
||||
|
||||
<AutoComplete
|
||||
items={autoCompleteItems}
|
||||
items={enum_ ?? []}
|
||||
bind:selectedItem={value}
|
||||
inputClassName={twMerge(
|
||||
'bg-surface-secondary flex',
|
||||
|
||||
@@ -6,7 +6,14 @@
|
||||
import type { Schema, SupportedLanguage } from '$lib/common'
|
||||
import { enterpriseLicense, workspaceStore } from '$lib/stores'
|
||||
import { emptySchema, emptyString, sendUserToast, tryEvery } from '$lib/utils'
|
||||
import { JobService, Script, ScriptService, WorkspaceService } from '$lib/gen'
|
||||
import {
|
||||
FlowService,
|
||||
JobService,
|
||||
Script,
|
||||
ScriptService,
|
||||
WorkspaceService,
|
||||
type Flow
|
||||
} from '$lib/gen'
|
||||
import { inferArgs } from '$lib/infer'
|
||||
|
||||
import { CheckCircle2, Loader2, RotateCw, XCircle } from 'lucide-svelte'
|
||||
@@ -86,6 +93,7 @@
|
||||
}
|
||||
|
||||
async function loadHandlerScriptArgs(p: string, defaultArgs: string[] = []) {
|
||||
console.log(p)
|
||||
try {
|
||||
let schema: Schema | undefined = emptySchema()
|
||||
if (p.startsWith('hub/')) {
|
||||
@@ -99,8 +107,11 @@
|
||||
await inferArgs(hubScript.language as SupportedLanguage, hubScript.content ?? '', schema)
|
||||
}
|
||||
} else {
|
||||
const script = await ScriptService.getScriptByPath({ workspace: $workspaceStore!, path: p })
|
||||
schema = script.schema as Schema
|
||||
let scriptOrFlow: Script | Flow =
|
||||
customHandlerKind === 'script'
|
||||
? await ScriptService.getScriptByPath({ workspace: $workspaceStore!, path: p })
|
||||
: await FlowService.getFlowByPath({ workspace: $workspaceStore!, path: p })
|
||||
schema = scriptOrFlow.schema as Schema
|
||||
}
|
||||
if (schema && schema.properties) {
|
||||
for (let key in schema.properties) {
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
}
|
||||
}}
|
||||
options={{
|
||||
right: 'Early return sync endpoint at a node'
|
||||
right: 'Early return sync endpoint at a top-level step'
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@
|
||||
workspaceToDeployTo = settings.deploy_to
|
||||
webhook = settings.webhook
|
||||
openaiResourceInitialPath = settings.openai_resource_path
|
||||
errorHandlerItemKind = settings.error_handler?.split('/')[0] as 'flow' | 'script'
|
||||
errorHandlerScriptPath = (settings.error_handler ?? '').split('/').slice(1).join('/')
|
||||
errorHandlerInitialScriptPath = errorHandlerScriptPath
|
||||
errorHandlerMutedOnCancel = settings.error_handler_muted_on_cancel
|
||||
|
||||
BIN
python-client/wmill/wmill/AppPreview.23783724.js
Normal file
BIN
python-client/wmill/wmill/AppPreview.23783724.js
Normal file
Binary file not shown.
BIN
python-client/wmill/wmill/AppPreview.23783724.js.1
Normal file
BIN
python-client/wmill/wmill/AppPreview.23783724.js.1
Normal file
Binary file not shown.
138
python-client/wmill/wmill/flow.py
Normal file
138
python-client/wmill/wmill/flow.py
Normal file
@@ -0,0 +1,138 @@
|
||||
import functools
|
||||
import ast
|
||||
import inspect
|
||||
import yaml
|
||||
from graphlib import TopologicalSorter
|
||||
|
||||
def flow(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
class Edge(object):
|
||||
def __init__(self, _node, _path):
|
||||
self._node = _node
|
||||
self._path = _path
|
||||
# print("DECL EDGE: node: " + str(self._node) + " path: " + str(self._path))
|
||||
|
||||
def __getattr__(self, attr):
|
||||
return Edge(self._node, self._path + [attr])
|
||||
|
||||
def __str__(self):
|
||||
return f"EDGE: {self._node}({self._path})"
|
||||
|
||||
class Node(object):
|
||||
def __init__(self, _id, _deps, _f):
|
||||
self._id = _id
|
||||
self._deps = _deps
|
||||
self._f = _f
|
||||
# print("DECL NODE: id: " + str(self._id) + ", deps: " + str([f"{k}={v.__str__()}" for k, v in self._deps.items()]))
|
||||
|
||||
|
||||
def __getattr__(self, attr):
|
||||
return Edge(self, [attr])
|
||||
|
||||
def __str__(self):
|
||||
k_v = [f"{k}={v.__str__()}" for k, v in self._deps.items()]
|
||||
return f"{self._id}({k_v})"
|
||||
|
||||
def step(f):
|
||||
# print("DECL F: " + f.__name__)
|
||||
# code = inspect.getsource(f)
|
||||
# print(code)
|
||||
# print(ast.dump(ast.parse(code)))
|
||||
# print(ast.unparse(ast.parse(code)))
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
kwargs.update(dict(zip(f.__code__.co_varnames, args)))
|
||||
for k, v in kwargs.items():
|
||||
if isinstance(v, Node):
|
||||
kwargs[k] = Edge(v, [])
|
||||
return Node(f.__name__, kwargs, f)
|
||||
|
||||
return wrapper
|
||||
|
||||
@step
|
||||
def d():
|
||||
return 32
|
||||
|
||||
@step
|
||||
def a(a):
|
||||
import pandas
|
||||
return 32
|
||||
|
||||
@step
|
||||
def b(b):
|
||||
import pandas
|
||||
return 32
|
||||
|
||||
@step
|
||||
def c(x, y):
|
||||
return x + y + 1
|
||||
|
||||
def flow():
|
||||
r_a = a(d())
|
||||
r_b = b(2)
|
||||
r_c = c(r_a, r_b)
|
||||
return r_c
|
||||
|
||||
def get_edges_and_nodes(graph):
|
||||
edges = {}
|
||||
nodes = [graph]
|
||||
all_nodes = []
|
||||
seen = set()
|
||||
while nodes:
|
||||
node = nodes.pop()
|
||||
id = node._id
|
||||
if id in seen:
|
||||
continue
|
||||
all_nodes.append(node)
|
||||
seen.add(id)
|
||||
for _, v in node._deps.items():
|
||||
if isinstance(v, Edge):
|
||||
if id not in edges:
|
||||
edges[id] = []
|
||||
edges[id].append(v._node._id)
|
||||
nodes.append(v._node)
|
||||
return edges, {n._id: n for n in all_nodes}
|
||||
|
||||
def render(graph):
|
||||
edges, all_nodes = get_edges_and_nodes(graph)
|
||||
# print(edges)
|
||||
# print(all_nodes)
|
||||
ts = TopologicalSorter(edges)
|
||||
sortd = tuple(ts.static_order())
|
||||
modules_f = [[id, all_nodes[id]] for id in sortd]
|
||||
files = [ n._f for n in all_nodes.values()]
|
||||
sources = gen_sources(files)
|
||||
print(sources)
|
||||
modules = [{"id": k, "lang": "python", "content": render_f(v._f)} for k, v in modules_f]
|
||||
return yaml.dump(modules)
|
||||
|
||||
def gen_module_sources(source):
|
||||
pass
|
||||
|
||||
def gen_sources(files):
|
||||
files = set(files)
|
||||
asts = []
|
||||
sources = {}
|
||||
for f in files:
|
||||
asts.append(ast.parse(inspect.getsource(f)))
|
||||
|
||||
for astf in asts:
|
||||
for node in astf.body:
|
||||
if isinstance(node, ast.FunctionDef):
|
||||
print(node.args)
|
||||
code = ast.unparse(node.body)
|
||||
sources[node.name] = code
|
||||
|
||||
return sources
|
||||
|
||||
def render_f(f):
|
||||
code = inspect.getsource(f)
|
||||
return ast.unparse(ast.parse(code))
|
||||
|
||||
rendered = render(flow())
|
||||
Reference in New Issue
Block a user