Skip to content
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

Run tests in parallel #1657

Merged
merged 9 commits into from
Jun 12, 2023
Merged

Run tests in parallel #1657

merged 9 commits into from
Jun 12, 2023

Conversation

rfdavid
Copy link
Collaborator

@rfdavid rfdavid commented Jun 9, 2023

This PR implements tests in parallel. The database is now created using a dynamic path instead of a fixed directory defined in the test helper. We use the parallel job feature from the ctest utility, but we can easily switch to another utility or create our own utility if necessary.
The default number of parallel jobs during the tests is 10, but it's possible to change it when running make:

make test TEST_JOBS=15

I didn't get much different results when increasing from 10. I believe it's due to I/O bound of the tests, so 10 should be enough to speed up the run substantially.

On my machine, the total time is around 120s without parallelization. When running 10 jobs, the total time drops to less than 20 seconds.

I also noticed a great improvement in MSVC build & test on CI. The current open PRs average time is around 40 minutes. In this PR, this number drops to around 10 minutes.

TODO (future?): we must develop a better clean-up code for the entire test suite. If we signal a stop during the test or if it segfaults, it won't cleanup the temporary files unittest_temp_* and dataset/parquet_temp_*.

@codecov
Copy link

codecov bot commented Jun 10, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.06 ⚠️

Comparison is base (b2c85b2) 91.44% compared to head (2ca1a3a) 91.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1657      +/-   ##
==========================================
- Coverage   91.44%   91.38%   -0.06%     
==========================================
  Files         727      730       +3     
  Lines       26375    26455      +80     
==========================================
+ Hits        24118    24177      +59     
- Misses       2257     2278      +21     
Impacted Files Coverage Δ
...storage/store/nodes_statistics_and_deleted_ids.cpp 86.13% <50.00%> (ø)

... and 40 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

- Use joinPath on DeleteNodeWithEdgesErrorTest to handle windows path test
  failure
- Refactor CSV to Parquet converter
@rfdavid rfdavid changed the title Run tests in parallel (experimental) Run tests in parallel Jun 11, 2023
@@ -64,7 +64,7 @@ jobs:
run: CC=gcc CXX=g++ make alldebug NUM_THREADS=32

- name: Run test with ASan
run: ctest
run: ctest --output-on-failure -j 10
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with ASan. Is it ok to run multiple jobs here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fine.

I noticed one test (CApiConnectionTest.Interrupt) failing in asan CI test, can you take a further look?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can take a look but this error is also in other PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Can you open an issue on this then?

@rfdavid rfdavid marked this pull request as ready for review June 11, 2023 15:52
@rfdavid rfdavid requested a review from ray6080 June 11, 2023 15:52
@@ -2,11 +2,10 @@

class CApiDatabaseTest : public EmptyDBTest {
public:
void SetUp() override {}
void SetUp() override { EmptyDBTest::SetUp(); }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mewim Is it ok to add EmptyDBTest::SetUp() here? I basically need to set the temporary dynamic database path instead of using the fixed one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this. Since it is only setting a path it is fine.

Copy link
Contributor

@ray6080 ray6080 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR!

@@ -64,7 +64,7 @@ jobs:
run: CC=gcc CXX=g++ make alldebug NUM_THREADS=32

- name: Run test with ASan
run: ctest
run: ctest --output-on-failure -j 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fine.

I noticed one test (CApiConnectionTest.Interrupt) failing in asan CI test, can you take a further look?

-CASE DeleteNodeWithEdgeErrorTest
-SKIP
-STATEMENT MATCH (a:person) WHERE a.ID = 0 DELETE a
---- error
Runtime exception: Currently deleting a node with edges is not supported. node table 0 nodeOffset 0 has 3 (one-to-many or many-to-many) edges for edge file: ${KUZU_ROOT_DIRECTORY}/test/unittest_temp/r-3-0.lists.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify the error message here, and remove "for edge file: ${KUZU_ROOT_DIRECTORY}/test/unittest_temp/r-3-0.lists"

CMakeLists.txt Outdated
@@ -112,7 +112,7 @@ function(add_kuzu_test TEST_NAME)
target_link_libraries(${TEST_NAME} PRIVATE test_helper test_runner graph_test)
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/test/include)
include(GoogleTest)
gtest_discover_tests(${TEST_NAME})
gtest_discover_tests(${TEST_NAME} DISCOVERY_MODE PRE_TEST)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you double check if this change is necessary, if not, revert. DISCOVERY_MODE requires higher cmake version (3.18+), while we target at 3.11 right now.

@rfdavid rfdavid merged commit 0666fd4 into kuzudb:master Jun 12, 2023
7 of 8 checks passed
@rfdavid rfdavid deleted the parallel_tests branch June 12, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants