-
Notifications
You must be signed in to change notification settings - Fork 32
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
Discussion: External Config Design #180
Comments
Thanks a lot for this clarifying post :) I don't really understand Case 2. Could you please elaborate on the line: config = readConfig $ getFlowConfigKeys flow One could also consider Case 4. The runFlow tries to load all configuration in order from all sources:
flow = dockerFlow DockerTaskConfig {args=[Configurable "foo.bar"]}
runFlow flow input () and this
My guess is that the config values will always come as string/text (no matter if it is from a file, from CLI or env). Parsing to other type (Int, Float, other) could take place in specific interpreters where needed. |
Ya, so one thing I realized is that to generate CLI flags using the configurables in a flow, we probably need to provide a function, Since there might be additional top-level CLI arguments that we want to add besides those for the configurable values, it probably makes the most sense to do this outside of import Options.Applicative
runFlowWithCLI -> Flow a b -> a -> IO b
runFlowWithCLI flow = do
let -- Create the main CLI options, maybe with other sub-commands, etc.
topLevelCLI = (...) :: Parser
-- Create the flow-specific configuration options
flowCLIOpts = flowCLI flow
-- Run the command line parser
cliOpts <- execParser (topLevelCLI <*> flowCLIOpts)
-- Pass in the parsed options to runFlowWithConfig. We could add
-- a field to `FlowConfig` for explicitly passing in config values.
runFlowWithConfig flow $ configFromOpts cliOpts
-- or, we can also handle reading env variables and the config file here prior
-- to calling runFlowWithConfig.
where
-- | Traverses a flow and builds a set of CLI options using the flow's
-- configurable fields. This could call the `getFlowConfigKeys` function I mentioned.
flowCLI :: Flow -> Parser CLIOpts
-- | Converts a parsed CLIOpts to a FlowConfig
configFromOpts :: CLIOpts -> FlowConfig |
As noted in the PR (#69) containing the initial version of external configuration support, there are some open design questions regarding the granularity at which a pipeline author should specify configurable task arguments. This issue is to record those thoughts and serve as a place for further discussion.
This breaks down into two related questions:
FromEnv
/FromFile
) or should the user specify thisat a higher level, prior to calling
runFlow
?runFlow
handle parsing config values from external sources (e.g. reading config files), or should this bedone by the user prior to calling
runFlow
?These questions could be addressed in a couple of different ways which would produce the following interfaces:
Case 1 (implemenation in tweag/funflow2#69)
Pros:
Cons:
all employees must adhere to this.
themselves be shared outside of an organization?
Case 2.
Move config loading out one level
Pros:
in specific values for testing
getFlowConfigKeys
function to be able to automatically generate a CLI anywaysCons:
Case 3.
Move specification of config sources out of flow declarations and have the user provide configs:
Pros:
Cons:
The text was updated successfully, but these errors were encountered: