Hello team! I was wondering if we could specify a ...
# ask-metaflow
r
Hello team! I was wondering if we could specify a cron schedule via the metaflow cli so that we can deploy a same flow with different cron instead of using the decorator? Thank you!
1
h
hi, i can think of two ways to do this: 1. using env vars (ie
@schedule(cron=os.environ['MY_CRON'])
2. using configs (see this example using
config_expr
)
v
using `Config` makes it easy indeed! Something like this:
Copy code
@schedule(cron=config_expr('schedule.cron'))
class ScalableFlow(FlowSpec):

    schedule = Config('schedule', default_value='{"cron": "*/30 * * * *"}')
then you can specify the schedule in a config file or on the command line
Copy code
python scalableflow.py --config-value schedule '{"cron": "*/31 * * * *"}' argo-workflows create
❤️ 1
r
So cool thank you so much!
🙌 1