skypilot-nightly 1.0.0.dev20241109__py3-none-any.whl → 1.0.0.dev20241110__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 +2 -2
- sky/backends/cloud_vm_ray_backend.py +0 -19
- sky/clouds/oci.py +11 -21
- sky/clouds/service_catalog/oci_catalog.py +1 -1
- sky/clouds/utils/oci_utils.py +16 -2
- sky/dag.py +19 -15
- sky/provision/__init__.py +1 -0
- sky/provision/oci/__init__.py +15 -0
- sky/provision/oci/config.py +51 -0
- sky/provision/oci/instance.py +430 -0
- sky/{skylet/providers/oci/query_helper.py → provision/oci/query_utils.py} +148 -59
- sky/setup_files/MANIFEST.in +0 -1
- sky/skylet/job_lib.py +29 -17
- sky/templates/oci-ray.yml.j2 +3 -53
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/METADATA +1 -1
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/RECORD +20 -20
- sky/skylet/providers/oci/__init__.py +0 -2
- sky/skylet/providers/oci/node_provider.py +0 -488
- sky/skylet/providers/oci/utils.py +0 -21
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20241109.dist-info → skypilot_nightly-1.0.0.dev20241110.dist-info}/top_level.txt +0 -0
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 = '
|
8
|
+
_SKYPILOT_COMMIT_SHA = 'dddd65187953a5d6b32f762bea78eed1f109ec3c'
|
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.
|
38
|
+
__version__ = '1.0.0.dev20241110'
|
39
39
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
40
40
|
|
41
41
|
|
@@ -3979,25 +3979,6 @@ class CloudVmRayBackend(backends.Backend['CloudVmRayResourceHandle']):
|
|
3979
3979
|
stdout = ''
|
3980
3980
|
stderr = str(e)
|
3981
3981
|
|
3982
|
-
# Apr, 2023 by Hysun(hysun.he@oracle.com): Added support for OCI
|
3983
|
-
# May, 2023 by Hysun: Allow terminate INIT cluster which may have
|
3984
|
-
# some instances provisioning in background but not completed.
|
3985
|
-
elif (isinstance(cloud, clouds.OCI) and terminate and
|
3986
|
-
prev_cluster_status in (status_lib.ClusterStatus.STOPPED,
|
3987
|
-
status_lib.ClusterStatus.INIT)):
|
3988
|
-
region = config['provider']['region']
|
3989
|
-
|
3990
|
-
# pylint: disable=import-outside-toplevel
|
3991
|
-
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME
|
3992
|
-
|
3993
|
-
from sky.skylet.providers.oci.query_helper import oci_query_helper
|
3994
|
-
|
3995
|
-
# 0: All terminated successfully, failed count otherwise
|
3996
|
-
returncode = oci_query_helper.terminate_instances_by_tags(
|
3997
|
-
{TAG_RAY_CLUSTER_NAME: cluster_name_on_cloud}, region)
|
3998
|
-
|
3999
|
-
# To avoid undefined local variables error.
|
4000
|
-
stdout = stderr = ''
|
4001
3982
|
else:
|
4002
3983
|
config['provider']['cache_stopped_nodes'] = not terminate
|
4003
3984
|
with tempfile.NamedTemporaryFile('w',
|
sky/clouds/oci.py
CHANGED
@@ -31,6 +31,7 @@ from sky import status_lib
|
|
31
31
|
from sky.adaptors import oci as oci_adaptor
|
32
32
|
from sky.clouds import service_catalog
|
33
33
|
from sky.clouds.utils import oci_utils
|
34
|
+
from sky.provision.oci.query_utils import query_helper
|
34
35
|
from sky.utils import common_utils
|
35
36
|
from sky.utils import resources_utils
|
36
37
|
from sky.utils import ux_utils
|
@@ -60,6 +61,9 @@ class OCI(clouds.Cloud):
|
|
60
61
|
{resources_utils.DiskTier.ULTRA})
|
61
62
|
_BEST_DISK_TIER = resources_utils.DiskTier.HIGH
|
62
63
|
|
64
|
+
PROVISIONER_VERSION = clouds.ProvisionerVersion.SKYPILOT
|
65
|
+
STATUS_VERSION = clouds.StatusVersion.SKYPILOT
|
66
|
+
|
63
67
|
@classmethod
|
64
68
|
def _unsupported_features_for_resources(
|
65
69
|
cls, resources: 'resources_lib.Resources'
|
@@ -433,7 +437,7 @@ class OCI(clouds.Cloud):
|
|
433
437
|
return True, None
|
434
438
|
except (oci_adaptor.oci.exceptions.ConfigFileNotFound,
|
435
439
|
oci_adaptor.oci.exceptions.InvalidConfig,
|
436
|
-
oci_adaptor.
|
440
|
+
oci_adaptor.oci.exceptions.ServiceError) as e:
|
437
441
|
return False, (
|
438
442
|
f'OCI credential is not correctly set. '
|
439
443
|
f'Check the credential file at {conf_file}\n'
|
@@ -597,25 +601,11 @@ class OCI(clouds.Cloud):
|
|
597
601
|
region: Optional[str], zone: Optional[str],
|
598
602
|
**kwargs) -> List[status_lib.ClusterStatus]:
|
599
603
|
del zone, kwargs # Unused.
|
600
|
-
# Check the lifecycleState definition from the page
|
601
|
-
# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/latest/Instance/
|
602
|
-
status_map = {
|
603
|
-
'PROVISIONING': status_lib.ClusterStatus.INIT,
|
604
|
-
'STARTING': status_lib.ClusterStatus.INIT,
|
605
|
-
'RUNNING': status_lib.ClusterStatus.UP,
|
606
|
-
'STOPPING': status_lib.ClusterStatus.STOPPED,
|
607
|
-
'STOPPED': status_lib.ClusterStatus.STOPPED,
|
608
|
-
'TERMINATED': None,
|
609
|
-
'TERMINATING': None,
|
610
|
-
}
|
611
|
-
|
612
|
-
# pylint: disable=import-outside-toplevel
|
613
|
-
from sky.skylet.providers.oci.query_helper import oci_query_helper
|
614
604
|
|
615
605
|
status_list = []
|
616
606
|
try:
|
617
|
-
vms =
|
618
|
-
|
607
|
+
vms = query_helper.query_instances_by_tags(tag_filters=tag_filters,
|
608
|
+
region=region)
|
619
609
|
except Exception as e: # pylint: disable=broad-except
|
620
610
|
with ux_utils.print_exception_no_traceback():
|
621
611
|
raise exceptions.ClusterStatusFetchingError(
|
@@ -625,9 +615,9 @@ class OCI(clouds.Cloud):
|
|
625
615
|
|
626
616
|
for node in vms:
|
627
617
|
vm_status = node.lifecycle_state
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
618
|
+
sky_status = oci_utils.oci_config.STATE_MAPPING_OCI_TO_SKY.get(
|
619
|
+
vm_status, None)
|
620
|
+
if sky_status is not None:
|
621
|
+
status_list.append(sky_status)
|
632
622
|
|
633
623
|
return status_list
|
@@ -66,7 +66,7 @@ def _get_df() -> 'pd.DataFrame':
|
|
66
66
|
logger.debug(f'It is OK goes here when testing: {str(e)}')
|
67
67
|
subscribed_regions = []
|
68
68
|
|
69
|
-
except oci_adaptor.
|
69
|
+
except oci_adaptor.oci.exceptions.ServiceError as e:
|
70
70
|
# Should never expect going here. However, we still catch
|
71
71
|
# it so that if any OCI call failed, the program can still
|
72
72
|
# proceed with try-and-error way.
|
sky/clouds/utils/oci_utils.py
CHANGED
@@ -5,13 +5,14 @@ History:
|
|
5
5
|
- Hysun He (hysun.he@oracle.com) @ Oct, 2024: Add default image OS
|
6
6
|
configuration.
|
7
7
|
"""
|
8
|
-
import logging
|
9
8
|
import os
|
10
9
|
|
10
|
+
from sky import sky_logging
|
11
11
|
from sky import skypilot_config
|
12
|
+
from sky import status_lib
|
12
13
|
from sky.utils import resources_utils
|
13
14
|
|
14
|
-
logger =
|
15
|
+
logger = sky_logging.init_logger(__name__)
|
15
16
|
|
16
17
|
|
17
18
|
class OCIConfig:
|
@@ -77,6 +78,19 @@ class OCIConfig:
|
|
77
78
|
resources_utils.DiskTier.HIGH: DISK_TIER_HIGH,
|
78
79
|
}
|
79
80
|
|
81
|
+
# Oracle instance's lifecycle state to sky state mapping.
|
82
|
+
# For Oracle VM instance's lifecyle state, please refer to the link:
|
83
|
+
# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/latest/Instance/
|
84
|
+
STATE_MAPPING_OCI_TO_SKY = {
|
85
|
+
'PROVISIONING': status_lib.ClusterStatus.INIT,
|
86
|
+
'STARTING': status_lib.ClusterStatus.INIT,
|
87
|
+
'RUNNING': status_lib.ClusterStatus.UP,
|
88
|
+
'STOPPING': status_lib.ClusterStatus.STOPPED,
|
89
|
+
'STOPPED': status_lib.ClusterStatus.STOPPED,
|
90
|
+
'TERMINATED': None,
|
91
|
+
'TERMINATING': None,
|
92
|
+
}
|
93
|
+
|
80
94
|
@classmethod
|
81
95
|
def get_compartment(cls, region):
|
82
96
|
# Allow task(cluster)-specific compartment/VCN parameters.
|
sky/dag.py
CHANGED
@@ -56,21 +56,25 @@ class Dag:
|
|
56
56
|
return self.graph
|
57
57
|
|
58
58
|
def is_chain(self) -> bool:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
"""Check if the DAG is a linear chain of tasks."""
|
60
|
+
|
61
|
+
nodes = list(self.graph.nodes)
|
62
|
+
|
63
|
+
if len(nodes) == 0:
|
64
|
+
return True
|
65
|
+
|
66
|
+
in_degrees = [self.graph.in_degree(node) for node in nodes]
|
67
|
+
out_degrees = [self.graph.out_degree(node) for node in nodes]
|
68
|
+
|
69
|
+
# Check out-degrees: all <= 1 and exactly one node has out_degree == 0
|
70
|
+
out_degree_condition = (all(degree <= 1 for degree in out_degrees) and
|
71
|
+
sum(degree == 0 for degree in out_degrees) == 1)
|
72
|
+
|
73
|
+
# Check in-degrees: all <= 1 and exactly one node has in_degree == 0
|
74
|
+
in_degree_condition = (all(degree <= 1 for degree in in_degrees) and
|
75
|
+
sum(degree == 0 for degree in in_degrees) == 1)
|
76
|
+
|
77
|
+
return out_degree_condition and in_degree_condition
|
74
78
|
|
75
79
|
|
76
80
|
class _DagContext(threading.local):
|
sky/provision/__init__.py
CHANGED
@@ -20,6 +20,7 @@ from sky.provision import fluidstack
|
|
20
20
|
from sky.provision import gcp
|
21
21
|
from sky.provision import kubernetes
|
22
22
|
from sky.provision import lambda_cloud
|
23
|
+
from sky.provision import oci
|
23
24
|
from sky.provision import runpod
|
24
25
|
from sky.provision import vsphere
|
25
26
|
from sky.utils import command_runner
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"""OCI provisioner for SkyPilot.
|
2
|
+
|
3
|
+
History:
|
4
|
+
- Hysun He (hysun.he@oracle.com) @ Oct.16, 2024: Initial implementation
|
5
|
+
"""
|
6
|
+
|
7
|
+
from sky.provision.oci.config import bootstrap_instances
|
8
|
+
from sky.provision.oci.instance import cleanup_ports
|
9
|
+
from sky.provision.oci.instance import get_cluster_info
|
10
|
+
from sky.provision.oci.instance import open_ports
|
11
|
+
from sky.provision.oci.instance import query_instances
|
12
|
+
from sky.provision.oci.instance import run_instances
|
13
|
+
from sky.provision.oci.instance import stop_instances
|
14
|
+
from sky.provision.oci.instance import terminate_instances
|
15
|
+
from sky.provision.oci.instance import wait_instances
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"""OCI configuration bootstrapping.
|
2
|
+
|
3
|
+
Creates the resource group and deploys the configuration template to OCI for
|
4
|
+
a cluster to be launched.
|
5
|
+
|
6
|
+
History:
|
7
|
+
- Hysun He (hysun.he@oracle.com) @ Oct.16, 2024: Initial implementation
|
8
|
+
"""
|
9
|
+
|
10
|
+
from sky import exceptions
|
11
|
+
from sky import sky_logging
|
12
|
+
from sky.adaptors import oci as oci_adaptor
|
13
|
+
from sky.clouds.utils import oci_utils
|
14
|
+
from sky.provision import common
|
15
|
+
from sky.provision.oci.query_utils import query_helper
|
16
|
+
|
17
|
+
logger = sky_logging.init_logger(__name__)
|
18
|
+
|
19
|
+
|
20
|
+
@common.log_function_start_end
|
21
|
+
def bootstrap_instances(
|
22
|
+
region: str, cluster_name_on_cloud: str,
|
23
|
+
config: common.ProvisionConfig) -> common.ProvisionConfig:
|
24
|
+
"""See sky/provision/__init__.py"""
|
25
|
+
# OCI module import and oci client
|
26
|
+
oci_adaptor.get_core_client(region, oci_utils.oci_config.get_profile())
|
27
|
+
|
28
|
+
# Find / create a compartment for creating instances.
|
29
|
+
compartment = query_helper.find_compartment(region)
|
30
|
+
|
31
|
+
# Find the configured VCN, or create a new one.
|
32
|
+
vcn = query_helper.find_create_vcn_subnet(region)
|
33
|
+
if vcn is None:
|
34
|
+
# pylint: disable=line-too-long
|
35
|
+
raise exceptions.ResourcesUnavailableError(
|
36
|
+
'Failed to create a new VCN, possibly you hit the resource limitation.'
|
37
|
+
)
|
38
|
+
|
39
|
+
node_config = config.node_config
|
40
|
+
|
41
|
+
# Subscribe the image if it is from Marketplace listing.
|
42
|
+
query_helper.subscribe_image(
|
43
|
+
compartment_id=compartment,
|
44
|
+
listing_id=node_config['AppCatalogListingId'],
|
45
|
+
resource_version=node_config['ResourceVersion'],
|
46
|
+
region=region,
|
47
|
+
)
|
48
|
+
|
49
|
+
logger.info(f'Using cluster name: {cluster_name_on_cloud}')
|
50
|
+
|
51
|
+
return config
|