Skip to content

Commit 0b304a2

Browse files
jeremymanningclaude
andcommitted
Fix black formatting issues in cloud provider files and notebook magic
- Auto-formatted clustrix/cloud_providers/gcp.py - Auto-formatted clustrix/cloud_providers/azure.py - Auto-formatted clustrix/cloud_providers/aws.py - Auto-formatted clustrix/notebook_magic.py All linting checks now pass and tests remain functional. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6bb87ca commit 0b304a2

File tree

4 files changed

+73
-44
lines changed

4 files changed

+73
-44
lines changed

clustrix/cloud_providers/aws.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,14 @@ def delete_cluster(
473473
for nodegroup_name in nodegroups.get("nodegroups", []):
474474
logger.info(f"Deleting node group: {nodegroup_name}")
475475
self.eks_client.delete_nodegroup(
476-
clusterName=cluster_identifier,
477-
nodegroupName=nodegroup_name
476+
clusterName=cluster_identifier, nodegroupName=nodegroup_name
478477
)
479478

480479
# Delete the cluster itself
481480
self.eks_client.delete_cluster(name=cluster_identifier)
482-
logger.info(f"EKS cluster '{cluster_identifier}' deletion initiated")
481+
logger.info(
482+
f"EKS cluster '{cluster_identifier}' deletion initiated"
483+
)
483484
return True
484485

485486
except ClientError as e:
@@ -524,9 +525,13 @@ def get_cluster_status(
524525
# Get details of first node group for node count
525526
ng_response = self.eks_client.describe_nodegroup(
526527
clusterName=cluster_identifier,
527-
nodegroupName=nodegroups["nodegroups"][0]
528+
nodegroupName=nodegroups["nodegroups"][0],
529+
)
530+
node_count = (
531+
ng_response["nodegroup"]
532+
.get("scalingConfig", {})
533+
.get("desiredSize", 0)
528534
)
529-
node_count = ng_response["nodegroup"].get("scalingConfig", {}).get("desiredSize", 0)
530535

531536
return {
532537
"cluster_name": cluster_identifier,

clustrix/cloud_providers/azure.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,11 @@ def delete_cluster(self, cluster_identifier: str, cluster_type: str = "vm") -> b
456456
# Delete AKS cluster
457457
operation = self.container_client.managed_clusters.begin_delete(
458458
resource_group_name=self.resource_group,
459-
resource_name=cluster_identifier
459+
resource_name=cluster_identifier,
460+
)
461+
logger.info(
462+
f"Deleting AKS cluster '{cluster_identifier}' - operation: {operation}"
460463
)
461-
logger.info(f"Deleting AKS cluster '{cluster_identifier}' - operation: {operation}")
462464
return True
463465
else:
464466
raise ValueError(f"Unknown cluster type: {cluster_type}")
@@ -500,7 +502,7 @@ def get_cluster_status(
500502
# Get AKS cluster status
501503
cluster = self.container_client.managed_clusters.get(
502504
resource_group_name=self.resource_group,
503-
resource_name=cluster_identifier
505+
resource_name=cluster_identifier,
504506
)
505507

506508
return {
@@ -563,8 +565,10 @@ def list_clusters(self) -> List[Dict[str, Any]]:
563565

564566
# List AKS clusters
565567
try:
566-
aks_clusters = self.container_client.managed_clusters.list_by_resource_group(
567-
resource_group_name=self.resource_group
568+
aks_clusters = (
569+
self.container_client.managed_clusters.list_by_resource_group(
570+
resource_group_name=self.resource_group
571+
)
568572
)
569573

570574
for cluster in aks_clusters:

clustrix/cloud_providers/gcp.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,10 @@ def create_gke_cluster(
274274
},
275275
},
276276
"master_auth": {
277-
"client_certificate_config": {
278-
"issue_client_certificate": False
279-
}
280-
},
281-
"ip_allocation_policy": {
282-
"use_ip_aliases": True
283-
},
284-
"network_policy": {
285-
"enabled": False
277+
"client_certificate_config": {"issue_client_certificate": False}
286278
},
279+
"ip_allocation_policy": {"use_ip_aliases": True},
280+
"network_policy": {"enabled": False},
287281
"addons_config": {
288282
"http_load_balancing": {"disabled": False},
289283
"horizontal_pod_autoscaling": {"disabled": False},
@@ -361,7 +355,9 @@ def delete_cluster(
361355
request = container_v1.DeleteClusterRequest(name=name)
362356
operation = self.container_client.delete_cluster(request=request)
363357

364-
logger.info(f"Deleting GKE cluster '{cluster_identifier}' - operation: {operation.name}")
358+
logger.info(
359+
f"Deleting GKE cluster '{cluster_identifier}' - operation: {operation.name}"
360+
)
365361
return True
366362
else:
367363
raise ValueError(f"Unknown cluster type: {cluster_type}")

clustrix/notebook_magic.py

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,10 @@ def _create_widgets(self):
480480
"huggingface",
481481
],
482482
description="Cluster Type:",
483-
tooltip=("Choose where to run your jobs: local machine, remote servers "
484-
"(SSH/SLURM/PBS/SGE), Kubernetes clusters, or cloud providers"),
483+
tooltip=(
484+
"Choose where to run your jobs: local machine, remote servers "
485+
"(SSH/SLURM/PBS/SGE), Kubernetes clusters, or cloud providers"
486+
),
485487
style=style,
486488
layout=full_layout,
487489
)
@@ -492,8 +494,10 @@ def _create_widgets(self):
492494
self.config_name = widgets.Text(
493495
description="Config Name:",
494496
placeholder="Enter configuration name",
495-
tooltip=("Give this configuration a descriptive name "
496-
"(e.g., 'AWS Production', 'Local Testing', 'HPC Cluster')"),
497+
tooltip=(
498+
"Give this configuration a descriptive name "
499+
"(e.g., 'AWS Production', 'Local Testing', 'HPC Cluster')"
500+
),
497501
style=style,
498502
layout=full_layout,
499503
)
@@ -586,8 +590,10 @@ def _create_dynamic_fields(self):
586590
self.host_field = widgets.Text(
587591
description="Host/Address:",
588592
placeholder="hostname or IP address",
589-
tooltip=("Enter the hostname or IP address of your remote cluster "
590-
"(e.g., cluster.example.com or 192.168.1.100)"),
593+
tooltip=(
594+
"Enter the hostname or IP address of your remote cluster "
595+
"(e.g., cluster.example.com or 192.168.1.100)"
596+
),
591597
style=style,
592598
layout=full_layout,
593599
)
@@ -604,8 +610,10 @@ def _create_dynamic_fields(self):
604610
self.ssh_key_field = widgets.Text(
605611
description="SSH Key:",
606612
placeholder="~/.ssh/id_rsa",
607-
tooltip=("Path to your SSH private key file for passwordless authentication "
608-
"(generate with 'ssh-keygen -t rsa')"),
613+
tooltip=(
614+
"Path to your SSH private key file for passwordless authentication "
615+
"(generate with 'ssh-keygen -t rsa')"
616+
),
609617
style=style,
610618
layout=half_layout,
611619
)
@@ -629,8 +637,10 @@ def _create_dynamic_fields(self):
629637
value="8GB",
630638
description="Memory:",
631639
placeholder="e.g., 8GB, 16GB",
632-
tooltip=("Amount of RAM to request for each job (e.g., '8GB', '16GB'). "
633-
"Higher memory allows processing larger datasets"),
640+
tooltip=(
641+
"Amount of RAM to request for each job (e.g., '8GB', '16GB'). "
642+
"Higher memory allows processing larger datasets"
643+
),
634644
style=style,
635645
layout=widgets.Layout(width="200px"),
636646
)
@@ -646,8 +656,10 @@ def _create_dynamic_fields(self):
646656
self.k8s_namespace = widgets.Text(
647657
value="default",
648658
description="Namespace:",
649-
tooltip=("Kubernetes namespace for job pods (default: 'default'). "
650-
"Contact your cluster admin for appropriate namespace"),
659+
tooltip=(
660+
"Kubernetes namespace for job pods (default: 'default'). "
661+
"Contact your cluster admin for appropriate namespace"
662+
),
651663
style=style,
652664
layout=half_layout,
653665
)
@@ -756,16 +768,20 @@ def _create_dynamic_fields(self):
756768
self.azure_client_id = widgets.Text(
757769
description="Client ID:",
758770
placeholder="Azure service principal client ID",
759-
tooltip=("Azure service principal application ID (UUID format). "
760-
"Create in Azure AD > App registrations"),
771+
tooltip=(
772+
"Azure service principal application ID (UUID format). "
773+
"Create in Azure AD > App registrations"
774+
),
761775
style=style,
762776
layout=half_layout,
763777
)
764778
self.azure_client_secret = widgets.Password(
765779
description="Client Secret:",
766780
placeholder="Azure service principal secret",
767-
tooltip=("Azure service principal secret (keep secure!). Generated in Azure AD > "
768-
"App registrations > Certificates & secrets"),
781+
tooltip=(
782+
"Azure service principal secret (keep secure!). Generated in Azure AD > "
783+
"App registrations > Certificates & secrets"
784+
),
769785
style=style,
770786
layout=half_layout,
771787
)
@@ -782,8 +798,10 @@ def _create_dynamic_fields(self):
782798
options=["us-central1"], # Will be populated dynamically
783799
value="us-central1",
784800
description="GCP Region:",
785-
tooltip=("Google Cloud region for resources (affects latency and pricing). "
786-
"Choose region closest to your location"),
801+
tooltip=(
802+
"Google Cloud region for resources (affects latency and pricing). "
803+
"Choose region closest to your location"
804+
),
787805
style=style,
788806
layout=half_layout,
789807
)
@@ -800,8 +818,10 @@ def _create_dynamic_fields(self):
800818
self.gcp_service_account_key = widgets.Textarea(
801819
description="Service Account Key:",
802820
placeholder="Paste your GCP service account JSON key here",
803-
tooltip=("Google Cloud service account key in JSON format (keep secure!). "
804-
"Create in GCP Console > IAM & Admin > Service Accounts"),
821+
tooltip=(
822+
"Google Cloud service account key in JSON format (keep secure!). "
823+
"Create in GCP Console > IAM & Admin > Service Accounts"
824+
),
805825
style=style,
806826
layout=full_layout,
807827
)
@@ -818,8 +838,10 @@ def _create_dynamic_fields(self):
818838
options=["gpu_1x_a10"], # Will be populated dynamically
819839
value="gpu_1x_a10",
820840
description="Instance Type:",
821-
tooltip=("Lambda Cloud GPU instance type (affects GPU model, RAM, and cost). "
822-
"gpu_1x_a10 = 1x NVIDIA A10 + 30GB RAM"),
841+
tooltip=(
842+
"Lambda Cloud GPU instance type (affects GPU model, RAM, and cost). "
843+
"gpu_1x_a10 = 1x NVIDIA A10 + 30GB RAM"
844+
),
823845
style=style,
824846
layout=half_layout,
825847
)
@@ -828,8 +850,10 @@ def _create_dynamic_fields(self):
828850
self.hf_token = widgets.Password(
829851
description="HF Token:",
830852
placeholder="Your HuggingFace API token",
831-
tooltip=("HuggingFace API token for Spaces access (keep secure!). "
832-
"Get from HuggingFace Settings > Access Tokens"),
853+
tooltip=(
854+
"HuggingFace API token for Spaces access (keep secure!). "
855+
"Get from HuggingFace Settings > Access Tokens"
856+
),
833857
style=style,
834858
layout=half_layout,
835859
)

0 commit comments

Comments
 (0)