canonical / canonical/data-science-stack
Warn users that resources may be left behind if interrupting `dss initialize`, `dss create`
- Dominant language
- Python
- Stars
- 37
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
### Why it needs to get done
If a user does:
```
dss create
# wait a few seconds, but not long enough to create the notebook
ctrl+c
```
the `dss create` command is interrupted but likely has created a notebook already. We should warn the users about this. An option could be to add a signal handler in `main.create_notebook_command()` like:
```python
import signal
def create_notebook_command(...):
def signal_handler(sig, frame):
logger.info(f"`dss create` cancelled. This may leave a notebook behind in your environment - use `dss list` to find the notebook and `dss remove {name}` to remove it")
click.get_current_context().exit(1)
signal.signal(signal.SIGINT, signal_handler)
...
```
[ref](https://stackoverflow.com/a/1112350/5394584)
We can add a similar warning to `dss initialize`
### What needs to get done
.
### When is the task considered done
`dss create` and `dss initialize` gracefully handle SIGINT, warning the users of potential consequences and how to address them
Contributor guide
Assessment
This issue has not been assessed yet.