Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Added enableSchedule option on registration and linked missing docs #324

Merged
merged 2 commits into from
May 19, 2022

Conversation

pmahindrakar-oss
Copy link
Contributor

@pmahindrakar-oss pmahindrakar-oss commented May 17, 2022

Signed-off-by: Prafulla Mahindrakar [email protected]

TL;DR

  • Linked missing docs
  • enableSchedule option allows the user to register and activate the new version of scheduled launchplan if part of the file set passed to the register command.

eg :

flytectl register file  ~/cookbook/core/_pb_output/*  -d development  -p flytesnacks --version v1 --logger.level 6 --enableSchedule

This allows the user to register the v1 version of serialized flyte entities from core cookbook and any scheduled launchplan would be enabled

Result:

The my_cron_schedule_lp which runs every min gets actiavted for v1 version

flytectl get execution  -p flytesnacks -d development
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| NAME (5)             | LAUNCH PLAN NAME     | VERSION | TYPE        | PHASE     | SCHEDULED TIME       | STARTED                        | ELAPSED TIME  | ABORT DATA (TRUNC) | ERROR DATA (TRUNC) |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f5220ef03b8d00e3f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | RUNNING   | 2022-05-17T12:45:00Z | 2022-05-17T12:45:05.101094600Z |               |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f8740f203b85a123f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:44:00Z | 2022-05-17T12:44:05.128048200Z | 55.499334100s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| fec45f503b8d4153f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:43:00Z | 2022-05-17T12:43:05.086229800Z | 55.432468200s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| fea56f503b8de153f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:42:00Z | 2022-05-17T12:42:05.081909200Z | 55.494611100s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f7b89f703b8dc183f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:41:00Z | 2022-05-17T12:41:05.140795Z    | 55.521626400s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
5 rows

Now when registering for new v2 version and passing enableSchduel will deactivate the old version and activate the new through the same command

flytectl register file  ~/cookbook/core/_pb_output/*  -d development  -p flytesnacks --version v2 --logger.level 6 --enableSchedule

Result :
New v2 version starts running and old v1 runs stop. At any given time each launch plan has only one version active

flytectl get execution  -p flytesnacks -d development                                   
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| NAME (7)             | LAUNCH PLAN NAME     | VERSION | TYPE        | PHASE     | SCHEDULED TIME       | STARTED                        | ELAPSED TIME  | ABORT DATA (TRUNC) | ERROR DATA (TRUNC) |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f762df86593ae34a2000 | my_cron_scheduled_lp | v2      | LAUNCH_PLAN | RUNNING   | 2022-05-17T12:47:00Z | 2022-05-17T12:47:05.089796500Z |               |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f1da7006693c43ea2000 | my_cron_scheduled_lp | v2      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:46:00Z | 2022-05-17T12:46:05.078374800Z | 55.243925s    |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f5220ef03b8d00e3f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:45:00Z | 2022-05-17T12:45:05.101094600Z | 55.223758900s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f8740f203b85a123f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:44:00Z | 2022-05-17T12:44:05.128048200Z | 55.499334100s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| fec45f503b8d4153f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:43:00Z | 2022-05-17T12:43:05.086229800Z | 55.432468200s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| fea56f503b8de153f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:42:00Z | 2022-05-17T12:42:05.081909200Z | 55.494611100s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 
| f7b89f703b8dc183f000 | my_cron_scheduled_lp | v1      | LAUNCH_PLAN | SUCCEEDED | 2022-05-17T12:41:00Z | 2022-05-17T12:41:05.140795Z    | 55.521626400s |                    |                    |
 ---------------------- ---------------------- --------- ------------- ----------- ---------------------- -------------------------------- --------------- -------------------- -------------------- 

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

fixes flyteorg/flyte#2329

Follow-up issue

NA

@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #324 (430e87a) into master (5250230) will increase coverage by 0.06%.
The diff coverage is 94.11%.

@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
+ Coverage   69.95%   70.02%   +0.06%     
==========================================
  Files         136      136              
  Lines        4820     4834      +14     
==========================================
+ Hits         3372     3385      +13     
- Misses       1195     1196       +1     
  Partials      253      253              
Flag Coverage Δ
unittests 69.47% <93.75%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
cmd/completion.go 90.90% <ø> (ø)
cmd/config/subcommand/register/files_config.go 0.00% <ø> (ø)
cmd/get/execution.go 100.00% <ø> (ø)
cmd/register/files.go 85.29% <ø> (ø)
cmd/register/register_util.go 77.99% <93.75%> (+0.37%) ⬆️
...md/config/subcommand/register/filesconfig_flags.go 44.11% <100.00%> (+1.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5250230...430e87a. Read the comment docs.

@EngHabu
Copy link
Contributor

EngHabu commented May 17, 2022

Should we call it --activateLaunchPlans? What adj do we use for LPs?

Signed-off-by: Prafulla Mahindrakar <[email protected]>
@pmahindrakar-oss pmahindrakar-oss changed the title Added enableSchedule option on registration Added enableSchedule option on registration and linked missing docs May 17, 2022
@pmahindrakar-oss
Copy link
Contributor Author

@EngHabu we use --activate but i want to move away from that and be explicit what this flag does since we have activate or ACTIVE means different things for different entities . Hence the explicitiness with the name enableSchedule.

Want to use the same on the launchplan and deprecate the --active flag in the long run.

Let me know what you think

@EngHabu EngHabu merged commit 5a17906 into master May 19, 2022
@EngHabu EngHabu deleted the activate-launchplan-2329 branch May 19, 2022 15:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FlyteCTL Feature] Use Launchplan with latest version for scheduled workflows
2 participants