skypilot-nightly 1.0.0.dev20250718__py3-none-any.whl → 1.0.0.dev20250723__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.
Potentially problematic release.
This version of skypilot-nightly might be problematic. Click here for more details.
- sky/__init__.py +4 -2
- sky/admin_policy.py +11 -4
- sky/backends/backend_utils.py +50 -24
- sky/backends/cloud_vm_ray_backend.py +41 -38
- sky/catalog/__init__.py +3 -1
- sky/catalog/aws_catalog.py +8 -5
- sky/catalog/azure_catalog.py +8 -5
- sky/catalog/common.py +8 -2
- sky/catalog/cudo_catalog.py +5 -2
- sky/catalog/do_catalog.py +4 -1
- sky/catalog/fluidstack_catalog.py +5 -2
- sky/catalog/gcp_catalog.py +8 -5
- sky/catalog/hyperbolic_catalog.py +5 -2
- sky/catalog/ibm_catalog.py +8 -5
- sky/catalog/lambda_catalog.py +8 -5
- sky/catalog/nebius_catalog.py +8 -5
- sky/catalog/oci_catalog.py +8 -5
- sky/catalog/paperspace_catalog.py +4 -1
- sky/catalog/runpod_catalog.py +5 -2
- sky/catalog/scp_catalog.py +8 -5
- sky/catalog/vast_catalog.py +5 -2
- sky/catalog/vsphere_catalog.py +4 -1
- sky/client/cli/command.py +63 -25
- sky/client/sdk.py +61 -11
- sky/clouds/aws.py +12 -7
- sky/clouds/azure.py +12 -7
- sky/clouds/cloud.py +9 -8
- sky/clouds/cudo.py +13 -7
- sky/clouds/do.py +12 -7
- sky/clouds/fluidstack.py +11 -6
- sky/clouds/gcp.py +12 -7
- sky/clouds/hyperbolic.py +11 -6
- sky/clouds/ibm.py +11 -6
- sky/clouds/kubernetes.py +7 -3
- sky/clouds/lambda_cloud.py +11 -6
- sky/clouds/nebius.py +14 -12
- sky/clouds/oci.py +12 -7
- sky/clouds/paperspace.py +12 -7
- sky/clouds/runpod.py +12 -7
- sky/clouds/scp.py +11 -6
- sky/clouds/vast.py +14 -8
- sky/clouds/vsphere.py +11 -6
- sky/core.py +6 -1
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/chunks/{1043-734e57d2b27dfe5d.js → 1043-869d9c78bf5dd3df.js} +1 -1
- sky/dashboard/out/_next/static/chunks/{1141-d8c6404a7c6fffe6.js → 1141-e49a159c30a6c4a7.js} +1 -1
- sky/dashboard/out/_next/static/chunks/1559-18717d96ef2fcbe9.js +30 -0
- sky/dashboard/out/_next/static/chunks/1871-ea0e7283886407ca.js +6 -0
- sky/dashboard/out/_next/static/chunks/2003.b82e6db40ec4c463.js +1 -0
- sky/dashboard/out/_next/static/chunks/2350.23778a2b19aabd33.js +1 -0
- sky/dashboard/out/_next/static/chunks/2369.2d6e4757f8dfc2b7.js +15 -0
- sky/dashboard/out/_next/static/chunks/{2641.35edc9ccaeaad9e3.js → 2641.74c19c4d45a2c034.js} +1 -1
- sky/dashboard/out/_next/static/chunks/3785.59705416215ff08b.js +1 -0
- sky/dashboard/out/_next/static/chunks/{4725.4c849b1e05c8e9ad.js → 4725.66125dcd9832aa5d.js} +1 -1
- sky/dashboard/out/_next/static/chunks/4869.da729a7db3a31f43.js +16 -0
- sky/dashboard/out/_next/static/chunks/4937.d75809403fc264ac.js +15 -0
- sky/dashboard/out/_next/static/chunks/6135-2abbd0352f8ee061.js +1 -0
- sky/dashboard/out/_next/static/chunks/691.488b4aef97c28727.js +55 -0
- sky/dashboard/out/_next/static/chunks/6990-f64e03df359e04f7.js +1 -0
- sky/dashboard/out/_next/static/chunks/7411-2cc31dc0fdf2a9ad.js +41 -0
- sky/dashboard/out/_next/static/chunks/9025.4a9099bdf3ed4875.js +6 -0
- sky/dashboard/out/_next/static/chunks/938-7ee806653aef0609.js +1 -0
- sky/dashboard/out/_next/static/chunks/9847.387abf8a14d722db.js +30 -0
- sky/dashboard/out/_next/static/chunks/{9984.2b5e3fa69171bff9.js → 9984.0460de9d3adf5582.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/_app-da491665d4289aae.js +34 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/{[job]-fa406155b4223d0d.js → [job]-2186770cc2de1623.js} +2 -2
- sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-0c37ee1ac5f3474d.js → [cluster]-95afb019ab85801c.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters-3d4be4961e1c94eb.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/index-89e7daf7b7df02e0.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-a90b4fe4616dc501.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra-0d3d1f890c5d188a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/{[job]-c5b357bfd9502fbe.js → [job]-dc0299ffefebcdbe.js} +2 -2
- sky/dashboard/out/_next/static/chunks/pages/jobs-49f790d12a85027c.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/{users-19e98664bdd61643.js → users-6790fcefd5487b13.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-6bcd4b20914d76c9.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces-5f7fe4b7d55b8612.js +1 -0
- sky/dashboard/out/_next/static/chunks/webpack-a305898dc479711e.js +1 -0
- sky/dashboard/out/_next/static/css/b3227360726f12eb.css +3 -0
- sky/dashboard/out/_next/static/mym3Ciwp-zqU7ZpOLGnrW/_buildManifest.js +1 -0
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/volumes.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/data/mounting_utils.py +93 -32
- sky/global_user_state.py +12 -143
- sky/jobs/state.py +9 -88
- sky/jobs/utils.py +28 -13
- sky/provision/nebius/utils.py +3 -6
- sky/schemas/db/README +4 -0
- sky/schemas/db/env.py +90 -0
- sky/schemas/db/global_user_state/001_initial_schema.py +124 -0
- sky/schemas/db/script.py.mako +28 -0
- sky/schemas/db/spot_jobs/001_initial_schema.py +97 -0
- sky/serve/client/sdk.py +6 -2
- sky/serve/controller.py +7 -3
- sky/serve/serve_state.py +1 -1
- sky/serve/serve_utils.py +171 -75
- sky/serve/server/core.py +17 -6
- sky/server/common.py +4 -3
- sky/server/requests/payloads.py +2 -0
- sky/server/requests/requests.py +1 -1
- sky/setup_files/MANIFEST.in +2 -0
- sky/setup_files/alembic.ini +148 -0
- sky/setup_files/dependencies.py +1 -0
- sky/skylet/configs.py +1 -1
- sky/skylet/constants.py +4 -0
- sky/skylet/job_lib.py +1 -1
- sky/skypilot_config.py +1 -1
- sky/users/permission.py +1 -1
- sky/utils/common_utils.py +85 -3
- sky/utils/config_utils.py +15 -0
- sky/utils/db/__init__.py +0 -0
- sky/utils/{db_utils.py → db/db_utils.py} +59 -0
- sky/utils/db/migration_utils.py +93 -0
- sky/utils/locks.py +319 -0
- sky/utils/schemas.py +38 -34
- sky/utils/timeline.py +41 -0
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/METADATA +2 -1
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/RECORD +134 -125
- sky/dashboard/out/_next/static/FUjweqdImyeYhMYFON-Se/_buildManifest.js +0 -1
- sky/dashboard/out/_next/static/chunks/1746.27d40aedc22bd2d6.js +0 -60
- sky/dashboard/out/_next/static/chunks/1871-76491ac174a95278.js +0 -6
- sky/dashboard/out/_next/static/chunks/2544.27f70672535675ed.js +0 -1
- sky/dashboard/out/_next/static/chunks/2875.c24c6d57dc82e436.js +0 -25
- sky/dashboard/out/_next/static/chunks/3785.95b94f18aaec7233.js +0 -1
- sky/dashboard/out/_next/static/chunks/3947-b059261d6fa88a1f.js +0 -35
- sky/dashboard/out/_next/static/chunks/430.ed51037d1a4a438b.js +0 -1
- sky/dashboard/out/_next/static/chunks/4869.bdd42f14b51d1d6f.js +0 -16
- sky/dashboard/out/_next/static/chunks/5491.918ffed0ba7a5294.js +0 -20
- sky/dashboard/out/_next/static/chunks/6990-dcb411b566e64cde.js +0 -1
- sky/dashboard/out/_next/static/chunks/804-9f5e98ce84d46bdd.js +0 -21
- sky/dashboard/out/_next/static/chunks/9025.133e9ba5c780afeb.js +0 -6
- sky/dashboard/out/_next/static/chunks/938-6a9ffdaa21eee969.js +0 -1
- sky/dashboard/out/_next/static/chunks/9470-b6f6a35283863a6f.js +0 -1
- sky/dashboard/out/_next/static/chunks/9847.46e613d000c55859.js +0 -30
- sky/dashboard/out/_next/static/chunks/pages/_app-771a40cde532309b.js +0 -20
- sky/dashboard/out/_next/static/chunks/pages/clusters-102d169e87913ba1.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/index-927ddeebe57a8ac3.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-8b0809f59034d509.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra-ae9d2f705ce582c9.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs-5bbdc71878f0a068.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-7c0187f43757a548.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-a1e43d9ef51a9cea.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-6b0575ea521af4f3.js +0 -1
- sky/dashboard/out/_next/static/css/219887b94512388c.css +0 -3
- /sky/dashboard/out/_next/static/{FUjweqdImyeYhMYFON-Se → mym3Ciwp-zqU7ZpOLGnrW}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250718.dist-info → skypilot_nightly-1.0.0.dev20250723.dist-info}/top_level.txt +0 -0
sky/schemas/db/env.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Alembic environment configuration for state database migrations."""
|
|
2
|
+
from logging.config import fileConfig
|
|
3
|
+
|
|
4
|
+
from alembic import context
|
|
5
|
+
from sqlalchemy import engine_from_config
|
|
6
|
+
from sqlalchemy import pool
|
|
7
|
+
|
|
8
|
+
# this is the Alembic Config object, which provides
|
|
9
|
+
# access to the values within the .ini file in use.
|
|
10
|
+
config = context.config
|
|
11
|
+
|
|
12
|
+
# NOTE: We intentionally disable Alembic's logging configuration to prevent
|
|
13
|
+
# it from overriding SkyPilot's logging setup. Alembic's fileConfig() call
|
|
14
|
+
# globally reconfigures Python's logging system, which can suppress SkyPilot's
|
|
15
|
+
# output messages that tests expect to see.
|
|
16
|
+
#
|
|
17
|
+
# Original code (now disabled):
|
|
18
|
+
if config.config_file_name is not None:
|
|
19
|
+
fileConfig(config.config_file_name, disable_existing_loggers=False)
|
|
20
|
+
|
|
21
|
+
# add your model's MetaData object here
|
|
22
|
+
# for 'autogenerate' support
|
|
23
|
+
# from myapp import mymodel
|
|
24
|
+
# target_metadata = mymodel.Base.metadata
|
|
25
|
+
target_metadata = None
|
|
26
|
+
|
|
27
|
+
# other values from the config, defined by the needs of env.py,
|
|
28
|
+
# can be acquired:
|
|
29
|
+
# my_important_option = config.get_main_option("my_important_option")
|
|
30
|
+
# ... etc.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def run_migrations_offline() -> None:
|
|
34
|
+
"""Run migrations in 'offline' mode.
|
|
35
|
+
|
|
36
|
+
This configures the context with just a URL
|
|
37
|
+
and not an Engine, though an Engine is acceptable
|
|
38
|
+
here as well. By skipping the Engine creation
|
|
39
|
+
we don't even need a DBAPI to be available.
|
|
40
|
+
|
|
41
|
+
Calls to context.execute() here emit the given string to the
|
|
42
|
+
script output.
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
url = config.get_main_option('sqlalchemy.url')
|
|
46
|
+
version_table = config.get_section_option(config.config_ini_section,
|
|
47
|
+
'version_table',
|
|
48
|
+
'alembic_version')
|
|
49
|
+
context.configure(
|
|
50
|
+
url=url,
|
|
51
|
+
target_metadata=target_metadata,
|
|
52
|
+
literal_binds=True,
|
|
53
|
+
dialect_opts={'paramstyle': 'named'},
|
|
54
|
+
version_table=version_table,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
with context.begin_transaction():
|
|
58
|
+
context.run_migrations()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def run_migrations_online() -> None:
|
|
62
|
+
"""Run migrations in 'online' mode.
|
|
63
|
+
|
|
64
|
+
In this scenario we need to create an Engine
|
|
65
|
+
and associate a connection with the context.
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
connectable = engine_from_config(
|
|
69
|
+
config.get_section(config.config_ini_section, {}),
|
|
70
|
+
prefix='sqlalchemy.',
|
|
71
|
+
poolclass=pool.NullPool,
|
|
72
|
+
)
|
|
73
|
+
version_table = config.get_section_option(config.config_ini_section,
|
|
74
|
+
'version_table',
|
|
75
|
+
'alembic_version')
|
|
76
|
+
with connectable.connect() as connection:
|
|
77
|
+
context.configure(
|
|
78
|
+
connection=connection,
|
|
79
|
+
target_metadata=target_metadata,
|
|
80
|
+
version_table=version_table,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
with context.begin_transaction():
|
|
84
|
+
context.run_migrations()
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if context.is_offline_mode():
|
|
88
|
+
run_migrations_offline()
|
|
89
|
+
else:
|
|
90
|
+
run_migrations_online()
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Initial schema for state database with backwards compatibility columns
|
|
2
|
+
|
|
3
|
+
Revision ID: 001
|
|
4
|
+
Revises:
|
|
5
|
+
Create Date: 2024-01-01 12:00:00.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
# pylint: disable=invalid-name
|
|
9
|
+
from alembic import op
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
|
|
12
|
+
from sky.global_user_state import Base
|
|
13
|
+
from sky.utils.db import db_utils
|
|
14
|
+
|
|
15
|
+
# revision identifiers, used by Alembic.
|
|
16
|
+
revision = '001'
|
|
17
|
+
down_revision = None
|
|
18
|
+
branch_labels = None
|
|
19
|
+
depends_on = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def upgrade():
|
|
23
|
+
with op.get_context().autocommit_block():
|
|
24
|
+
# Create any missing tables with current schema first
|
|
25
|
+
db_utils.add_tables_to_db_sqlalchemy(Base.metadata, op.get_bind())
|
|
26
|
+
|
|
27
|
+
# Add all missing columns to clusters table
|
|
28
|
+
# This allows each column addition to fail independently without rolling
|
|
29
|
+
# back the entire migration, which is needed for backwards compatibility
|
|
30
|
+
|
|
31
|
+
# Add all missing columns to clusters table
|
|
32
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
33
|
+
'autostop',
|
|
34
|
+
sa.Integer(),
|
|
35
|
+
server_default='-1')
|
|
36
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
37
|
+
'metadata',
|
|
38
|
+
sa.Text(),
|
|
39
|
+
server_default='{}')
|
|
40
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
41
|
+
'to_down',
|
|
42
|
+
sa.Integer(),
|
|
43
|
+
server_default='0')
|
|
44
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
45
|
+
'owner',
|
|
46
|
+
sa.Text(),
|
|
47
|
+
server_default=None)
|
|
48
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
49
|
+
'cluster_hash',
|
|
50
|
+
sa.Text(),
|
|
51
|
+
server_default=None)
|
|
52
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
53
|
+
'launched_nodes',
|
|
54
|
+
sa.Integer(),
|
|
55
|
+
server_default='0')
|
|
56
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
57
|
+
'disk_tier',
|
|
58
|
+
sa.Text(),
|
|
59
|
+
server_default=None)
|
|
60
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
61
|
+
'config_hash',
|
|
62
|
+
sa.Text(),
|
|
63
|
+
server_default=None)
|
|
64
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
65
|
+
'user_hash',
|
|
66
|
+
sa.Text(),
|
|
67
|
+
server_default=None)
|
|
68
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
69
|
+
'workspace',
|
|
70
|
+
sa.Text(),
|
|
71
|
+
server_default='default')
|
|
72
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
73
|
+
'last_creation_yaml',
|
|
74
|
+
sa.Text(),
|
|
75
|
+
server_default=None)
|
|
76
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
77
|
+
'last_creation_command',
|
|
78
|
+
sa.Text(),
|
|
79
|
+
server_default=None)
|
|
80
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
81
|
+
'config_hash_locked',
|
|
82
|
+
sa.Boolean(),
|
|
83
|
+
server_default='FALSE')
|
|
84
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
85
|
+
'handle_locked',
|
|
86
|
+
sa.Boolean(),
|
|
87
|
+
server_default='FALSE')
|
|
88
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
89
|
+
'num_failures',
|
|
90
|
+
sa.Integer(),
|
|
91
|
+
server_default='0')
|
|
92
|
+
db_utils.add_column_to_table_alembic('clusters',
|
|
93
|
+
'configs',
|
|
94
|
+
sa.Text(),
|
|
95
|
+
server_default='[]')
|
|
96
|
+
|
|
97
|
+
# Add all missing columns to cluster_history table
|
|
98
|
+
db_utils.add_column_to_table_alembic('cluster_history',
|
|
99
|
+
'user_hash',
|
|
100
|
+
sa.Text(),
|
|
101
|
+
server_default=None)
|
|
102
|
+
db_utils.add_column_to_table_alembic('cluster_history',
|
|
103
|
+
'last_creation_yaml',
|
|
104
|
+
sa.Text(),
|
|
105
|
+
server_default=None)
|
|
106
|
+
db_utils.add_column_to_table_alembic('cluster_history',
|
|
107
|
+
'last_creation_command',
|
|
108
|
+
sa.Text(),
|
|
109
|
+
server_default=None)
|
|
110
|
+
|
|
111
|
+
# Add all missing columns to users table
|
|
112
|
+
db_utils.add_column_to_table_alembic('users',
|
|
113
|
+
'password',
|
|
114
|
+
sa.Text(),
|
|
115
|
+
server_default=None)
|
|
116
|
+
db_utils.add_column_to_table_alembic('users',
|
|
117
|
+
'created_at',
|
|
118
|
+
sa.Integer(),
|
|
119
|
+
server_default=None)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def downgrade():
|
|
123
|
+
# Drop all tables
|
|
124
|
+
Base.metadata.drop_all(bind=op.get_bind())
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""${message}
|
|
2
|
+
|
|
3
|
+
Revision ID: ${up_revision}
|
|
4
|
+
Revises: ${down_revision | comma,n}
|
|
5
|
+
Create Date: ${create_date}
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
${imports if imports else ""}
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = ${repr(up_revision)}
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
${upgrades if upgrades else "pass"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def downgrade() -> None:
|
|
27
|
+
"""Downgrade schema."""
|
|
28
|
+
${downgrades if downgrades else "pass"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Initial schema for spot jobs database with backwards compatibility columns
|
|
2
|
+
|
|
3
|
+
Revision ID: 001
|
|
4
|
+
Revises:
|
|
5
|
+
Create Date: 2024-01-01 12:00:00.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
# pylint: disable=invalid-name
|
|
9
|
+
import json
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
import sqlalchemy as sa
|
|
13
|
+
|
|
14
|
+
from sky.jobs.state import Base
|
|
15
|
+
from sky.skylet import constants
|
|
16
|
+
from sky.utils.db import db_utils
|
|
17
|
+
|
|
18
|
+
# revision identifiers, used by Alembic.
|
|
19
|
+
revision = '001'
|
|
20
|
+
down_revision = None
|
|
21
|
+
branch_labels = None
|
|
22
|
+
depends_on = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def upgrade():
|
|
26
|
+
"""Create initial schema and add all backwards compatibility columns"""
|
|
27
|
+
with op.get_context().autocommit_block():
|
|
28
|
+
# Create all tables with their current schema
|
|
29
|
+
db_utils.add_tables_to_db_sqlalchemy(Base.metadata, op.get_bind())
|
|
30
|
+
|
|
31
|
+
# Add backwards compatibility columns using helper function that matches
|
|
32
|
+
# original add_column_to_table_sqlalchemy behavior exactly
|
|
33
|
+
|
|
34
|
+
# Spot table columns
|
|
35
|
+
db_utils.add_column_to_table_alembic('spot', 'failure_reason',
|
|
36
|
+
sa.Text())
|
|
37
|
+
db_utils.add_column_to_table_alembic('spot',
|
|
38
|
+
'spot_job_id',
|
|
39
|
+
sa.Integer(),
|
|
40
|
+
copy_from='job_id')
|
|
41
|
+
db_utils.add_column_to_table_alembic(
|
|
42
|
+
'spot',
|
|
43
|
+
'task_id',
|
|
44
|
+
sa.Integer(),
|
|
45
|
+
server_default='0',
|
|
46
|
+
value_to_replace_existing_entries=0)
|
|
47
|
+
db_utils.add_column_to_table_alembic('spot',
|
|
48
|
+
'task_name',
|
|
49
|
+
sa.Text(),
|
|
50
|
+
copy_from='job_name')
|
|
51
|
+
db_utils.add_column_to_table_alembic(
|
|
52
|
+
'spot',
|
|
53
|
+
'specs',
|
|
54
|
+
sa.Text(),
|
|
55
|
+
value_to_replace_existing_entries=json.dumps(
|
|
56
|
+
{'max_restarts_on_errors': 0}))
|
|
57
|
+
db_utils.add_column_to_table_alembic('spot', 'local_log_file',
|
|
58
|
+
sa.Text())
|
|
59
|
+
db_utils.add_column_to_table_alembic(
|
|
60
|
+
'spot',
|
|
61
|
+
'metadata',
|
|
62
|
+
sa.Text(),
|
|
63
|
+
server_default='{}',
|
|
64
|
+
value_to_replace_existing_entries='{}')
|
|
65
|
+
|
|
66
|
+
# Job info table columns
|
|
67
|
+
db_utils.add_column_to_table_alembic('job_info', 'schedule_state',
|
|
68
|
+
sa.Text())
|
|
69
|
+
db_utils.add_column_to_table_alembic('job_info', 'controller_pid',
|
|
70
|
+
sa.Integer())
|
|
71
|
+
db_utils.add_column_to_table_alembic('job_info', 'dag_yaml_path',
|
|
72
|
+
sa.Text())
|
|
73
|
+
db_utils.add_column_to_table_alembic('job_info', 'env_file_path',
|
|
74
|
+
sa.Text())
|
|
75
|
+
db_utils.add_column_to_table_alembic('job_info', 'user_hash', sa.Text())
|
|
76
|
+
db_utils.add_column_to_table_alembic(
|
|
77
|
+
'job_info',
|
|
78
|
+
'workspace',
|
|
79
|
+
sa.Text(),
|
|
80
|
+
value_to_replace_existing_entries=constants.
|
|
81
|
+
SKYPILOT_DEFAULT_WORKSPACE)
|
|
82
|
+
db_utils.add_column_to_table_alembic(
|
|
83
|
+
'job_info',
|
|
84
|
+
'priority',
|
|
85
|
+
sa.Integer(),
|
|
86
|
+
server_default=str(constants.DEFAULT_PRIORITY),
|
|
87
|
+
value_to_replace_existing_entries=constants.DEFAULT_PRIORITY)
|
|
88
|
+
db_utils.add_column_to_table_alembic('job_info', 'entrypoint',
|
|
89
|
+
sa.Text())
|
|
90
|
+
db_utils.add_column_to_table_alembic('job_info',
|
|
91
|
+
'original_user_yaml_path',
|
|
92
|
+
sa.Text())
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def downgrade():
|
|
96
|
+
"""Drop all tables"""
|
|
97
|
+
Base.metadata.drop_all(bind=op.get_bind())
|
sky/serve/client/sdk.py
CHANGED
|
@@ -297,7 +297,8 @@ def tail_logs(service_name: str,
|
|
|
297
297
|
target: Union[str, 'serve_utils.ServiceComponent'],
|
|
298
298
|
replica_id: Optional[int] = None,
|
|
299
299
|
follow: bool = True,
|
|
300
|
-
output_stream: Optional['io.TextIOBase'] = None
|
|
300
|
+
output_stream: Optional['io.TextIOBase'] = None,
|
|
301
|
+
tail: Optional[int] = None) -> None:
|
|
301
302
|
"""Tails logs for a service.
|
|
302
303
|
|
|
303
304
|
Usage:
|
|
@@ -367,6 +368,7 @@ def tail_logs(service_name: str,
|
|
|
367
368
|
target=target,
|
|
368
369
|
replica_id=replica_id,
|
|
369
370
|
follow=follow,
|
|
371
|
+
tail=tail,
|
|
370
372
|
)
|
|
371
373
|
response = server_common.make_authenticated_request(
|
|
372
374
|
'POST',
|
|
@@ -390,7 +392,8 @@ def sync_down_logs(service_name: str,
|
|
|
390
392
|
str, 'serve_utils.ServiceComponent',
|
|
391
393
|
List[Union[str,
|
|
392
394
|
'serve_utils.ServiceComponent']]]] = None,
|
|
393
|
-
replica_ids: Optional[List[int]] = None
|
|
395
|
+
replica_ids: Optional[List[int]] = None,
|
|
396
|
+
tail: Optional[int] = None) -> None:
|
|
394
397
|
"""Sync down logs from the service components to a local directory.
|
|
395
398
|
|
|
396
399
|
This function syncs logs from the specified service components (controller,
|
|
@@ -429,6 +432,7 @@ def sync_down_logs(service_name: str,
|
|
|
429
432
|
local_dir=local_dir,
|
|
430
433
|
targets=targets,
|
|
431
434
|
replica_ids=replica_ids,
|
|
435
|
+
tail=tail,
|
|
432
436
|
)
|
|
433
437
|
response = server_common.make_authenticated_request(
|
|
434
438
|
'POST',
|
sky/serve/controller.py
CHANGED
|
@@ -156,9 +156,13 @@ class SkyServeController:
|
|
|
156
156
|
return responses.JSONResponse(content={'message': 'Success'},
|
|
157
157
|
status_code=200)
|
|
158
158
|
except Exception as e: # pylint: disable=broad-except
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return responses.JSONResponse(content={
|
|
159
|
+
exception_str = common_utils.format_exception(e)
|
|
160
|
+
logger.error(f'Error in update_service: {exception_str}')
|
|
161
|
+
return responses.JSONResponse(content={
|
|
162
|
+
'message': 'Error',
|
|
163
|
+
'exception': exception_str,
|
|
164
|
+
'traceback': traceback.format_exc()
|
|
165
|
+
},
|
|
162
166
|
status_code=500)
|
|
163
167
|
|
|
164
168
|
@self._app.post('/controller/terminate_replica')
|
sky/serve/serve_state.py
CHANGED