cuddly-jelly-27016
08/14/2025, 3:49 AMfrom datetime import datetime
from flytekit import task, workflow, CronSchedule, LaunchPlan
@task
def task_1(message: str) -> str:
return message
@workflow
def date_formatter_wf2() -> str:
return task_1("hello")
cron_lp = LaunchPlan.get_or_create(
name="cron_scheduled_lp",
workflow=date_formatter_wf2,
schedule=CronSchedule(
schedule="0 0 31 2 *",
),
)
After registering the launch_plan with invalid schedule date, the SDK throws error as expected.
[截圖 2025-08-14 上午11 48 56](https://private-user-images.githubusercontent.com/66259759/477834012-0db493df-3b5f-4da0-afc1-18ac617da07f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTUzMDU4NTgsIm5iZiI6MTc1NTMwNTU1OCwicGF0aCI6Ii82NjI1OTc1OS80Nzc4MzQwMTItMGRiNDkzZGYtM2I1Zi00ZGEwLWFmYzEtMThhYzYxN2RhMDdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA4MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwODE2VDAwNTIzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYwM2U4ZmJiZDJkZjFhYTBkODQ2ZGMxNjA2OTcxMjE2Y2U2ZWZjODZkMGRhNDc5OTM4MDA3ZTZiNzNiYmEyOWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qPxAH_p3zwWwtownXTrAUdgs9nZNPfqKNANjXYqDkY4)
## Check all the applicable boxes
• All new and existing tests passed.
• All commits are signed-off.
https://bito.ai#summarystart|
### Summary by Bito
This pull request fixes a bug in the Flytekit SDK related to invalid cron date schedules that could cause an infinite loop by adding validation for cron schedules. It introduces error handling for invalid cron expressions and includes comprehensive tests to ensure correct behavior for both valid and invalid inputs, improving the scheduling feature's robustness.
flyteorg/flytekitcuddly-jelly-27016
08/16/2025, 12:52 AM