Skip to content

Commit 020c408

Browse files
committed
install sdv_enterprise with credentials
1 parent 8138f56 commit 020c408

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

sdgym/_benchmark/benchmark.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from google.oauth2 import service_account
88

99
from sdgym._benchmark.config_utils import resolve_compute_config, validate_compute_config
10-
from sdgym._benchmark.credentials_utils import get_credentials
10+
from sdgym._benchmark.credentials_utils import get_credentials, sdv_install_cmd
1111
from sdgym.benchmark import (
1212
DEFAULT_MULTI_TABLE_DATASETS,
1313
DEFAULT_MULTI_TABLE_SYNTHESIZERS,
@@ -158,6 +158,7 @@ def _get_user_data_script(
158158

159159
log_uri = _logs_s3_uri(output_destination, instance_name) if upload_logs else ''
160160

161+
sdv_install = sdv_install_cmd(credentials)
161162
terminate_fn = _terminate_instance(compute_service)
162163
upload_logs_fn = _upload_logs(log_uri)
163164
gpu_block = _gpu_wait_block() if gpu else ''
@@ -204,7 +205,8 @@ def _get_user_data_script(
204205
205206
log "======== Install Dependencies =========="
206207
pip install --upgrade pip
207-
pip install "{config['sdgym_install']}"
208+
{sdv_install}
209+
pip install "sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-515-_benchmark_multi_table_compute_gcp"
208210
209211
{gpu_block}
210212

sdgym/_benchmark/config_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
'gpu_type': None,
88
'gpu_count': 0,
99
'swap_gb': 32,
10-
'sdgym_install': (
11-
'sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-515-_benchmark_multi_table_compute_gcp'
12-
),
1310
'install_s3fs': True,
1411
'assert_gpu': True,
1512
'gpu_wait_seconds': 10 * 60,

sdgym/_benchmark/credentials_utils.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,36 @@ def get_credentials(credential_filepath):
3030
with open(credential_filepath, 'r') as cred_file:
3131
credentials = json.load(cred_file)
3232

33-
expected_sections = set(CREDENTIAL_KEYS.keys())
33+
required_sections = {'aws', 'gcp'}
34+
optional_sections = {'sdv'}
35+
valid_sections = required_sections | optional_sections
36+
3437
actual_sections = set(credentials.keys())
35-
if expected_sections != actual_sections:
38+
missing_required = required_sections - actual_sections
39+
unknown_sections = actual_sections - valid_sections
40+
if missing_required or unknown_sections:
3641
raise ValueError(
37-
f'The credentials file must contain the following sections: {expected_sections}. '
38-
f'Found: {actual_sections}.'
42+
f'Credentials file can only contain the following sections: {valid_sections}.'
3943
)
4044

41-
for section, expected_keys in CREDENTIAL_KEYS.items():
45+
for section in valid_sections:
46+
if section not in credentials:
47+
continue
48+
49+
expected_keys = CREDENTIAL_KEYS[section]
4250
actual_keys = set(credentials[section].keys())
4351
if expected_keys != actual_keys:
4452
raise ValueError(
4553
f'The "{section}" section must contain the following keys: {expected_keys}. '
4654
f'Found: {actual_keys}.'
4755
)
4856

57+
credentials.setdefault('sdv', {})
58+
4959
return credentials
5060

5161

52-
def bundle_install_cmd(credentials):
62+
def sdv_install_cmd(credentials):
5363
sdv_creds = credentials.get('sdv') or {}
5464
username = sdv_creds.get('username')
5565
license_key = sdv_creds.get('license_key')

tests/unit/_benchmark/test_config_utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ def test_resolve_compute_config_aws():
148148
'ami': 'ami-080e1f13689e07408',
149149
'volume_size_gb': 100,
150150
'swap_gb': 32,
151-
'sdgym_install': (
152-
'sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-515-_benchmark_multi_table_compute_gcp'
153-
),
154151
'install_s3fs': True,
155152
'assert_gpu': True,
156153
'gpu_wait_seconds': 10 * 60,
@@ -190,9 +187,6 @@ def test_resolve_compute_config_gcp():
190187
'delete_on_error': True,
191188
'stop_fallback': True,
192189
'swap_gb': 32,
193-
'sdgym_install': (
194-
'sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-515-_benchmark_multi_table_compute_gcp'
195-
),
196190
'install_s3fs': True,
197191
'assert_gpu': True,
198192
'gpu_wait_seconds': 10 * 60,

tests/unit/_benchmark/test_credentials_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22

3-
from sdgym._benchmark.credentials_utils import bundle_install_cmd, get_credentials
3+
from sdgym._benchmark.credentials_utils import get_credentials, sdv_install_cmd
44

55

66
def test_get_credentials(tmp_path):
@@ -42,8 +42,8 @@ def test_get_credentials(tmp_path):
4242
assert credentials == credentials_data
4343

4444

45-
def test_bundle_install_cmd():
46-
"""Test the `bundle_install_cmd` function."""
45+
def test_sdv_install_cmd():
46+
"""Test the `sdv_install_cmd` function."""
4747
# Setup
4848
credentials = {
4949
'sdv': {
@@ -57,8 +57,8 @@ def test_bundle_install_cmd():
5757
no_credentials = {'sdv': {}}
5858

5959
# Run
60-
cmd = bundle_install_cmd(credentials)
61-
cmd_no_creds = bundle_install_cmd(no_credentials)
60+
cmd = sdv_install_cmd(credentials)
61+
cmd_no_creds = sdv_install_cmd(no_credentials)
6262

6363
# Assert
6464
assert cmd == expected_cmd

0 commit comments

Comments
 (0)