skypilot-users
How can I add a unittest to check if a VM setup was successful in Sky?
Georgehwp is looking for a way to add a unittest to verify if a VM setup was successful in Sky. Romil Bhardwaj provided guidance on using the Python API or CLI to check the status of the setup.
Ge
Georgehwp
Asked on Feb 19, 2024
- You can use the Python API to check if a specific
sky launch
was successful:
import sky
cluster_name='test'
cluster = [c for c in sky.status() if c['name']==cluster_name]
cluster[0]['status'] # ClusterStatus.UP indicates successful provisioning, including running setup
- Alternatively, you can use the CLI
sky status
to output logs to a file and grep the text for the desired stage in the output:
sky launch ... | tee /tmp/skyout.log
cat /tmp/skyout.log | grep 'Successfully provisioned cluster' # Exits with 0 if the cluster setup was completed
Feb 19, 2024Edited by