Skip to content

Commit

Permalink
- [API] Bugfix - dstack.Client.from_config didn't work without `dst…
Browse files Browse the repository at this point in the history
…ack init`
  • Loading branch information
peterschmidt85 committed Sep 19, 2023
1 parent bc5b6dd commit b1169f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions cli/dstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ def __init__(
self,
hub_client: HubClient,
repo_dir: os.PathLike,
init: bool = True,
git_identity_file: Optional[str] = None,
oauth_token: Optional[str] = None,
ssh_identity_file: Optional[str] = None,
init: bool = True,
) -> None:
super().__init__()
self._hub_client = hub_client
Expand All @@ -317,6 +317,9 @@ def from_config(
project_name: Optional[str] = None,
server_url: Optional[str] = None,
user_token: Optional[str] = None,
git_identity_file: Optional[str] = None,
oauth_token: Optional[str] = None,
ssh_identity_file: Optional[str] = None,
local_repo: bool = False,
):
if server_url is not None and user_token is not None:
Expand All @@ -332,4 +335,4 @@ def from_config(
hub_client = get_hub_client(
project_name=project_name, repo_dir=repo_dir, local_repo=local_repo
)
return Client(hub_client, repo_dir, local_repo)
return Client(hub_client, repo_dir, git_identity_file, oauth_token, ssh_identity_file)
5 changes: 4 additions & 1 deletion docs/docs/reference/api/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before you can use `dstack` Python API, ensure you have installed the `dstack` p
started a `dstack` server with [configured clouds](../../docs/docs/guides/clouds.md).

```shell
pip install "dstack[all]>=0.11.2rc2"
pip install "dstack[all]==0.11.3rc1"
dstack start
```

Expand Down Expand Up @@ -78,6 +78,9 @@ Parameters:
- `project_name: Optional[str]` – (Optional) If not specified, it uses the default project.
- `server_url: Optional[str]` – (Optional) The URL of the `dstack` server. Must be used with `project_name` and `user_token`.
- `user_token: Optional[str]` – (Optional) The token of the `dstack` user. Must be used with `project_name` and `server_url`.
- `git_identity_file: Optional[str]` – (Optional) The path to the private SSH key file for non-public Git repositories.
- `oauth_token: Optional[str]` – (Optional) The authentication token for non-public Git repositories.
- `ssh_identity_file: Optional[str]` – (Optional) The path to the private SSH key file for SSH port forwarding.
- `local_repo: bool` – (Optional) If `repo_dir` is a Git repository,
`dstack` will use it as a Git repository (instead of uploading the entire contents).
If you'd like to opt out from this behavior, set `local_repo` to True. It defaults to `False`.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/python-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Before you can use `dstack` Python API, ensure you have installed the `dstack` p
started a `dstack` server with [configured clouds](../../docs/docs/guides/clouds.md).

```shell
pip install "dstack[all]>=0.11.2rc2"
pip install "dstack[all]==0.11.3rc1"
dstack start
```

Expand Down

0 comments on commit b1169f5

Please sign in to comment.