Skip to content

Add ARCHIVED state to LaunchPlanState enum#7056

Open
blaketastic2 wants to merge 2 commits intoflyteorg:masterfrom
blaketastic2:blake/launchplan-archived-state
Open

Add ARCHIVED state to LaunchPlanState enum#7056
blaketastic2 wants to merge 2 commits intoflyteorg:masterfrom
blaketastic2:blake/launchplan-archived-state

Conversation

@blaketastic2
Copy link

Tracking issue

N/A — this addresses a common operational pain point with no existing tracking issue.

Why are the changes needed?

Every pyflyte register creates 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 UpdateLaunchPlan to set state INACTIVE, but INACTIVE has meaning in the active/inactive schedule lifecycle — conflating "old cruft" with "intentionally deactivated" makes filtering unreliable. Users who discover downstream launch plans via ListLaunchPlans (e.g. filtering on workflow.short_description) get back all versions across all deploys when they only care about the latest.

Adding ARCHIVED (value 2) 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):

  • Add ARCHIVED = 2 to the LaunchPlanState enum in launch_plan.proto
  • Regenerate bindings for Go, Python, Rust, TypeScript, and JavaScript
  • Update both swagger JSON files (gateway + client assets)

flyteadmin:

  • Add archiveLaunchPlan method to LaunchPlanManager — same behavior as disableLaunchPlan (disables any active schedule, updates the DB) but sets state to ARCHIVED instead of INACTIVE
  • Add case admin.LaunchPlanState_ARCHIVED to the UpdateLaunchPlan switch

flytectl:

  • Repurpose the --archive flag to set LaunchPlanState_ARCHIVED instead of mapping to INACTIVE. This flag was previously deprecated in [Feature]Remove namespace from all non kustomize configuration #449 as an alias for --deactivate because "archive" was misleading when no ARCHIVED state existed. Now that the state exists, --archive does what the name implies.
  • Update mutual exclusion logic to handle three flags (--activate, --deactivate, --archive)
  • Remove the now-unused deprecatedCommandWarning function
  • Update help text and flag descriptions

Note on --archive behavioral change: Prior to this PR, --archive was a deprecated alias for --deactivate (set state to INACTIVE/0). After this PR, --archive sets state to ARCHIVED/2. Anyone relying on the deprecated --archive flag to deactivate launch plans should switch to --deactivate.

How was this patch tested?

  • Updated TestLaunchPlanCanBeArchived in flytectl to verify --archive now sets ARCHIVED state
  • All existing flyteadmin manager impl tests pass (launch plan manager, transformers, utils, validation)
  • All existing flytectl update tests pass
  • Both flyteadmin and flytectl compile cleanly

Labels

  • added: New ARCHIVED launch plan state

Check all the applicable boxes

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

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 <[email protected]>
Signed-off-by: Blake <[email protected]>
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 <[email protected]>
Signed-off-by: Blake <[email protected]>
@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 23.91304% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.92%. Comparing base (f3ab1b7) to head (e0f3c36).

Files with missing lines Patch % Lines
flyteadmin/pkg/manager/impl/launch_plan_manager.go 0.00% 35 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7056      +/-   ##
==========================================
- Coverage   56.95%   56.92%   -0.04%     
==========================================
  Files         931      931              
  Lines       58188    58225      +37     
==========================================
+ Hits        33141    33143       +2     
- Misses      22005    22040      +35     
  Partials     3042     3042              
Flag Coverage Δ
unittests-datacatalog 53.51% <ø> (ø)
unittests-flyteadmin 53.03% <0.00%> (-0.11%) ⬇️
unittests-flytecopilot 43.06% <ø> (ø)
unittests-flytectl 64.03% <100.00%> (+0.01%) ⬆️
unittests-flyteidl 75.71% <ø> (ø)
unittests-flyteplugins 60.15% <ø> (ø)
unittests-flytepropeller 53.65% <ø> (ø)
unittests-flytestdlib 63.02% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant