Skip to content

Commit 7f25549

Browse files
dimakisanishasthana
authored andcommitted
refactor: update formatting using black
1 parent e452eff commit 7f25549

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

src/codeflare_sdk/cluster/cluster.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ def evaluate_dispatch_priority(self):
131131
def validate_image_config(self):
132132
"""
133133
Validates that the image configuration is not empty.
134-
134+
135135
:param image: The image string to validate
136136
:raises ValueError: If the image is not specified
137137
"""
138138
if self.config.image == "" or self.config.image == None:
139139
raise ValueError("Image must be specified in the ClusterConfiguration")
140140

141-
142141
def create_app_wrapper(self):
143142
"""
144143
Called upon cluster object creation, creates an AppWrapper yaml based on
@@ -153,7 +152,7 @@ def create_app_wrapper(self):
153152
raise TypeError(
154153
f"Namespace {self.config.namespace} is of type {type(self.config.namespace)}. Check your Kubernetes Authentication."
155154
)
156-
155+
157156
# Validate image configuration
158157
self.validate_image_config()
159158

tests/unit_test.py

+33-8
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def test_config_creation():
252252
assert config.dispatch_priority == None
253253
assert config.mcad == True
254254
assert config.local_interactive == False
255-
256255

257256

258257
def test_cluster_creation(mocker):
@@ -262,7 +261,8 @@ def test_cluster_creation(mocker):
262261
assert filecmp.cmp(
263262
"unit-test-cluster.yaml", f"{parent}/tests/test-case.yaml", shallow=True
264263
)
265-
264+
265+
266266
def test_create_app_wrapper_raises_error_with_no_image():
267267
config = createClusterConfig()
268268
config.image = "" # Clear the image to test error handling
@@ -271,8 +271,9 @@ def test_create_app_wrapper_raises_error_with_no_image():
271271
cluster.create_app_wrapper()
272272
assert False, "Expected ValueError when 'image' is not specified."
273273
except ValueError as error:
274-
assert str(error) == "Image must be specified in the ClusterConfiguration", \
275-
"Error message did not match expected output."
274+
assert (
275+
str(error) == "Image must be specified in the ClusterConfiguration"
276+
), "Error message did not match expected output."
276277

277278

278279
def test_cluster_creation_no_mcad(mocker):
@@ -748,7 +749,13 @@ def test_ray_details(mocker, capsys):
748749
"codeflare_sdk.cluster.cluster.Cluster.cluster_dashboard_uri",
749750
return_value="",
750751
)
751-
cf = Cluster(ClusterConfiguration(name="raytest2", namespace="ns", image= "quay.io/project-codeflare/ray:latest-py39-cu118"))
752+
cf = Cluster(
753+
ClusterConfiguration(
754+
name="raytest2",
755+
namespace="ns",
756+
image="quay.io/project-codeflare/ray:latest-py39-cu118",
757+
)
758+
)
752759
captured = capsys.readouterr()
753760
ray2 = _copy_to_ray(cf)
754761
details = cf.details()
@@ -1914,7 +1921,13 @@ def test_cluster_status(mocker):
19141921
head_mem=8,
19151922
head_gpu=0,
19161923
)
1917-
cf = Cluster(ClusterConfiguration(name="test", namespace="ns", image="quay.io/project-codeflare/ray:latest-py39-cu118"))
1924+
cf = Cluster(
1925+
ClusterConfiguration(
1926+
name="test",
1927+
namespace="ns",
1928+
image="quay.io/project-codeflare/ray:latest-py39-cu118",
1929+
)
1930+
)
19181931
mocker.patch("codeflare_sdk.cluster.cluster._app_wrapper_status", return_value=None)
19191932
mocker.patch("codeflare_sdk.cluster.cluster._ray_cluster_status", return_value=None)
19201933
status, ready = cf.status()
@@ -2004,7 +2017,13 @@ def test_wait_ready(mocker, capsys):
20042017
mock_response = mocker.Mock()
20052018
mock_response.status_code = 200
20062019
mocker.patch("requests.get", return_value=mock_response)
2007-
cf = Cluster(ClusterConfiguration(name="test", namespace="ns", image= "quay.io/project-codeflare/ray:latest-py39-cu118"))
2020+
cf = Cluster(
2021+
ClusterConfiguration(
2022+
name="test",
2023+
namespace="ns",
2024+
image="quay.io/project-codeflare/ray:latest-py39-cu118",
2025+
)
2026+
)
20082027
try:
20092028
cf.wait_ready(timeout=5)
20102029
assert 1 == 0
@@ -2669,7 +2688,13 @@ def test_gen_app_wrapper_with_oauth(mocker: MockerFixture):
26692688
mocker.patch(
26702689
"codeflare_sdk.utils.generate_yaml.write_user_appwrapper", write_user_appwrapper
26712690
)
2672-
Cluster(ClusterConfiguration("test_cluster", openshift_oauth=True, image= "quay.io/project-codeflare/ray:latest-py39-cu118"))
2691+
Cluster(
2692+
ClusterConfiguration(
2693+
"test_cluster",
2694+
openshift_oauth=True,
2695+
image="quay.io/project-codeflare/ray:latest-py39-cu118",
2696+
)
2697+
)
26732698
user_yaml = write_user_appwrapper.call_args.args[0]
26742699
assert any(
26752700
container["name"] == "oauth-proxy"

tests/unit_test_support.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def createClusterConfig():
4747
machine_types=["cpu.small", "gpu.large"],
4848
image_pull_secrets=["unit-test-pull-secret"],
4949
ingress_domain="apps.cluster.awsroute.org",
50-
image="quay.io/project-codeflare/ray:latest-py39-cu118"
50+
image="quay.io/project-codeflare/ray:latest-py39-cu118",
5151
)
5252
return config
5353

0 commit comments

Comments
 (0)