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

Handle KeyboardInterrupt in CLI when getting run plan #1626

Closed
Tracked by #1735
jvstme opened this issue Aug 26, 2024 · 3 comments · Fixed by #1756
Closed
Tracked by #1735

Handle KeyboardInterrupt in CLI when getting run plan #1626

jvstme opened this issue Aug 26, 2024 · 3 comments · Fixed by #1756

Comments

@jvstme
Copy link
Collaborator

jvstme commented Aug 26, 2024

Steps to reproduce

  1. dstack apply a run configuration
  2. Press Ctrl+C while getting run plan

Expected behavior

dstack apply exits cleanly.

Actual behavior

Traceback (most recent call last):
  File "/home/jvstme/git/dstack/dstack/venv/bin/dstack", line 8, in <module>
    sys.exit(main())
  File "/home/jvstme/git/dstack/dstack/src/dstack/_internal/cli/main.py", line 75, in main
    args.func(args)
  File "/home/jvstme/git/dstack/dstack/src/dstack/_internal/cli/commands/apply.py", line 70, in _command
    configurator.apply_configuration(
  File "/home/jvstme/git/dstack/dstack/src/dstack/_internal/cli/services/configurators/run.py", line 68, in apply_configuration
    run_plan = self.api.runs.get_plan(
  File "/home/jvstme/git/dstack/dstack/src/dstack/api/_public/runs.py", line 467, in get_plan
    return self._api_client.runs.get_plan(self._project, run_spec)
  File "/home/jvstme/git/dstack/dstack/src/dstack/api/server/_runs.py", line 61, in get_plan
    resp = self._request(f"/api/project/{project_name}/runs/get_plan", body=body.json())
  File "/home/jvstme/git/dstack/dstack/src/dstack/api/server/__init__.py", line 118, in _request
    resp = self._s.post(f"{self._base_url}/{path}", **kwargs)
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/jvstme/git/dstack/dstack/venv/lib64/python3.8/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib64/python3.8/http/client.py", line 1348, in getresponse
    response.begin()
  File "/usr/lib64/python3.8/http/client.py", line 316, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python3.8/http/client.py", line 277, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib64/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt
@jvstme jvstme added good first issue Good for newcomers ux labels Aug 26, 2024
Copy link

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

@IshuSinghSE
Copy link
Contributor

I hope this message finds you well. I would like to express my interest in taking on issue #1626, which involves handling the KeyboardInterrupt exception in the CLI during the retrieval of the run plan.

Please assign this issue to me at your earliest convenience @peterschmidt85 .
Thank you for your consideration.

@peterschmidt85
Copy link
Contributor

@IshuSinghSE Sure, feel free to send your PR!

IshuSinghSE pushed a commit to IshuSinghSE/dstack that referenced this issue Oct 1, 2024
IshuSinghSE pushed a commit to IshuSinghSE/dstack that referenced this issue Oct 1, 2024
r4victor pushed a commit that referenced this issue Oct 2, 2024
r4victor pushed a commit that referenced this issue Oct 3, 2024
* Fix Handle KeyboardInterrupt in CLI when getting run plan #1626

* Allow using all existing regions unless a specific set of regions is configured #1573

* Delete src/dstack/_internal/cli/commands/apply.py

* Revert "Delete src/dstack/_internal/cli/commands/apply.py"

This reverts commit 0e6a938.

* Fix use all available runpod regions by default

---------

Co-authored-by: Ishu Singh <[email protected]>
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.

3 participants