Skip to content

Refactor DagsterInstance into structured mixins architecture #31617

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

Merged
merged 1 commit into from
Aug 8, 2025

Conversation

schrockn
Copy link
Member

@schrockn schrockn commented Aug 7, 2025

Summary & Motivation

This PR creates a structured mixins architecture for DagsterInstance to improve code organization and maintainability. The massive DagsterInstance class (over 1400 lines) is reorganized by extracting functionality into focused mixin classes.

Key changes:

  • Create mixins package: New python_modules/dagster/dagster/_core/instance/mixins/ directory for organized mixin classes
  • Move domains_mixin: Relocate existing domains_mixin.py to the new mixins package with improved type safety using cast()
  • Extract RunsMixin: Move 300+ lines of runs-related functionality from DagsterInstance into dedicated RunsMixin, including:
    • Run retrieval methods (get_run_by_id, get_run_record_by_id)
    • Run creation methods (create_run, create_run_for_job)
    • Run lifecycle management (add_run, delete_run, handle_run_event)
    • Run launcher operations (launch_run, submit_run, resume_run)
    • Run reporting (report_run_canceling, report_run_failed)
  • Create SettingsMixin: Extract settings and configuration-related functionality
  • Update inheritance: DagsterInstance now inherits from SettingsMixin, RunsMixin, DynamicPartitionsStore, and DomainsMixin
  • Improve imports: Update all import paths to use new mixins package structure

The mixins follow the established architectural pattern where simple implementations delegate to domain objects for complex business logic, maintaining clean separation of concerns while improving code organization.

How I Tested These Changes

Verified that all imports resolve correctly and existing functionality is preserved through the delegation pattern. The reorganization maintains the same public API surface area.

@schrockn schrockn changed the title mixins-folder Create mixins folder and extract RunsMixin from DagsterInstance Aug 7, 2025
@schrockn schrockn changed the base branch from schrockn/ir-7-delete-plan to graphite-base/31617 August 7, 2025 12:04
@schrockn schrockn force-pushed the graphite-base/31617 branch from 1193b2e to f37cf5e Compare August 7, 2025 12:04
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 1dfda41 to 3ad4f5f Compare August 7, 2025 12:04
@schrockn schrockn changed the base branch from graphite-base/31617 to schrockn/claude-updates August 7, 2025 12:05
@schrockn schrockn changed the title Create mixins folder and extract RunsMixin from DagsterInstance Refactor DagsterInstance into structured mixins architecture Aug 7, 2025
@schrockn schrockn force-pushed the schrockn/claude-updates branch from f37cf5e to 693814a Compare August 7, 2025 12:24
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 3ad4f5f to 4e7d7ef Compare August 7, 2025 12:24
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 4e7d7ef to a39d5fd Compare August 7, 2025 13:32
@schrockn schrockn force-pushed the schrockn/claude-updates branch from 693814a to 9ef6e80 Compare August 7, 2025 13:32
@schrockn schrockn marked this pull request as ready for review August 7, 2025 13:36
@schrockn schrockn force-pushed the schrockn/claude-updates branch from 9ef6e80 to 14b9e13 Compare August 7, 2025 15:13
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from e2ea392 to 3d04cb3 Compare August 7, 2025 15:13
@schrockn schrockn force-pushed the schrockn/claude-updates branch from 14b9e13 to 8b593f4 Compare August 7, 2025 15:43
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 3d04cb3 to 4c6cb29 Compare August 7, 2025 15:43
@schrockn schrockn force-pushed the schrockn/claude-updates branch from 8b593f4 to f4ee657 Compare August 7, 2025 16:29
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 4c6cb29 to e9d7f54 Compare August 7, 2025 16:29
@schrockn schrockn force-pushed the schrockn/claude-updates branch from f4ee657 to 9054ada Compare August 7, 2025 17:22
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from e9d7f54 to cf2f360 Compare August 7, 2025 17:23
@schrockn schrockn force-pushed the schrockn/claude-updates branch from 9054ada to db9c8a6 Compare August 7, 2025 18:17
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 1acb5b1 to 0aa2ff9 Compare August 8, 2025 14:43
@schrockn schrockn changed the base branch from graphite-base/31617 to schrockn/agent-coach August 8, 2025 14:43
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 0aa2ff9 to 1729a13 Compare August 8, 2025 15:07
@schrockn schrockn requested a review from OwenKephart August 8, 2025 17:40
@schrockn schrockn changed the base branch from schrockn/agent-coach to graphite-base/31617 August 8, 2025 17:44
@schrockn schrockn force-pushed the graphite-base/31617 branch from 0a54a72 to 3428363 Compare August 8, 2025 17:44
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 1729a13 to 5f1eccb Compare August 8, 2025 17:44
@schrockn schrockn changed the base branch from graphite-base/31617 to schrockn/bk-inspector August 8, 2025 17:44
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 5f1eccb to 664b684 Compare August 8, 2025 17:51
@schrockn schrockn force-pushed the schrockn/bk-inspector branch from 3428363 to 4e46164 Compare August 8, 2025 17:51
@schrockn schrockn changed the base branch from schrockn/bk-inspector to graphite-base/31617 August 8, 2025 19:51
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 664b684 to ee2aa69 Compare August 8, 2025 19:51
@schrockn schrockn changed the base branch from graphite-base/31617 to schrockn/claude-settings August 8, 2025 19:51
@schrockn schrockn changed the base branch from schrockn/claude-settings to graphite-base/31617 August 8, 2025 20:23
@schrockn schrockn force-pushed the graphite-base/31617 branch from 88e2f93 to 618c24f Compare August 8, 2025 20:23
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from ee2aa69 to 8c84d34 Compare August 8, 2025 20:23
@schrockn schrockn changed the base branch from graphite-base/31617 to master August 8, 2025 20:23
@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 8c84d34 to 81e05b1 Compare August 8, 2025 21:03
Copy link
Member Author

schrockn commented Aug 8, 2025

Merge activity

  • Aug 8, 10:14 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 8, 10:15 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 8, 10:16 PM UTC: @schrockn merged this pull request with Graphite.

@schrockn schrockn force-pushed the schrockn/ir-8-create-mixins-folder branch from 81e05b1 to 0be8336 Compare August 8, 2025 22:15
@schrockn schrockn merged commit 0e5d06f into master Aug 8, 2025
4 of 5 checks passed
@schrockn schrockn deleted the schrockn/ir-8-create-mixins-folder branch August 8, 2025 22:16
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.

2 participants