Skip to content

Commit

Permalink
fix test name
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Sep 26, 2023
1 parent 8c2a7d8 commit cbc63fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AB_environments/AB_sample.cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
# Overrides ../cluster_kwargs.yaml.
# Leave empty if you don't want to override anything.

# small_cluster:
# small:
# n_workers: 5
# worker_vm_types: [m6i.xlarge] # 4CPU, 16GiB
18 changes: 15 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ def benchmark_db_session(benchmark_db_engine):
yield session


def clean_test_name(name: str) -> str:
"""Clean up redundant parameters created by 'client' fixture"""
return (
name.replace("cluster0,client0", "")
.replace("[]", "")
.replace(",]", "]")
.replace("[,", "[")
.replace(",,", ",")
)


@pytest.fixture(scope="function")
def test_run_benchmark(benchmark_db_session, request, testrun_uid):
"""SQLAlchemy ORM object representing a given test run.
Expand All @@ -171,7 +182,7 @@ def test_run_benchmark(benchmark_db_session, request, testrun_uid):
else:
run = TestRun(
session_id=testrun_uid,
name=request.node.name,
name=clean_test_name(request.node.name),
originalname=request.node.originalname,
path=str(request.node.path.relative_to(TEST_DIR)),
dask_version=dask.__version__,
Expand Down Expand Up @@ -491,7 +502,7 @@ def client(
benchmark_all,
):
n_workers = cluster_kwargs["small"]["n_workers"]
test_label = f"{request.node.name}, session_id={testrun_uid}"
test_label = f"{clean_test_name(request.node.name)}, session_id={testrun_uid}"
with Client(cluster) as client:
log_on_scheduler(client, "Starting client setup of %s", test_label)
client.restart()
Expand Down Expand Up @@ -624,7 +635,8 @@ def _upload_cluster_dump(client):
if cluster_dump == "always" or (cluster_dump == "fail" and failed):
dump_path = (
f"{s3_cluster_dump_url}/{client.cluster.name}/"
f"{test_run_benchmark.path.replace('/', '.')}.{request.node.name}"
f"{test_run_benchmark.path.replace('/', '.')}."
f"{clean_test_name(request.node.name)}"
)
test_run_benchmark.cluster_dump_url = dump_path + ".msgpack.gz"
logger.info(
Expand Down

0 comments on commit cbc63fd

Please sign in to comment.