From e341c220b4f6ad88ab6d4870af63ed169ee9e434 Mon Sep 17 00:00:00 2001 From: mjibril Date: Tue, 30 Jul 2024 14:32:37 +0100 Subject: [PATCH] fix format --- sky/clouds/fluidstack.py | 12 ++++++++++ .../data_fetchers/fetch_fluidstack.py | 1 + tests/test_smoke.py | 24 +++++++------------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/sky/clouds/fluidstack.py b/sky/clouds/fluidstack.py index 4bc4fca9d8ae..ef397d4c55eb 100644 --- a/sky/clouds/fluidstack.py +++ b/sky/clouds/fluidstack.py @@ -261,6 +261,18 @@ def check_credentials(cls) -> Tuple[bool, Optional[str]]: try: assert os.path.exists( os.path.expanduser(fluidstack_utils.FLUIDSTACK_API_KEY_PATH)) + + with open(os.path.expanduser( + fluidstack_utils.FLUIDSTACK_API_KEY_PATH), + encoding='UTF-8') as f: + api_key = f.read().strip() + if not api_key.startswith('api_key'): + return False, ('Invalid FluidStack API key format. ' + 'To configure credentials, go to:\n ' + ' https://dashboard.fluidstack.io \n ' + 'to obtain an API key, ' + 'then add save the contents ' + 'to ~/.fluidstack/api_key \n') except AssertionError: return False, ('Failed to access FluidStack Cloud' ' with credentials. ' diff --git a/sky/clouds/service_catalog/data_fetchers/fetch_fluidstack.py b/sky/clouds/service_catalog/data_fetchers/fetch_fluidstack.py index cf943541e089..69f9b550fa38 100644 --- a/sky/clouds/service_catalog/data_fetchers/fetch_fluidstack.py +++ b/sky/clouds/service_catalog/data_fetchers/fetch_fluidstack.py @@ -220,6 +220,7 @@ def create_catalog(output_dir: str) -> None: mem = vcpus_mem['min_memory'] except IndexError: continue + price = float(plan['price_per_gpu_hr']) * gpu_cnt gpuinfo = { 'Gpus': [{ diff --git a/tests/test_smoke.py b/tests/test_smoke.py index 952832718fb2..bae174e6e312 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -963,7 +963,6 @@ def test_env_check(generic_cloud: str): # ---------- file_mounts ---------- -@pytest.mark.no_fluidstack # Requires other clouds to be enabled @pytest.mark.no_scp # SCP does not support num_nodes > 1 yet. Run test_scp_file_mounts instead. def test_file_mounts(generic_cloud: str): name = _get_cluster_name() @@ -1170,7 +1169,6 @@ def test_kubernetes_storage_mounts(): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support docker for now @pytest.mark.parametrize( 'image_id', [ @@ -2420,7 +2418,6 @@ def test_stop_gcp_spot(): # ---------- Testing managed job ---------- -@pytest.mark.no_fluidstack @pytest.mark.managed_jobs def test_managed_jobs(generic_cloud: str): """Test the managed jobs yaml.""" @@ -3044,7 +3041,6 @@ def test_managed_jobs_tpu(): # ---------- Testing env for managed jobs ---------- -@pytest.mark.no_fluidstack @pytest.mark.managed_jobs def test_managed_jobs_inline_env(generic_cloud: str): """Test managed jobs env""" @@ -3148,7 +3144,6 @@ def test_kubernetes_custom_image(image_id): run_one_test(test) - @pytest.mark.azure def test_azure_start_stop_two_nodes(): name = _get_cluster_name() @@ -3606,7 +3601,8 @@ def test_skyserve_dynamic_ondemand_fallback(): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not cloud storage +# TODO: fluidstack does not support `--cpus 2`, but the check for services in this test is based on CPUs +@pytest.mark.no_fluidstack @pytest.mark.serve def test_skyserve_user_bug_restart(generic_cloud: str): """Tests that we restart the service after user bug.""" @@ -3640,7 +3636,6 @@ def test_skyserve_user_bug_restart(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack @pytest.mark.serve @pytest.mark.no_kubernetes # Replicas on k8s may be running on the same node and have the same public IP def test_skyserve_load_balancer(generic_cloud: str): @@ -3707,7 +3702,6 @@ def test_skyserve_auto_restart(): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage @pytest.mark.serve def test_skyserve_cancel(generic_cloud: str): """Test skyserve with cancel""" @@ -3733,7 +3727,6 @@ def test_skyserve_cancel(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage @pytest.mark.serve def test_skyserve_streaming(generic_cloud: str): """Test skyserve with streaming""" @@ -3753,7 +3746,6 @@ def test_skyserve_streaming(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage @pytest.mark.serve def test_skyserve_readiness_timeout_fail(generic_cloud: str): """Test skyserve with large readiness probe latency, expected to fail""" @@ -3777,7 +3769,6 @@ def test_skyserve_readiness_timeout_fail(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage @pytest.mark.serve def test_skyserve_large_readiness_timeout(generic_cloud: str): """Test skyserve with customized large readiness timeout""" @@ -3796,7 +3787,8 @@ def test_skyserve_large_readiness_timeout(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage +# TODO: fluidstack does not support `--cpus 2`, but the check for services in this test is based on CPUs +@pytest.mark.no_fluidstack @pytest.mark.serve def test_skyserve_update(generic_cloud: str): """Test skyserve with update""" @@ -3825,7 +3817,8 @@ def test_skyserve_update(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage +# TODO: fluidstack does not support `--cpus 2`, but the check for services in this test is based on CPUs +pytest.mark.no_fluidstack @pytest.mark.serve def test_skyserve_rolling_update(generic_cloud: str): """Test skyserve with rolling update""" @@ -3903,7 +3896,6 @@ def test_skyserve_fast_update(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack # FluidStack does not support cloud storage @pytest.mark.serve def test_skyserve_update_autoscale(generic_cloud: str): """Test skyserve update with autoscale""" @@ -3940,7 +3932,7 @@ def test_skyserve_update_autoscale(generic_cloud: str): run_one_test(test) -@pytest.mark.no_fluidstack +@pytest.mark.no_fluidstack # Spot instances are note supported by Fluidstack @pytest.mark.serve @pytest.mark.no_kubernetes # Spot instances are not supported in Kubernetes @pytest.mark.parametrize('mode', ['rolling', 'blue_green']) @@ -4004,6 +3996,7 @@ def test_skyserve_new_autoscaler_update(mode: str, generic_cloud: str): run_one_test(test) +# TODO: fluidstack does not support `--cpus 2`, but the check for services in this test is based on CPUs @pytest.mark.no_fluidstack @pytest.mark.serve def test_skyserve_failures(generic_cloud: str): @@ -5070,7 +5063,6 @@ def test_excluded_file_cloud_storage_upload_copy(self, gitignore_structure, assert '4' in cnt_output.decode('utf-8'), \ 'Some items listed in .gitignore and .git/info/exclude are not excluded.' - @pytest.mark.no_fluidstack @pytest.mark.parametrize('ext_bucket_fixture, store_type', [('tmp_awscli_bucket', storage_lib.StoreType.S3), ('tmp_gsutil_bucket', storage_lib.StoreType.GCS),