-
Notifications
You must be signed in to change notification settings - Fork 68
[SDK-17] Optimize sdk tests via reducing fixture times #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4e4314d
to
2dea1b1
Compare
2dea1b1
to
448164d
Compare
project._wait_until_data_rows_are_processed(data_row_ids=data_row_ids, | ||
sleep_interval=3) | ||
|
||
project.create_batch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we delete the batch after yield
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
tests/integration/conftest.py
Outdated
|
||
|
||
@pytest.fixture | ||
def project_with_ontology(project): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rename this to project_with_empty_ontology
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k
dataset.delete() | ||
project.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no cleanup is needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add batch.delete()
the rest of resources now come from other fixtures
tests/integration/conftest.py
Outdated
label = _create_label(project, data_row, ontology, | ||
wait_for_label_processing) | ||
|
||
print("create_label took: ", time.time() - start_time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you keeping these print
calls or were they only for debugging purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no will remove
data_rows = [dr.uid for dr in list(dataset.data_rows())] | ||
project._wait_until_data_rows_are_processed( | ||
data_row_ids=data_rows, | ||
wait_processing_max_seconds=DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't remove the custom wait timeout here, because, in case of any backend issues, we will wait until the default 3600 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find
|
||
@pytest.fixture | ||
def configured_project_without_data_rows(client, ontology, rand_gen): | ||
def configured_project_with_one_data_row(client, ontology, rand_gen): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not create a data row, should we revert the rename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another good find
tests/integration/test_filtering.py
Outdated
def test_where(client, project_to_test_where): | ||
p_a, p_b, p_c = project_to_test_where | ||
p_a_name, p_b_name, p_c_name = [p.name for p in [p_a, p_b, p_c]] | ||
p_a_name, p_b_name, _ = [p.name for p in [p_a, p_b, p_c]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove _
if you remove p_c
from the array
This fixture has only one data row and all predictions will be mapped to it | ||
Custom Data Row IDs Strategy: | ||
Individuals can create their own fixture to supply data row ids. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's specify that this is only used for tests that require "data row ids", and not actual data rows created
end = time.time() | ||
|
||
exec_time = end - start | ||
if "FIXTURE_PROFILE" in os.environ: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure to include this in codefresh & github
…r project fixture
…so making ndjson test use project without datatows
235c789
to
5a6e250
Compare
400e36e
to
e585e8c
Compare
@attila @kevin implemented all changes on this PR except from one batch deletion as it was giving me an error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice work. Huge improvements!
Story: https://labelbox.atlassian.net/browse/SDK-17
The goal of this story was to reduce time spent in test setup (i.e. fixtures)
BEFORE estimate of average setup time over 5 slowest features on stage: 300s
AFTER: 224s
BEFORE: total running time of a successful run 13.5 mins (12 reruns)
AFTER: 11.5 mins (15 reruns)
Updates and improvements:
configured_project
(14 data rows) withconfigured_project_with_one_data_row
where possibleprediction_id_mapping
fixtures, drastically speed up tests not requiring actual data row creationtest_filtering
test_user_and_org.
IMPROVEMENT STORIES