skypilot-nightly 1.0.0.dev20250120__py3-none-any.whl → 1.0.0.dev20250121__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sky/__init__.py CHANGED
@@ -5,7 +5,7 @@ from typing import Optional
5
5
  import urllib.request
6
6
 
7
7
  # Replaced with the current commit when building the wheels.
8
- _SKYPILOT_COMMIT_SHA = 'b81d0a0f6d5410948520c3fe021fba07cd8ae21d'
8
+ _SKYPILOT_COMMIT_SHA = '8cf6c86efd3ed007a944422141efbdb0fbb6547f'
9
9
 
10
10
 
11
11
  def _get_git_commit():
@@ -35,7 +35,7 @@ def _get_git_commit():
35
35
 
36
36
 
37
37
  __commit__ = _get_git_commit()
38
- __version__ = '1.0.0.dev20250120'
38
+ __version__ = '1.0.0.dev20250121'
39
39
  __root_dir__ = os.path.dirname(os.path.abspath(__file__))
40
40
 
41
41
 
@@ -553,17 +553,28 @@ def _configure_security_group(ec2, vpc_id: str, expected_sg_name: str,
553
553
 
554
554
  def _get_or_create_vpc_security_group(ec2, vpc_id: str,
555
555
  expected_sg_name: str) -> Any:
556
- # Figure out which security groups with this name exist for each VPC...
557
- vpc_to_existing_sg = {
558
- sg.vpc_id: sg for sg in _get_security_groups_from_vpc_ids(
559
- ec2,
560
- [vpc_id],
561
- [expected_sg_name],
562
- )
563
- }
556
+ """Find or create a security group in the specified VPC.
564
557
 
565
- if vpc_id in vpc_to_existing_sg:
566
- return vpc_to_existing_sg[vpc_id]
558
+ Args:
559
+ ec2: The initialized EC2 client object.
560
+ vpc_id: The ID of the VPC where the security group should be queried
561
+ or created.
562
+ expected_sg_name: The expected name of the security group.
563
+
564
+ Returns:
565
+ The security group object containing the details of the security group.
566
+
567
+ Raises:
568
+ exceptions.NoClusterLaunchedError: If the security group creation fails
569
+ and is not due to an existing duplicate.
570
+ botocore.exceptions.ClientError: If the security group creation fails
571
+ due to AWS service issues.
572
+ """
573
+ # Figure out which security groups with this name exist for each VPC...
574
+ security_group = _get_security_group_from_vpc_id(ec2, vpc_id,
575
+ expected_sg_name)
576
+ if security_group is not None:
577
+ return security_group
567
578
 
568
579
  try:
569
580
  # create a new security group
@@ -573,34 +584,45 @@ def _get_or_create_vpc_security_group(ec2, vpc_id: str,
573
584
  VpcId=vpc_id,
574
585
  )
575
586
  except ec2.meta.client.exceptions.ClientError as e:
587
+ if e.response['Error']['Code'] == 'InvalidGroup.Duplicate':
588
+ # The security group already exists, but we didn't see it
589
+ # because of eventual consistency.
590
+ logger.warning(f'{expected_sg_name} already exists when creating.')
591
+ security_group = _get_security_group_from_vpc_id(
592
+ ec2, vpc_id, expected_sg_name)
593
+ assert (security_group is not None and
594
+ security_group.group_name == expected_sg_name), (
595
+ f'Expected {expected_sg_name} but got {security_group}')
596
+ logger.info(
597
+ f'Found existing security group {colorama.Style.BRIGHT}'
598
+ f'{security_group.group_name}{colorama.Style.RESET_ALL} '
599
+ f'[id={security_group.id}]')
600
+ return security_group
576
601
  message = ('Failed to create security group. Error: '
577
602
  f'{common_utils.format_exception(e)}')
578
603
  logger.warning(message)
579
604
  raise exceptions.NoClusterLaunchedError(message) from e
580
605
 
581
- security_group = _get_security_groups_from_vpc_ids(ec2, [vpc_id],
582
- [expected_sg_name])
583
-
584
- assert security_group, 'Failed to create security group'
585
- security_group = security_group[0]
586
-
606
+ security_group = _get_security_group_from_vpc_id(ec2, vpc_id,
607
+ expected_sg_name)
608
+ assert security_group is not None, 'Failed to create security group'
587
609
  logger.info(f'Created new security group {colorama.Style.BRIGHT}'
588
610
  f'{security_group.group_name}{colorama.Style.RESET_ALL} '
589
611
  f'[id={security_group.id}]')
590
612
  return security_group
591
613
 
592
614
 
593
- def _get_security_groups_from_vpc_ids(ec2, vpc_ids: List[str],
594
- group_names: List[str]) -> List[Any]:
595
- unique_vpc_ids = list(set(vpc_ids))
596
- unique_group_names = set(group_names)
597
-
615
+ def _get_security_group_from_vpc_id(ec2, vpc_id: str,
616
+ group_name: str) -> Optional[Any]:
617
+ """Get security group by VPC ID and group name."""
598
618
  existing_groups = list(
599
619
  ec2.security_groups.filter(Filters=[{
600
620
  'Name': 'vpc-id',
601
- 'Values': unique_vpc_ids
621
+ 'Values': [vpc_id]
602
622
  }]))
603
- filtered_groups = [
604
- sg for sg in existing_groups if sg.group_name in unique_group_names
605
- ]
606
- return filtered_groups
623
+
624
+ for sg in existing_groups:
625
+ if sg.group_name == group_name:
626
+ return sg
627
+
628
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: skypilot-nightly
3
- Version: 1.0.0.dev20250120
3
+ Version: 1.0.0.dev20250121
4
4
  Summary: SkyPilot: An intercloud broker for the clouds
5
5
  Author: SkyPilot Team
6
6
  License: Apache 2.0
@@ -1,4 +1,4 @@
1
- sky/__init__.py,sha256=H1OJA_bZf59Rdg7CgHy8yMr7uxtMUwuxW7gGNX2jVlk,5944
1
+ sky/__init__.py,sha256=UV5_oqV4726l68oWfUHS5Y75hxkIUCaqBQc03bEeRm0,5944
2
2
  sky/admin_policy.py,sha256=hPo02f_A32gCqhUueF0QYy1fMSSKqRwYEg_9FxScN_s,3248
3
3
  sky/authentication.py,sha256=LXUDABKP1FJCS256xTTDJa40WXwHKF5x49S-4hZbD1M,21501
4
4
  sky/check.py,sha256=s8deMVL-k9y8gd519K7NWZc3DqWsEySwiAr0uH3Vvcc,9459
@@ -116,7 +116,7 @@ sky/provision/logging.py,sha256=yZWgejrFBhhRjAtvFu5N5bRXIMK5TuwNjp1vKQqz2pw,2103
116
116
  sky/provision/metadata_utils.py,sha256=LrxeV4wD2QPzNdXV_npj8q-pr35FatxBBjF_jSbpOT0,4013
117
117
  sky/provision/provisioner.py,sha256=ZOgFOO0NB4QZVPwd4qikRqi615Bq67n0Vcl3cTDVxNE,29153
118
118
  sky/provision/aws/__init__.py,sha256=mxq8PeWJqUtalDozTNpbtENErRZ1ktEs8uf2aG9UUgU,731
119
- sky/provision/aws/config.py,sha256=_8jvi8UVMtIVChDDnv5uHV2CoPyKvKqvxJ4xIEBYdDc,24629
119
+ sky/provision/aws/config.py,sha256=-4mr5uxgsl_8eLm_4DfP8JurZGSysGuY0iDeBTHnX5Q,25943
120
120
  sky/provision/aws/instance.py,sha256=eCslJ2XfJo_pkQMnKFQqhGnUIRvwKiT12oxBY5-klss,40750
121
121
  sky/provision/aws/utils.py,sha256=m49pS-SHGW7Au3bhDeTPsL8N5iRzbwOXzyEWRCc1Vho,3238
122
122
  sky/provision/azure/__init__.py,sha256=87cgk1_Ws7n9rqaDDPv-HpfrkVeSQMdFQnhnXwyx9g4,548
@@ -289,9 +289,9 @@ sky/utils/kubernetes/k8s_gpu_labeler_job.yaml,sha256=k0TBoQ4zgf79-sVkixKSGYFHQ7Z
289
289
  sky/utils/kubernetes/k8s_gpu_labeler_setup.yaml,sha256=VLKT2KKimZu1GDg_4AIlIt488oMQvhRZWwsj9vBbPUg,3812
290
290
  sky/utils/kubernetes/rsync_helper.sh,sha256=h4YwrPFf9727CACnMJvF3EyK_0OeOYKKt4su_daKekw,1256
291
291
  sky/utils/kubernetes/ssh_jump_lifecycle_manager.py,sha256=Kq1MDygF2IxFmu9FXpCxqucXLmeUrvs6OtRij6XTQbo,6554
292
- skypilot_nightly-1.0.0.dev20250120.dist-info/LICENSE,sha256=emRJAvE7ngL6x0RhQvlns5wJzGI3NEQ_WMjNmd9TZc4,12170
293
- skypilot_nightly-1.0.0.dev20250120.dist-info/METADATA,sha256=2AbDblEGahxEI-YkKiQHlbINuXCxQw3Z6-viIqLTZNk,20884
294
- skypilot_nightly-1.0.0.dev20250120.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
295
- skypilot_nightly-1.0.0.dev20250120.dist-info/entry_points.txt,sha256=StA6HYpuHj-Y61L2Ze-hK2IcLWgLZcML5gJu8cs6nU4,36
296
- skypilot_nightly-1.0.0.dev20250120.dist-info/top_level.txt,sha256=qA8QuiNNb6Y1OF-pCUtPEr6sLEwy2xJX06Bd_CrtrHY,4
297
- skypilot_nightly-1.0.0.dev20250120.dist-info/RECORD,,
292
+ skypilot_nightly-1.0.0.dev20250121.dist-info/LICENSE,sha256=emRJAvE7ngL6x0RhQvlns5wJzGI3NEQ_WMjNmd9TZc4,12170
293
+ skypilot_nightly-1.0.0.dev20250121.dist-info/METADATA,sha256=eKys98YFcqS-e6iypfeNiYC3e8v7QcUlU72TdwGpqXA,20884
294
+ skypilot_nightly-1.0.0.dev20250121.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
295
+ skypilot_nightly-1.0.0.dev20250121.dist-info/entry_points.txt,sha256=StA6HYpuHj-Y61L2Ze-hK2IcLWgLZcML5gJu8cs6nU4,36
296
+ skypilot_nightly-1.0.0.dev20250121.dist-info/top_level.txt,sha256=qA8QuiNNb6Y1OF-pCUtPEr6sLEwy2xJX06Bd_CrtrHY,4
297
+ skypilot_nightly-1.0.0.dev20250121.dist-info/RECORD,,