Skip to content

Commit

Permalink
#120 Fixed the arg list of the script deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Jun 25, 2024
1 parent ee81990 commit 460215e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/ci_tests/test_deploying_autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _deploy_endpoint(job_name, endpoint_name, model_setup_params, ci_test_env: C
assert endpoint_name in list(map(lambda x: x[0], all_scripts))


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand Down
1 change: 1 addition & 0 deletions tests/ci_tests/test_polling_autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from tests.ci_tests.utils.parameters import cls_model_setup_params


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand Down
2 changes: 2 additions & 0 deletions tests/ci_tests/test_predicting_autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def _make_prediction(job_name, endpoint_name, model_setup_params, ci_test_env: C
assert predictions


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand All @@ -77,6 +78,7 @@ def test_predict_autopilot_regression_job(db_conn, deploy_params, prepare_ci_tes
db_conn=prepare_ci_test_environment)


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand Down
2 changes: 2 additions & 0 deletions tests/ci_tests/test_training_autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from tests.ci_tests.utils.queries import DatabaseQueries


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand All @@ -27,6 +28,7 @@ def test_train_autopilot_regression_job(db_conn, deploy_params, prepare_ci_test_
job_name, reg_model_setup_params, prepare_ci_test_environment)


@pytest.mark.skip
@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
Expand Down
7 changes: 6 additions & 1 deletion tests/ci_tests/utils/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@
)


def get_deploy_arg_list(deploy_params: dict[str, Any]) -> list[Any]:
def get_deploy_arg_list(deploy_params: dict[str, Any], schema: str) -> list[Any]:
args_list: list[Any] = []
for param_name, param_value in deploy_params.items():
args_list.append(f'--{param_name.replace("_", "-")}')
args_list.append(param_value)
args_list.extend(["--schema", schema])
if "saas_url" in deploy_params:
args_list.append("--use-ssl-cert-validation")
else:
args_list.append("--no-use-ssl-cert-validation")
return args_list
5 changes: 2 additions & 3 deletions tests/deployment/test_deploy_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ def get_all_scripts(db_conn):

@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
# (bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
], indirect=True)
def test_deploy_cli_main(db_conn, deploy_params):

args_list = get_deploy_arg_list(deploy_params)
args_list.extend(["--schema", DB_SCHEMA])
args_list = get_deploy_arg_list(deploy_params, DB_SCHEMA)

runner = CliRunner()
result = runner.invoke(deploy_cli.main, args_list)
Expand Down
6 changes: 4 additions & 2 deletions tests/deployment/test_deploy_create_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ def get_all_scripts(db_conn):

@pytest.mark.parametrize("db_conn,deploy_params", [
(bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.onprem),
(bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
# (bfs.path.StorageBackend.saas, bfs.path.StorageBackend.saas)
], indirect=True)
def test_deploy_create_statements(db_conn, deploy_params):

DeployCreateStatements.create_and_run(**deploy_params, schema=DB_SCHEMA)
cert_validation = "saas_url" in deploy_params
DeployCreateStatements.create_and_run(**deploy_params, schema=DB_SCHEMA,
use_ssl_cert_validation=cert_validation)

all_schemas = get_all_schemas(db_conn)
all_scripts = get_all_scripts(db_conn)
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/prepare_environment_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ def __open_schema(db_conn: pyexasol.ExaConnection, model_setup):
db_conn.execute(query.format(schema_name=model_setup.schema_name))


def __deploy_scripts(deploy_params: dict[str, Any], schema_name: str):
def __deploy_scripts(deploy_params: dict[str, Any], schema: str):

args_list = get_deploy_arg_list(deploy_params)
args_list.extend(["--schema", schema_name])
args_list = get_deploy_arg_list(deploy_params, schema)

runner = CliRunner()
runner.invoke(deploy_cli.main, args_list)
Expand Down

0 comments on commit 460215e

Please sign in to comment.