SkyPilot offers a Python SDK, which is used under the hood by the :ref:`CLI <cli>`.
Most SDK calls are asynchronous and return a future (request ID
).
To wait and get the results:
- :ref:`sky.get(request_id) <sky-get>`: Wait for a request to finish, and get the results or exceptions.
- :ref:`sky.stream_and_get(request_id) <sky-stream-and-get>`: Stream the logs of a request, and get the results or exceptions.
To manage asynchronous requests:
- :ref:`sky.api_status() <sky-api-status>`: List all requests and their statuses.
- :ref:`sky.api_cancel(request_id) <sky-api-cancel>`: Cancel a request.
Refer to the Request Returns
and Request Raises
sections of each API for more details.
Note
Upgrading from v0.8 or older: If you upgraded from a version equal to or older than 0.8.0 to any newer version, you need to update your program to adapt to the new :ref:`asynchronous execution model <async>`. See the :ref:`migration guide <migration-0.8.1>` for more details.
.. autofunction:: sky.launch :noindex:
.. autofunction:: sky.stop :noindex:
.. autofunction:: sky.start :noindex:
.. autofunction:: sky.down :noindex:
.. autofunction:: sky.status :noindex:
.. autofunction:: sky.autostop :noindex:
.. autofunction:: sky.exec :noindex:
.. autofunction:: sky.queue :noindex:
.. autofunction:: sky.job_status :noindex:
.. autofunction:: sky.tail_logs :noindex:
.. autofunction:: sky.download_logs :noindex:
.. autofunction:: sky.cancel :noindex:
.. autofunction:: sky.jobs.launch :noindex:
.. autofunction:: sky.jobs.queue :noindex:
.. autofunction:: sky.jobs.cancel :noindex:
.. autofunction:: sky.jobs.tail_logs :noindex:
.. autofunction:: sky.serve.up :noindex:
.. autofunction:: sky.serve.update :noindex:
.. autofunction:: sky.serve.down :noindex:
.. autofunction:: sky.serve.terminate_replica :noindex:
.. autofunction:: sky.serve.status :noindex:
.. autofunction:: sky.serve.tail_logs :noindex:
.. autoclass:: sky.Task :members: :exclude-members: validate, validate_run, validate_name, expand_and_validate_file_mounts, expand_and_validate_workdir, is_controller_task, get_required_cloud_features, estimate_runtime, get_cloud_to_remote_file_mounts, get_inputs_cloud, get_local_to_remote_file_mounts, set_time_estimator, sync_storage_mounts, to_yaml_config .. automethod:: __init__
.. autoclass:: sky.Resources :members: copy .. automethod:: __init__
.. autoclass:: sky.ClusterStatus :members:
.. autoclass:: sky.JobStatus :members:
.. autoclass:: sky.StatusRefreshMode :members:
.. autofunction:: sky.get :noindex:
.. autofunction:: sky.stream_and_get :noindex:
.. autofunction:: sky.api_status :noindex:
.. autofunction:: sky.api_cancel :noindex:
.. autofunction:: sky.api_info :noindex:
.. autofunction:: sky.api_start :noindex:
.. autofunction:: sky.api_stop :noindex:
.. autofunction:: sky.api_server_logs :noindex: