skypilot
skypilot copied to clipboard
[Prototype] RESTful API for core
This is a prototype for client-server architecture.
Architecture
We now refactors the interface to 3 categories:
- Restful API
- SDK
- CLI
Features
This is a list of features added (to be updated)
- API server CLI (it can be started automatically):
sky api start
;sky api stop
;sky api logs
-
sky status
(through HTTP request) - Automatic cluster status update periodically
- Async launch
$ curl -i -X POST http://127.0.0.1:8000/launch \
-H "Content-Type: application/json" \
-d '{"task": "resources:\n cloud: aws\n cpus: 2", "cluster_name": "test-10"}'
...
x-request-id: 7f6f0287-2448-42b8-bb0a-b9592b51eb1c
- Show all requests
$ curl -i -X GET http://127.0.0.1:8000/requests
[{"request_id":"7f6f0287-2448-42b8-bb0a-b9592b51eb1c","request_name":"launch","status":"RUNNING","return_value":null,"log_path":null,"pid":53345}]%
- Wait for request and get the result
curl -i -X GET http://127.0.0.1:8000/get \
-H "Content-Type: application/json" \
-d '{"request_id": "7f6f0287-2448-42b8-bb0a-b9592b51eb1c"}'
- Abort a request
curl -i -X POST http://127.0.0.1:8000/abort \
-H "Content-Type: application/json" \
-d '{"request_id": "7f6f0287-2448-42b8-bb0a-b9592b51eb1c"}'
- Stream the logs for a request
curl -i -X GET http://127.0.0.1:8000/stream \
-H "Content-Type: application/json" \
-d '{"request_id": "7f6f0287-2448-42b8-bb0a-b9592b51eb1c"}'
TODOs
- [ ] Stream logs for a request
- [x] Stream logs
- [ ] Fix the spinner for launching (rich.status)
- [ ] Restful APIs
- [ ]
launch
- [x] Basic support without file mounts
- [x] Fix log tailing in
sky launch
- [ ] Design and support direct
ssh
- [ ] Support file mounts (automatically upload to the bucket and download to the VM)
- [ ]
- [ ] Refine UX
Tested (run the relevant ones):
- [ ] Code formatting:
bash format.sh
- [ ] Any manual or new tests for this PR (please specify below)
- [ ] All smoke tests:
pytest tests/test_smoke.py
- [ ] Relevant individual smoke tests:
pytest tests/test_smoke.py::test_fill_in_the_name
- [ ] Backward compatibility tests:
bash tests/backward_comaptibility_tests.sh