Skip to content

Implement plugins #2581

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 9 commits into from
Apr 30, 2025
Merged

Implement plugins #2581

merged 9 commits into from
Apr 30, 2025

Conversation

r4victor
Copy link
Collaborator

@r4victor r4victor commented Apr 29, 2025

Closes #2576

The PR adds support for server-side dstack plugins. Plugins are enabled via server/config.yml:

plugins:
  - my_dstack_plugin
  - some_other_plugin
projects:
- name: main

To implement a plugin, plugin authors create a Python package with a dstack.plugins.Plugin subclass and export it as a package entrypoint:

[project.entry-points."dstack.plugins"]
my_dstack_plugin = "my_dstack_plugin:MyPlugin"

Currently, the only plugins functionality is ApplyPolicy that change apply specs (run/fleet/volume/gateway).

Notes:

  • ApplyPolicy.on_apply() will usually be called twice: on getting a plan and on apply. So if on_apply() is non-deterministic, the spec displayed in the plan can be different from the actual applied spec. Discussed with @peterschmidt85 that this is a desired behavior as otherwise plugin authors would need to double-check the modified spec.

A plugin guide is TBD.

@r4victor r4victor merged commit cda4583 into master Apr 30, 2025
25 checks passed
@r4victor r4victor deleted the issue_2576_plugins branch April 30, 2025 11:44
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.

Support server-side plugins
2 participants