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

Speed up unit test and skip unstable test #205

Merged
merged 3 commits into from
Aug 8, 2024
Merged

Speed up unit test and skip unstable test #205

merged 3 commits into from
Aug 8, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Aug 8, 2024

In the previous unit test, one needed to sleep for a time manually to wait for a task state. The sleep time needs to be chosen carefully to make sure the state is reached. This PR allows the WorkGraph to wait for the particular states of a task.

# wait add1 to be finished.
wg.wait(tasks={"add1": ["FINISHED"]}, timeout=20)
# wait for the workgraph to launch add1
wg.wait(tasks={"add1": ["CREATED", "WAITING", "RUNNING", "FINISHED"]}, timeout=20)

This speeds up the test and makes the test more robust.

To speed up the test, I also

  • Remove unused task, duplicated test.
  • Replace the calcjob task with the calcfunction task.

Skip unstable test

I skipped the test for playing the paused task; it seems the daemon is not responding to the play signal. This should be a problem of AiiDA test fixtures.

Time for the pytest

python version AiiDA version Time (This PR) Time (Previous)
3.9 2.6 13 s 17 s
3.11 2.6 11 s 14 s
3.12 2.6 17 s 23 s

TODO: find why Python 3.12 is slow.

@superstar54 superstar54 linked an issue Aug 8, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.96%. Comparing base (5937b88) to head (6423864).
Report is 7 commits behind head on main.

Files Patch % Lines
aiida_workgraph/workgraph.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   75.75%   75.96%   +0.20%     
==========================================
  Files          70       70              
  Lines        4615     4709      +94     
==========================================
+ Hits         3496     3577      +81     
- Misses       1119     1132      +13     
Flag Coverage Δ
python-3.11 75.96% <98.36%> (+0.29%) ⬆️
python-3.9 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@superstar54 superstar54 force-pushed the speed_test branch 2 times, most recently from 6423864 to fce5327 Compare August 8, 2024 20:34
This can be used in the unit test. Intead of sleep for a time manually.
@superstar54 superstar54 changed the title Speed up unit test Speed up unit test and skip unstable test Aug 8, 2024
@superstar54 superstar54 merged commit b4e443f into main Aug 8, 2024
8 checks passed
@superstar54 superstar54 deleted the speed_test branch August 9, 2024 21:35
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.

Speed up the test
2 participants