Skip to content

Commit 038584e

Browse files
committed
use invoke install-sdv-enterprise
1 parent fec2c0c commit 038584e

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

.github/workflows/run_benchmark_multi_table.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ jobs:
3131
source venv/bin/activate
3232
3333
python -m pip install --upgrade pip
34-
python -m pip install sdv-enterprise --index-url "https://${USERNAME}:${LICENSE_KEY}@pypi.datacebo.com"
34+
python -m pip install invoke tomli packaging
35+
invoke install-sdv-enterprise
3536
python -m pip install "sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-516-add-workflows"
3637
3738
echo "VIRTUAL_ENV=$(pwd)/venv" >> $GITHUB_ENV
3839
echo "$(pwd)/venv/bin" >> $GITHUB_PATH
3940
41+
- name: Stop workflow after dependency install (temporary)
42+
run: exit 0
4043
- name: Run SDGym Benchmark
4144
env:
4245
GCP_SERVICE_ACCOUNT_JSON: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}

.github/workflows/run_benchmark_single_table.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
source venv/bin/activate
2929
3030
python -m pip install --upgrade pip
31+
python -m pip install invoke tomli packaging
3132
python -m pip install sdv-enterprise --index-url "https://${USERNAME}:${LICENSE_KEY}@pypi.datacebo.com"
3233
python -m pip install "sdgym[all] @ git+https://github.com/sdv-dev/SDGym.git@issue-516-add-workflows"
3334

tasks.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,24 @@ def notify_sdgym_benchmark_uploaded(c, folder_name, commit_url=None, modality='s
219219

220220
post_benchmark_uploaded_message(folder_name, commit_url, modality)
221221

222+
223+
@task
224+
def install_sdv_enterprise(c, username=None, license_key=None):
225+
"""Install sdv-enterprise using sdv-installer if credentials are available."""
226+
# 🔹 Import here to avoid triggering sdgym imports at load time
227+
from sdgym._benchmark.credentials_utils import sdv_install_cmd
228+
229+
username = username or os.getenv("SDV_ENTERPRISE_USERNAME")
230+
license_key = license_key or os.getenv("SDV_ENTERPRISE_LICENSE_KEY")
231+
credentials = {
232+
"sdv": {
233+
"username": username,
234+
"license_key": license_key,
235+
}
236+
}
237+
238+
install_cmd = sdv_install_cmd(credentials)
239+
if install_cmd:
240+
c.run(install_cmd)
241+
else:
242+
print("No sdv-enterprise credentials found. Skipping installation.")

tests/test_tasks.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
"""Tests for the ``tasks.py`` file."""
22

3+
from unittest.mock import Mock, patch
4+
35
from tasks import (
46
_get_extra_dependencies,
57
_get_minimum_versions,
68
_resolve_version_conflicts,
9+
install_sdv_enterprise,
710
)
811

912

@@ -209,3 +212,38 @@ def test__resolve_version_conflicts_pointing_to_branch():
209212
'rdt==1.1.2',
210213
'copulas==0.12.0',
211214
])
215+
216+
217+
@patch('sdgym._benchmark.credentials_utils.sdv_install_cmd')
218+
def test_install_sdv_enterprise(mock_sdv_install_cmd):
219+
"""Test the `install_sdv_enterprise` task."""
220+
# Setup
221+
username = 'test_user'
222+
license_key = 'test_license_key'
223+
mock_context = Mock()
224+
mock_sdv_install_cmd.return_value = 'install command'
225+
226+
# Run
227+
install_sdv_enterprise.body(mock_context, username=username, license_key=license_key)
228+
229+
# Assert
230+
mock_sdv_install_cmd.assert_called_once_with({
231+
'sdv': {
232+
'username': username,
233+
'license_key': license_key,
234+
}
235+
})
236+
mock_context.run.assert_called_once_with('install command')
237+
238+
239+
def test_install_sdv_enterprise_no_credentials(capsys):
240+
"""Test the `install_sdv_enterprise` task without credentials."""
241+
# Setup
242+
mock_context = Mock()
243+
244+
# Run
245+
install_sdv_enterprise.body(mock_context)
246+
247+
# Assert
248+
captured = capsys.readouterr()
249+
assert 'No sdv-enterprise credentials found. Skipping installation.' in captured.out

0 commit comments

Comments
 (0)