-
Notifications
You must be signed in to change notification settings - Fork 59
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
fix: Add CODE_SNIPPET_USE_AUTO_CONFIG environment variable #883
fix: Add CODE_SNIPPET_USE_AUTO_CONFIG environment variable #883
Conversation
4aa12ed
to
c08ffc0
Compare
f18322e
to
a4f809f
Compare
const config = | ||
env.CODE_SNIPPET_USE_AUTO_CONFIG === "true" | ||
? 'Config.auto()' | ||
: isHttps |
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.
Could you just pass isHttps
in as the 2nd parameter to Config.for_endpoint
?
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.
For context, this follows the nested ternary pattern that I've seen e.g. here
flyteconsole/packages/oss-console/src/components/flytegraph/ReactFlow/transformDAGToReactFlowV2.tsx
Lines 199 to 205 in 7636e32
const typeOVerride = | |
// eslint-disable-next-line no-nested-ternary | |
isStaticGraph === true | |
? dTypes.staticNode | |
: isUnFetchedDynamicNode(node) | |
? dTypes.nestedMaxDepth | |
: undefined; |
Since python booleans aren't one-to-one with JS booleans, to pass in isHttps as a param it would have to look like
const insecure = isHttps ? "False" : "True"
... `Config.for_endpoint("${window.location.host}",${insecure})`
which I wasn't sure would be much clearer.
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.
Yeah, the reason I asked was for exactly the reason the ignored eslinter calls out
https://eslint.org/docs/latest/rules/no-nested-ternary
It's fine to use the existing style / pattern they have here -- when in Rome :)
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.
Gotcha! Okay, updated it here: df63f99
Signed-off-by: ddl-rliu <[email protected]>
0dfb7b8
to
df63f99
Compare
Signed-off-by: ddl-rliu <[email protected]>
df63f99
to
93aec03
Compare
🎉 This PR is included in version 1.17.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
TL;DR
The inputs/outputs Python code snippet leads to a "Failed to connect" error
Introduce the environment variable
CODE_SNIPPET_USE_AUTO_CONFIG
, to control whether the config object in the inputs/outputs Python code snippet is automatically constructed i.e.Config.auto()
. This will tend to use theadmin.endpoint
that users can set in their~/.flyte/config.yaml
It can be left unset to keep the current behavior e.g. uses
Config.for_endpoint(window.location.host)
Type
Are all requirements met?
Complete description
Users already configure flytekit in
~/.flyte/config.yaml
to setadmin.endpoint
to the correct gRPC endpoint. We can leverage this by usingConfig.auto()
auto config, and building the code snippet around this Config.Tested fix correctly shows the new code snippet when setting is enabled:
Tested fix uses current behavior when setting is not enabled:
Tracking Issue
flyteorg/flyte#5578