feat: make path and build field in dataflow file more flexible#1098
feat: make path and build field in dataflow file more flexible#1098drindr wants to merge 0 commit intodora-rs:mainfrom
path and build field in dataflow file more flexible#1098Conversation
|
Hi, quick question, which env is passed to the path command in case of distributed dataflow? The CLI's, the Daemon's? which computer? |
I'm not so familiar with the distributed feature yet. The env is defined in the dataflow.yml. As it is deserialised with the crate In addition, it cannot use the env variables from the cli directly. The variables must "be declared” in the yaml file. ...
env:
DORA_HOME: $DORA
WITH_DEFAULT: ${DEFAULT: FOO}
BAR: /path/to/bar
...Those variables will be expanded when execute commands like |
|
Ok that makes sense! |
phil-opp
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I wonder why we only support quoted parts in build fields, but not in args? And maybe we should also support env variable in build fields for consistency?
Thanks for raising this! I think we should discuss whether we want to change this behavior. Right now, the dataflow is deserialized in the CLI, so all env variables are expanded there. However, this might not want we want if the binaries are run on a different machine. For example, consider the $HOME variable, which might be something like
This limitation might be a bit annoying, but it's probably a good starting point until we decide on where to expand env variables. |
|
Thanks for your response.
|
|
Oh, I got it. If so, I have an idea is that every daemon maintains a parameter service and extend the variable like ${VAR_A} with CLI and parse ${REMOTE: VAR_A} with daemon's env. What about your opinion? @phil-opp |
I thnk this is a good idea! maybe for another PR? |
|
I like the idea too! Could you clarify the syntax that you propose? These are the different variants that you mentioned in this thread: ... You propose that |
Yes, it's probably a good idea to do smaller PRs. The quoted arguments change of this PR seems quite isolated and unrelated to the env expansion. Could you move these changes to a separate PR @drindr ? And apply the same quoting logic to the dora/binaries/daemon/src/spawn.rs Line 705 in 3197dc0 Thanks! |
The syntax can be ${CLI: VAR_A} for CLI, which |
|
Thanks for clarifying, this sounds good to me in general. Instead of @haixuanTao What do you think about this this change? |
|
The implementation of build command with quoted arguments have been modified and submit on #1103 |
To be honest, I'm not really a fan of introducing a new concept of environment variable resolving while every one knows linux env variable resolving. Here are the reason why:
I would very much favor using runtime environment variable within each node code ( including build ) for daemon env variable and, use configured env within the dataflow for cli based env variable. I don't think that dora should be in charge of daemon -> to -> node env variable passing. Very sorry. Open for discussion still! |
Could you clarify this a bit more? I don't understand what you mean with this. |
|
There are two proposals in this PR:
Are you against both of these things? Or just the second point? |
This would be okay for me, but would resolve in daemon env variable indeed and not cli env variable. I would expect that cli env variable would only apply to the env section of the dataflow.
This, I'm not okay with because I think it's going to be hard to implement effectively.
The idea is that let say:
As a matter of fact, we almost will always do a worst job at passing daemon -> node env variable. |
|
Thanks for clarifying! This seems reasonable to me. So let's do it this way:
Does that sound good to you? Do we also want to support expanding env variables in |
|
Yes, I think this is the current implementation.
Yes I think that this is a good idea with daemon. I think one thing which is confusing is that sometimes user don't do |
|
The environment variable expansion for path field has been re-implemented in #1104. |
$HOME/a/bcbash -c "..."