Skip to content

[API] Publish project lifecycle events to Iguazio v4#9703

Merged
liranbg merged 3 commits into
mlrun:developmentfrom
yaelgen:feature/ig4-2138-project-events
May 22, 2026
Merged

[API] Publish project lifecycle events to Iguazio v4#9703
liranbg merged 3 commits into
mlrun:developmentfrom
yaelgen:feature/ig4-2138-project-events

Conversation

@yaelgen
Copy link
Copy Markdown
Member

@yaelgen yaelgen commented May 19, 2026

📝 Description

Extends the Iguazio v4 events client and Projects crud layer to publish project lifecycle events (creation and deletion) so the orca events service can store them, evaluate rules, and dispatch actions.

Five event configs are exercised here - three new ones (MLRun.Project.Creation.Succeeded, MLRun.Project.Deletion.Succeeded) that are added on the orca side in the companion PR, plus the two *.Failed variants that already existed in the orca catalog but were never published from MLRun.

Depends on: https://github.com/McK-Private/orca/pull/750

🛠️ Changes Made

  • mlrun/common/schemas/events.py — new ProjectLifecycleEventActions enum (creation_succeeded, creation_failed, deletion_succeeded, deletion_failed) re-exported from mlrun.common.schemas.
  • server/py/services/api/utils/events/base.pygenerate_project_lifecycle_event added as no-op defaults returning None, so the v3 iguazio.py and nop.py clients keep working with no changes and call sites remain client-agnostic.
  • server/py/services/api/utils/events/iguazio_v4.py — five new event-name constants, EVENT_CLASS_PROJECT = "Project", the PROJECT_LIFECYCLE_EVENTS lookup table, and the two concrete generators (INFO for success, WARNING for failure — matching the orca catalog). Error details are passed through the existing _apply_error truncation helper.
  • server/py/services/api/crud/projects.py — four emission points wired up:
    • create_project: creation_succeeded after the DB call returns; creation_failed in the except then re-raise.
    • delete_project: same try/except pattern, scoped narrowly around the final db.delete_project(...) call — check-strategy and missing-project short-circuits stay silent.

No breaking changes. New events only flow on Iguazio v4 systems where the orca catalog entries exist; on v3/CE the base-class no-op returns None and emission is skipped silently.


✅ Checklist

  • I updated the documentation (if applicable)
  • I have tested the changes in this PR
  • I confirmed whether my changes are covered by system tests
    • If yes, I ran all relevant system tests and ensured they passed before submitting this PR
    • I updated existing system tests and/or added new ones if needed to cover my changes
  • If I introduced a deprecation:
  • Please run Smoke-tests workflow, providing it the PR number as input (upon success, the workflow run will add label "Smoke tests: Pass" to the RP)

🧪 Testing

Generator unit tests in server/py/services/api/tests/unit/utils/events/test_events_iguazio_v4.py (+9 tests):

  • Parametrized basic spec assembly for all four lifecycle actions (config name, severity, class, kind, entity name, project_name + actor in details).
  • Failed events carry truncated error + error_type in details and an extended description; succeeded actions ignore any passed error.
  • Unsupported action raises MLRunInvalidArgumentError.
  • Long-error truncation is bounded by ERROR_DETAIL_LIMIT.

Crud emission tests added to server/py/services/api/tests/unit/db/test_projects.py as methods on the existing TestProjects(TestDatabaseBase) class (+13 tests):

  • create_project: success + failure (re-raises and emits creation_failed).
  • delete_project: success on restricted strategy; no-emit on check; no-emit when project missing; failure path emits deletion_failed and re-raises.
  • Best-effort guarantee: if the events factory itself raises, the project operation still succeeds.

End-to-end verification against a live Iguazio v4 system is gated on the companion orca PR being merged so the new catalog entries exist; this is intentionally out of scope for this PR.
image


🔗 References

  • Ticket link: IG4-2138
  • Companion orca PR: adds the three new event configs (MLRun.Project.Creation.Succeeded, MLRun.Project.Deletion.Succeeded) to the orca event catalog

🚨 Breaking Changes?

  • Yes (explain below)
  • No

🔍️ Additional Notes

  • Owner.Set will be added later on as an audit event
  • The new events fire on Iguazio v4 only. On v3/CE the base-class no-ops return None and emit is skipped — no behavior change.
  • This PR must merge after the companion orca PR. Until orca's catalog has the new entries, the two *.Succeeded publishes will be rejected and logged as best-effort warnings (no functional impact, just noisy logs).

Copy link
Copy Markdown
Member

@liranbg liranbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very well!

@github-actions
Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

📂 Click to view full coverage details

Diff Coverage

Diff: origin/development...HEAD, staged and unstaged changes

  • mlrun/common/schemas/events.py (100%)
  • server/py/services/api/crud/projects.py (100%)
  • server/py/services/api/utils/events/base.py (100%)
  • server/py/services/api/utils/events/iguazio_v4.py (100%)

Summary

  • Total: 45 lines
  • Missing: 0 lines
  • Coverage: 100%

@liranbg liranbg merged commit 17b0acb into mlrun:development May 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants