Skip to content
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

[Feature] Provide a public API to scale services #1762

Closed
Tracked by #1782
peterschmidt85 opened this issue Oct 2, 2024 · 5 comments · Fixed by #1958
Closed
Tracked by #1782

[Feature] Provide a public API to scale services #1762

peterschmidt85 opened this issue Oct 2, 2024 · 5 comments · Fixed by #1958

Comments

@peterschmidt85
Copy link
Contributor

Use-case: up-scale and down-scale services programmatically via an API

@r4victor
Copy link
Collaborator

r4victor commented Oct 2, 2024

This is related to supporting updating the service replicas parameter in configuration without re-creating the service, that is, service configuration in-place updates.

@peterschmidt85
Copy link
Contributor Author

peterschmidt85 commented Oct 2, 2024

This is related to supporting updating the service replicas parameter in configuration without re-creating the service, that is, service configuration in-place updates.

Not sure. The issue is about providing an API that does what the server already does with auto-scaling of a running service based on the scaling configuration. Means we already have an internal API for this. We just need to make it public.

@r4victor
Copy link
Collaborator

r4victor commented Oct 2, 2024

@peterschmidt85, We have a public API that allows specifying replicas. If we adjust it to support service configuration in-place updates, users could use it to modify replicas and implement custom autoscaling on top of it.

Copy link

github-actions bot commented Nov 2, 2024

This issue is stale because it has been open for 30 days with no activity.

@r4victor
Copy link
Collaborator

r4victor commented Nov 5, 2024

After #1958, users can change replicas and scaling parameters via dstack apply or Python/HTTP API:

import os
from dstack.api.server import APIClient

url = os.environ["DSTACK_URL"]
token = os.environ["DSTACK_TOKEN"]
project = os.environ["DSTACK_PROJECT"]

client = APIClient(base_url=url, token=token)

run = client.runs.get(project, "my-run")
new_run_spec = run.run_spec
new_run_spec.configuration.replicas = 3

plan = client.runs.get_plan(project, new_run_spec)
updated_run = client.runs.apply_plan(project, plan)

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

Successfully merging a pull request may close this issue.

2 participants