dstack icon indicating copy to clipboard operation
dstack copied to clipboard

[Bug]: Can't run a run via Python API using `dstack.api.LocalRepo`

Open peterschmidt85 opened this issue 3 months ago • 1 comments

Steps to reproduce

  1. Run the following code
import sys

from dstack.api import Task, GPU, Client, Resources, LocalRepo

client = Client.from_config()

task = Task(
    commands=[
        "pwd",
        "find .",
    ]
)

run = client.runs.submit(
    configuration=task,
    repo=LocalRepo.from_dir("."),
)

run.attach()

try:
    for log in run.logs():
        sys.stdout.buffer.write(log)
        sys.stdout.buffer.flush()
except KeyboardInterrupt:
    run.stop(abort=True)
finally:
    run.detach()

Expected behaviour

The current directory (/workflow) is mounted and the find . command recursively lists the contents of the current folder.

Actual behaviour

CLI logs:

/Users/cheptsov/miniforge3/bin/python /Users/cheptsov/dstack-examples/api/main.py                                   base 17:26:00
Traceback (most recent call last):
  File "/Users/cheptsov/dstack-examples/api/main.py", line 13, in <module>
    run = client.runs.submit(
          ^^^^^^^^^^^^^^^^^^^
  File "/Users/cheptsov/miniforge3/lib/python3.11/site-packages/dstack/api/_public/runs.py", line 381, in submit
    return self.exec_plan(run_plan, repo, reserve_ports=reserve_ports)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cheptsov/miniforge3/lib/python3.11/site-packages/dstack/api/_public/runs.py", line 487, in exec_plan
    self._api_client.repos.upload_code(
  File "/Users/cheptsov/miniforge3/lib/python3.11/site-packages/dstack/api/server/_repos.py", line 39, in upload_code
    self._request(
  File "/Users/cheptsov/miniforge3/lib/python3.11/site-packages/dstack/api/server/__init__.py", line 123, in _request
    raise _server_client_errors[code](**kwargs)
dstack._internal.core.errors.RepoDoesNotExistError: Repo -lws5sbwv does not exist

dstack version

0.17.0

Server logs

No response

Additional information

A run with repo set t oNone or dstack.api.RemoteRepo works.

peterschmidt85 avatar Mar 31 '24 15:03 peterschmidt85