Skip to content

Commit

Permalink
Make testtuple performances be integers (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Esadruhn authored Jul 17, 2020
1 parent 9c5701f commit 0a79cf4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion substratest/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def create_data_sample(self, content=None, datasets=None, test_only=False):
content = f'# random={rdm} \n'.encode(encoding) + content
else:
# x=1, y=2. The last "random" column ensures the datasample is unique.
content = f'1,2,{rdm}\n'.encode(encoding)
content = f'10,20,{rdm}\n'.encode(encoding)

data_filepath = tmpdir / DEFAULT_DATA_SAMPLE_FILENAME
with open(data_filepath, 'wb') as f:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_tuples_execution_on_same_node(factory, client, default_dataset, default
spec = factory.create_testtuple(objective=default_objective, traintuple=traintuple)
testtuple = client.add_testtuple(spec).future().wait()
assert testtuple.status == assets.Status.done
assert math.isclose(testtuple.dataset.perf, 0.2)
assert testtuple.dataset.perf == 2

# add a traintuple depending on first traintuple
spec = factory.create_traintuple(
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_tuples_execution_on_different_nodes(factory, client_1, client_2, defaul
testtuple = client_1.add_testtuple(spec).future().wait()
assert testtuple.status == assets.Status.done
assert testtuple.dataset.worker == client_1.node_id
assert math.isclose(testtuple.dataset.perf, 0.2)
assert testtuple.dataset.perf == 2


@pytest.mark.slow
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_composite_traintuples_execution(factory, client, default_dataset, defau
spec = factory.create_testtuple(objective=default_objective, traintuple=composite_traintuple_2)
testtuple = client.add_testtuple(spec).future().wait()
assert testtuple.status == assets.Status.done
assert math.isclose(testtuple.dataset.perf, 3.2)
assert testtuple.dataset.perf == 32

# list composite traintuple
composite_traintuples = client.list_composite_traintuple()
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_aggregate_composite_traintuples(factory, network, clients, default_data
traintuple=traintuple,
)
testtuple = clients[0].add_testtuple(spec).future().wait()
math.isclose(testtuple.dataset.perf, 3.2)
assert testtuple.dataset.perf == 32

if not network.options.enable_intermediate_model_removal:
return
Expand Down
2 changes: 1 addition & 1 deletion tests/test_execution_compute_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_compute_plan(factory, client_1, client_2, default_dataset_1, default_da
assert testtuple.rank == traintuple_3.rank

# check testtuple perf
assert math.isclose(testtuple.dataset.perf, 0.4)
assert testtuple.dataset.perf == 4

# XXX as the first two tuples have the same rank, there is currently no way to know
# which one will be returned first
Expand Down

0 comments on commit 0a79cf4

Please sign in to comment.