Add ARCHIVED state to LaunchPlanState enum#7056
Add ARCHIVED state to LaunchPlanState enum#7056blaketastic2 wants to merge 4 commits intoflyteorg:masterfrom
Conversation
Launch plan versions accumulate over time as each pyflyte register creates new versions. This adds an ARCHIVED state (value=2) so old versions can be marked and filtered out of list queries (e.g. ne(state,2)) without conflating them with INACTIVE, which has meaning in the active/inactive schedule lifecycle. Archiving a launch plan disables any active schedule (same as deactivate) but preserves the ability to launch executions from it. Changes: - flyteidl: Add ARCHIVED=2 to LaunchPlanState enum, regenerate bindings - flyteadmin: Add archiveLaunchPlan handler in UpdateLaunchPlan switch - flytectl: Repurpose --archive flag to set ARCHIVED state (was a deprecated alias for --deactivate) Signed-off-by: Blake Naccarato <blake.naccarato@gmail.com> Signed-off-by: Blake <blaketastic2@gmail.com>
Remove "hidden from list queries by default" language from proto comments and CLI help. Archived launch plans are not automatically excluded from list results — callers must add a ne(state,2) filter. Signed-off-by: Blake Naccarato <blake.naccarato@gmail.com> Signed-off-by: Blake <blaketastic2@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7056 +/- ##
==========================================
- Coverage 56.95% 56.95% -0.01%
==========================================
Files 931 931
Lines 58188 58225 +37
==========================================
+ Hits 33141 33160 +19
- Misses 22005 22019 +14
- Partials 3042 3046 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add case 2 (ARCHIVED) to LaunchPlanClosure and LaunchPlanUpdateRequest verify functions in flyteidl.js - Reword Archive pflag description to avoid comma that causes double-space artifact in pflags code generation Signed-off-by: Blake <blaketastic2@gmail.com>
63d7c37 to
9549a4c
Compare
| setCount++ | ||
| } | ||
| if activate == deactivate && deactivate { | ||
| if setCount > 1 { |
There was a problem hiding this comment.
What if we do deactivate and archive? It shouldn't raise an error
There was a problem hiding this comment.
These are three distinct states in the enum (ACTIVE, INACTIVE, ARCHIVED), and each flag maps to exactly one LaunchPlanState value. If we allowed --deactivate --archive together it would be ambiguous — we'd have to silently pick one, which is more confusing than just asking the user to specify a single flag.
Archive already implies the launch plan won't be scheduled (the server-side behavior disables any active schedule), so there's no need to also pass --deactivate. If the intent is to archive, --archive alone is sufficient.
Cover the archive path with tests for the happy path (with and without a schedule) and database error propagation. Signed-off-by: Blake <blaketastic2@gmail.com>
Tracking issue
N/A — this addresses a common operational pain point with no existing tracking issue.
Why are the changes needed?
Every
pyflyte registercreates new launch plan versions, and nothing cleans up old ones. Over time this leads to heavier list queries, more data to page through, and increased memory pressure on Admin.Today the only cleanup mechanism is
UpdateLaunchPlanto set stateINACTIVE, butINACTIVEhas meaning in the active/inactive schedule lifecycle — conflating "old cruft" with "intentionally deactivated" makes filtering unreliable. Users who discover downstream launch plans viaListLaunchPlans(e.g. filtering onworkflow.short_description) get back all versions across all deploys when they only care about the latest.Adding
ARCHIVED(value2) gives operators a distinct state they can set on old versions and filter out (ne(state,2)), enabling a scheduled cleanup pattern: keep the most recent N versions per named entity, archive the rest, never touch the active one.What changes were proposed in this pull request?
flyteidl (proto + generated code):
ARCHIVED = 2to theLaunchPlanStateenum inlaunch_plan.protoflyteadmin:
archiveLaunchPlanmethod toLaunchPlanManager— same behavior asdisableLaunchPlan(disables any active schedule, updates the DB) but sets state toARCHIVEDinstead ofINACTIVEcase admin.LaunchPlanState_ARCHIVEDto theUpdateLaunchPlanswitchflytectl:
--archiveflag to setLaunchPlanState_ARCHIVEDinstead of mapping toINACTIVE. This flag was previously deprecated in [Feature]Remove namespace from all non kustomize configuration #449 as an alias for--deactivatebecause "archive" was misleading when noARCHIVEDstate existed. Now that the state exists,--archivedoes what the name implies.--activate,--deactivate,--archive)deprecatedCommandWarningfunctionNote on
--archivebehavioral change: Prior to this PR,--archivewas a deprecated alias for--deactivate(set state toINACTIVE/0). After this PR,--archivesets state toARCHIVED/2. Anyone relying on the deprecated--archiveflag to deactivate launch plans should switch to--deactivate.How was this patch tested?
TestLaunchPlanCanBeArchivedin flytectl to verify--archivenow setsARCHIVEDstateflyteadminandflytectlcompile cleanlyLabels
ARCHIVEDlaunch plan stateCheck all the applicable boxes