https://prefect.io logo
Title
h

Ha Pham

08/18/2022, 10:09 AM
(Prefect 2.0 question) my flow has a
start_date
parameter. In the flow code the default of this value is set like this
def sync_circleci(start_date: datetime.date = datetime.datetime.today().date()):
   ...
and it will come out in the YYYY-MM-DD format. Now when I deploy the flow, it seems that the default value is not recognized by Prefect UI. When I run this flow "using default param values", the flow fails with this error
prefect.exceptions.SignatureMismatchError: Function expects parameters ['start_date'] but was provided with parameters []
which means the default value is not recognized (?). And when I select a date value using the date picker, looks like the date format is not recognized by my flow code with this error
- start_date: invalid date format
How should I handle this?
1
a

Anna Geller

08/18/2022, 11:53 AM
thanks for flagging - we are currently investigating and will let you know once we know more
j

Jenny

08/18/2022, 2:03 PM
Hi @Ha Pham - for your question about setting parameters in the UI - I've opened an issue to look into the datetime.date setting. Would datetime.datetime work for you in the meantime?
h

Ha Pham

08/18/2022, 2:29 PM
ok I will try it out, thanks
👍 1
a

Anna Geller

08/18/2022, 3:12 PM
FYI: we'll ship a fix for that with a 2.1.1 release within the next hour or so
h

Ha Pham

08/19/2022, 5:43 AM
thanks Anna. I have also tried to change the input data type to datetime. the flow now works when I trigger it with a param override.
def sync_circleci(start_date: datetime.datetime = datetime.datetime.now(pytz.utc)):
However it still does not recognize the default value
j

Jenny

08/19/2022, 7:41 AM
Hi @Ha Pham - have you updated to Prefect 2.1.1?
h

Ha Pham

08/19/2022, 7:42 AM
no not yet, I'm still at 2.1.0
j

Jenny

08/19/2022, 7:42 AM
Ah - for default parameters to work you'll need to make the update!