Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 2 commits #525

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/codeflare_sdk/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def create_app_wrapper(self):
write_to_file = self.config.write_to_file
verify_tls = self.config.verify_tls
local_queue = self.config.local_queue
user_labels = self.config.user_labels
return generate_appwrapper(
name=name,
namespace=namespace,
Expand All @@ -212,7 +211,6 @@ def create_app_wrapper(self):
write_to_file=write_to_file,
verify_tls=verify_tls,
local_queue=local_queue,
user_labels=user_labels,
)

# creates a new cluster with the provided or default spec
Expand Down Expand Up @@ -455,7 +453,9 @@ def cluster_dashboard_uri(self) -> str:
"name"
] == f"ray-dashboard-{self.config.name}" or route["metadata"][
"name"
].startswith(f"{self.config.name}-ingress"):
].startswith(
f"{self.config.name}-ingress"
):
protocol = "https" if route["spec"].get("tls") else "http"
return f"{protocol}://{route['spec']['host']}"
else:
Expand Down
1 change: 0 additions & 1 deletion src/codeflare_sdk/cluster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class ClusterConfiguration:
dispatch_priority: str = None
write_to_file: bool = False
verify_tls: bool = True
user_labels: dict = field(default_factory=dict)

def __post_init__(self):
if not self.verify_tls:
Expand Down
23 changes: 4 additions & 19 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ def get_default_kueue_name(namespace: str):


def write_components(
user_yaml: dict,
output_file_name: str,
namespace: str,
local_queue: Optional[str],
user_labels: dict,
user_yaml: dict, output_file_name: str, namespace: str, local_queue: Optional[str]
):
# Create the directory if it doesn't exist
directory_path = os.path.dirname(output_file_name)
Expand All @@ -335,8 +331,6 @@ def write_components(
]
labels = component["generictemplate"]["metadata"]["labels"]
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
for key in user_labels:
labels.update({key: user_labels[key]})
outfile.write("---\n")
yaml.dump(
component["generictemplate"], outfile, default_flow_style=False
Expand All @@ -345,11 +339,7 @@ def write_components(


def load_components(
user_yaml: dict,
name: str,
namespace: str,
local_queue: Optional[str],
user_labels: dict,
user_yaml: dict, name: str, namespace: str, local_queue: Optional[str]
):
component_list = []
components = user_yaml.get("spec", "resources")["resources"].get("GenericItems")
Expand All @@ -365,8 +355,6 @@ def load_components(
]
labels = component["generictemplate"]["metadata"]["labels"]
labels.update({"kueue.x-k8s.io/queue-name": lq_name})
for key in user_labels:
labels.update({key: user_labels[key]})
component_list.append(component["generictemplate"])

resources = "---\n" + "---\n".join(
Expand Down Expand Up @@ -407,7 +395,6 @@ def generate_appwrapper(
write_to_file: bool,
verify_tls: bool,
local_queue: Optional[str],
user_labels,
):
user_yaml = read_template(template)
appwrapper_name, cluster_name = gen_names(name)
Expand Down Expand Up @@ -459,13 +446,11 @@ def generate_appwrapper(
if mcad:
write_user_appwrapper(user_yaml, outfile)
else:
write_components(user_yaml, outfile, namespace, local_queue, user_labels)
write_components(user_yaml, outfile, namespace, local_queue)
return outfile
else:
if mcad:
user_yaml = load_appwrapper(user_yaml, name)
else:
user_yaml = load_components(
user_yaml, name, namespace, local_queue, user_labels
)
user_yaml = load_components(user_yaml, name, namespace, local_queue)
return user_yaml
2 changes: 0 additions & 2 deletions tests/test-case-no-mcad.yamls
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ metadata:
labels:
controller-tools.k8s.io: '1.0'
kueue.x-k8s.io/queue-name: local-queue-default
testlabel: test
testlabel2: test
name: unit-test-cluster-ray
namespace: ns
spec:
Expand Down
3 changes: 0 additions & 3 deletions tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def test_cluster_creation_no_mcad(mocker):
config.name = "unit-test-cluster-ray"
config.write_to_file = True
config.mcad = False
config.user_labels = {"testlabel": "test", "testlabel2": "test"}
cluster = Cluster(config)

assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
Expand All @@ -349,7 +348,6 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
config.mcad = False
config.write_to_file = True
config.local_queue = "local-queue-default"
config.user_labels = {"testlabel": "test", "testlabel2": "test"}
cluster = Cluster(config)
assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
assert cluster.app_wrapper_name == "unit-test-cluster-ray"
Expand All @@ -375,7 +373,6 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
write_to_file=True,
mcad=False,
local_queue="local-queue-default",
user_labels={"testlabel": "test", "testlabel2": "test"},
)
cluster = Cluster(config)
assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
Expand Down
Loading