Skip to content
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

Use updated cronSchedule in CreateLaunchPlanModel #4564

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

pmahindrakar-oss
Copy link
Contributor

@pmahindrakar-oss pmahindrakar-oss commented Dec 8, 2023

Why are the changes needed?

Create schedule launchplan is using deprecated field to determine if schedule type is CRON and saving it in the DB
This causes the list launchplan with filter for CRON type schedule returns null

This fixes the logic of saving all new scheduled launchplans.
We are not planning to support this for older scheduled launchplans and hence no migration script for it.

How was this patch tested?

Tested this on an internal tenant by registering the latest version of the examples

  • flytectl register examples --project flytesnacks --domain development
  • flytectl update launchplan my_cron_scheduled_lp --project flytesnacks --domain development --version v0.3.248 --activate
  • flytectl update launchplan my_fixed_rate_lp --project flytesnacks --domain development --version v0.3.248 --activate

Verified the result of https://dogfood.cloud-staging.union.ai/api/v1/launch_plans/flytesnacks/development?filters=ne(schedule_type,NONE)%2Beq(state,1)&limit=10000&sort_by.direction=ASCENDING&sort_by.key=name

returns exactly the two activated launchplans.

{
"launch_plans": [
{
"id": {
"resource_type": "LAUNCH_PLAN",
"project": "flytesnacks",
"domain": "development",
"name": "my_cron_scheduled_lp",
"version": "v0.3.248"
},
"spec": {
"workflow_id": {
"resource_type": "WORKFLOW",
"project": "flytesnacks",
"domain": "development",
"name": "productionizing.lp_schedules.date_formatter_wf",
"version": "v0.3.248"
},
"entity_metadata": {
"schedule": {
"cron_schedule": {
"schedule": "*/1 * * * *"
},
"kickoff_time_input_arg": "kickoff_time"
}
},
"default_inputs": {
"parameters": {
"kickoff_time": {
"var": {
"type": {
"simple": "DATETIME"
},
"description": "kickoff_time"
},
"required": true
}
}
},
"fixed_inputs": {},
"labels": {},
"annotations": {},
"raw_output_data_config": {}
},
"closure": {
"state": "ACTIVE",
"expected_inputs": {
"parameters": {
"kickoff_time": {
"var": {
"type": {
"simple": "DATETIME"
},
"description": "kickoff_time"
},
"required": true
}
}
},
"expected_outputs": {},
"created_at": "2023-12-13T05:42:29.102555Z",
"updated_at": "2023-12-13T05:42:29.102555Z"
}
},
{
"id": {
"resource_type": "LAUNCH_PLAN",
"project": "flytesnacks",
"domain": "development",
"name": "my_fixed_rate_lp",
"version": "v0.3.248"
},
"spec": {
"workflow_id": {
"resource_type": "WORKFLOW",
"project": "flytesnacks",
"domain": "development",
"name": "productionizing.lp_schedules.positive_wf",
"version": "v0.3.248"
},
"entity_metadata": {
"schedule": {
"rate": {
"value": 10
}
}
},
"default_inputs": {},
"fixed_inputs": {
"literals": {
"name": {
"scalar": {
"primitive": {
"string_value": "you"
}
}
}
}
},
"labels": {},
"annotations": {},
"raw_output_data_config": {}
},
"closure": {
"state": "ACTIVE",
"expected_inputs": {},
"expected_outputs": {},
"created_at": "2023-12-13T05:42:30.835996Z",
"updated_at": "2023-12-13T05:42:30.835996Z"
}
}
]
}
  • flytectl update launchplan my_fixed_rate_lp --project flytesnacks --domain development --version v0.3.248 --archive
  • flytectl update launchplan my_cron_scheduled_lp --project flytesnacks --domain development --version v0.3.248 --archive

Also verified after the above two steps of archive the following link returns no result https://dogfood.cloud-staging.union.ai/api/v1/launch_plans/flytesnacks/development?filters=ne(schedule_type,NONE)%2Beq(state,1)&limit=10000&sort_by.direction=ASCENDING&sort_by.key=name

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Copy link

codecov bot commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b14f1ac) 59.13% compared to head (83b402f) 58.98%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4564      +/-   ##
==========================================
- Coverage   59.13%   58.98%   -0.15%     
==========================================
  Files         621      621              
  Lines       50151    52483    +2332     
==========================================
+ Hits        29655    30958    +1303     
- Misses      18029    19058    +1029     
  Partials     2467     2467              
Flag Coverage Δ
unittests 58.98% <100.00%> (+0.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pmahindrakar-oss pmahindrakar-oss marked this pull request as ready for review December 13, 2023 05:58
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 13, 2023
@pmahindrakar-oss pmahindrakar-oss merged commit 3f4ba2e into master Dec 13, 2023
40 of 41 checks passed
@pmahindrakar-oss pmahindrakar-oss deleted the fix-launchplan-cron branch December 13, 2023 05:58
pvditt pushed a commit that referenced this pull request Dec 13, 2023
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: Paul Dittamo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants