Skip to content

Commit 2b2a31c

Browse files
authored
Merge pull request #4489 from codalab/rc1.7.0
Bump version to 1.7.0
2 parents 5be8cb3 + 23c2d3a commit 2b2a31c

8 files changed

Lines changed: 50 additions & 25 deletions

File tree

codalab/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Increment this on master when ready to cut a release.
3131
# http://semver.org/
32-
CODALAB_VERSION = '1.6.3'
32+
CODALAB_VERSION = '1.7.0'
3333
BINARY_PLACEHOLDER = '<binary>'
3434
URLOPEN_TIMEOUT_SECONDS = int(os.environ.get('CODALAB_URLOPEN_TIMEOUT_SECONDS', 5 * 60))
3535

codalab/migration.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def upload_to_azure_blob(self, bundle_uuid, bundle_location, is_dir=False):
106106
file_name = "contents.tar.gz" if is_dir else "contents.gz"
107107
target_location = f"{self.target_store_url}/{bundle_uuid}/{file_name}"
108108

109+
# TODO: This step might cause repeated upload. Can not check by checking size (Azure blob storage is zipped).
109110
if FileSystems.exists(target_location):
110111
path_util.remove(target_location)
111112

@@ -202,33 +203,35 @@ def delete_original_bundle(self, bundle_uuid, bundle_location):
202203
description='Manages your local CodaLab Worksheets service deployment'
203204
)
204205
parser.add_argument(
205-
'-w', '--worksheet', type=str, help='The worksheet uuid that needs migration'
206+
'-a', '--all', help='Run migration on all worksheets and all bundles', action='store_true',
206207
)
207-
parser.add_argument('--target_store_name', type=str, help='The destination bundle store name')
208208
parser.add_argument(
209-
'-d',
210-
'--dry-run',
211-
help='Only upload the bundle to Azure, does not modify database',
212-
action='store_true',
209+
'-w', '--worksheet', type=str, help='The worksheet uuid that needs migration'
213210
)
211+
parser.add_argument('--target_store_name', type=str, help='The destination bundle store name')
214212
parser.add_argument(
215-
'-k', '--keep', help='Keep bundle content in origin bundle store', action='store_true'
213+
'-c', '--change_db', help='Change the bundle location in the database', action='store_true',
216214
)
215+
parser.add_argument('-d', '--delete', help='Delete the original database', action='store_true')
217216

218217
args = parser.parse_args()
219218

220219
worksheet_uuid = args.worksheet
221220
target_store_name = (
222221
"azure-store-default" if args.target_store_name is None else args.target_store_name
223222
)
224-
if worksheet_uuid is not None and not spec_util.UUID_REGEX.match(worksheet_uuid):
225-
raise Exception("Input worksheet uuid has wrong format. ")
226223

227224
# TODO: write output to log / log files
228225
migration = Migration(target_store_name)
229226
migration.setUp()
230227

231-
bundle_uuids = migration.get_bundle_uuids(worksheet_uuid)
228+
if args.all:
229+
bundle_uuids = migration.get_bundle_uuids(worksheet_uuid=None)
230+
else:
231+
# Must specify worksheet uuid
232+
if worksheet_uuid is not None and not spec_util.UUID_REGEX.match(worksheet_uuid):
233+
raise Exception("Input worksheet uuid has wrong format. ")
234+
bundle_uuids = migration.get_bundle_uuids(worksheet_uuid)
232235

233236
for bundle_uuid in bundle_uuids:
234237
logging.info(bundle_uuid)
@@ -256,8 +259,8 @@ def delete_original_bundle(self, bundle_uuid, bundle_location):
256259
is_dir = bundle_info['type'] == 'directory'
257260
migration.upload_to_azure_blob(bundle_uuid, bundle_location, is_dir)
258261

259-
if not args.dry_run: # If dry_run, only upload to new bundle location
262+
if args.change_db: # If need to change the database, continue to run
260263
migration.modify_bundle_data(bundle, bundle_uuid, is_dir)
261264
migration.sanity_check(bundle_uuid, bundle_location, bundle_info, is_dir)
262-
if not args.keep:
265+
if args.delete:
263266
migration.delete_original_bundle(bundle_uuid, bundle_location)

codalab/worker/docker_utils.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def get_nvidia_devices(self, use_docker=True):
152152
docker.errors.ImageNotFound if the CUDA image cannot be pulled
153153
docker.errors.APIError if another server error occurs
154154
"""
155-
cuda_image = 'nvidia/cuda:12.2.0-devel-ubuntu22.04'
155+
cuda_image = 'sulfurheron/nvidia-cuda:9.0-cudnn7-devel-ubuntu16.04-2018-06-08'
156156
nvidia_command = 'nvidia-smi --query-gpu=index,uuid --format=csv,noheader'
157157
if use_docker:
158158
self.client.images.pull(cuda_image)
@@ -164,20 +164,27 @@ def get_nvidia_devices(self, use_docker=True):
164164
stdout=True,
165165
remove=True,
166166
)
167-
gpus = output.decode()
167+
gpu_info = output.decode()
168+
GPU_REGEX = r"(\d+), ((?:GPU-)[a-fA-F0-9-]+)"
169+
gpus = {}
170+
for line in gpu_info.splitlines():
171+
match = re.match(GPU_REGEX, line)
172+
if match:
173+
idx = match.group(1)
174+
uuid = match.group(2)
175+
gpus[idx] = uuid
176+
168177
else:
169178
# use the singularity runtime to run nvidia-smi
170179
# img = Client.pull('docker://' + cuda_image, pull_folder='/tmp')
171180
# output = Client.execute(img, nvidia_command, options=['--nv'])
172181
# if output['return_code'] != 0:
173182
# raise SingularityError
174183
# gpus = output['message']
175-
gpus = ""
184+
gpus = {}
176185
# Get newline delimited gpu-index, gpu-uuid list
177-
logger.info("GPUs: " + str(gpus.split('\n')[:-1]))
178-
return {
179-
gpu.split(',')[0].strip(): gpu.split(',')[1].strip() for gpu in gpus.split('\n')[:-1]
180-
}
186+
logger.info("GPUs: " + str(gpus))
187+
return gpus
181188

182189
@wrap_exception('Unable to fetch Docker container ip')
183190
def get_container_ip(self, network_name: str, container_id: str):

codalab/worker/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,11 @@ def main():
326326
# Create temp file to store kubernetes cert, as we need to pass in a file path.
327327
# TODO: Delete the file afterwards (upon CodaLab service stop?)
328328
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
329-
f.write(args.kubernetes_cert)
329+
f.write(
330+
args.kubernetes_cert.replace(r'\n', '\n')
331+
) # Properly add newlines, which appear as "\n" if specified in the environment variable.
330332
kubernetes_cert_path = f.name
333+
logger.info('Temporarily writing kubernetes cert to: %s', kubernetes_cert_path)
331334
else:
332335
kubernetes_cert_path = args.kubernetes_cert_path
333336
bundle_runtime_class = KubernetesRuntime(

codalab/worker_manager/kubernetes_worker_manager.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from argparse import ArgumentParser
1414
from typing import Any, Dict, List, Optional
1515
from codalab.common import BundleRuntime
16+
import tempfile
1617

1718
from urllib3.exceptions import MaxRetryError, NewConnectionError # type: ignore
1819

@@ -89,7 +90,18 @@ def __init__(self, args):
8990
configuration.api_key_prefix['authorization'] = 'Bearer'
9091
configuration.api_key['authorization'] = args.auth_token
9192
configuration.host = args.cluster_host
92-
configuration.ssl_ca_cert = args.cert_path
93+
if args.cert_path == "/dev/null" and args.cert != "/dev/null":
94+
# Create temp file to store kubernetes cert, as we need to pass in a file path.
95+
# TODO: Delete the file afterwards (upon CodaLab service stop?)
96+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
97+
f.write(
98+
args.cert.replace(r'\n', '\n')
99+
) # Properly add newlines, which appear as "\n" if specified in the environment variable.
100+
cert_path = f.name
101+
logger.info('Temporarily writing kubernetes cert to: %s', cert_path)
102+
else:
103+
cert_path = args.cert_path
104+
configuration.ssl_ca_cert = cert_path
93105
if configuration.host == "https://codalab-control-plane:6443":
94106
# Don't verify SSL if we are connecting to a local cluster for testing / development.
95107
configuration.verify_ssl = False

docs/REST-API-Reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REST API Reference
22

3-
_version 1.6.3_
3+
_version 1.7.0_
44

55
This reference and the REST API itself is still under heavy development and is
66
subject to change at any time. Feedback through our GitHub issues is appreciated!

frontend/src/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Should match codalab/common.py#CODALAB_VERSION
2-
export const CODALAB_VERSION = '1.6.3';
2+
export const CODALAB_VERSION = '1.7.0';
33

44
// Name Regex to match the backend in spec_utils.py
55
export const NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_.-]*$/i;

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
# should match codalab/common.py#CODALAB_VERSION
10-
CODALAB_VERSION = "1.6.3"
10+
CODALAB_VERSION = "1.7.0"
1111

1212

1313
class Install(install):

0 commit comments

Comments
 (0)