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

WIP: Check only one runner #150

Merged
merged 23 commits into from
Oct 24, 2024
Merged

WIP: Check only one runner #150

merged 23 commits into from
Oct 24, 2024

Conversation

davidwaroquiers
Copy link
Member

This PR adds info to the auxiliary collection when the runner is started. The idea would be to warn the user that there may be another runner running already, in which case bad things could happen.

Currently just inserts the info when starting the runner and removes it when stopping it.

Still to be done:

  • Deal with the locked document (if two people try to start the runner at the exact same time, guess it would not be very common but still)
  • Deal with the specific goal of this PR: what do we do when this happens
  • Deal with when the document with the runner info in the auxiliary collection is not present

@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 76.98745% with 110 lines in your changes missing coverage. Please review.

Project coverage is 73.65%. Comparing base (d2d5bc7) to head (8fc6704).

Files with missing lines Patch % Lines
src/jobflow_remote/jobs/daemon.py 80.00% 22 Missing and 16 partials ⚠️
src/jobflow_remote/jobs/jobcontroller.py 66.21% 24 Missing and 1 partial ⚠️
src/jobflow_remote/cli/runner.py 57.14% 9 Missing and 3 partials ⚠️
src/jobflow_remote/jobs/upgrade.py 87.91% 7 Missing and 4 partials ⚠️
src/jobflow_remote/cli/admin.py 80.43% 5 Missing and 4 partials ⚠️
src/jobflow_remote/cli/utils.py 69.56% 2 Missing and 5 partials ⚠️
src/jobflow_remote/utils/db.py 50.00% 7 Missing ⚠️
src/jobflow_remote/cli/formatting.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #150      +/-   ##
===========================================
+ Coverage    72.28%   73.65%   +1.37%     
===========================================
  Files           45       46       +1     
  Lines         5671     6070     +399     
  Branches       890      953      +63     
===========================================
+ Hits          4099     4471     +372     
+ Misses        1260     1252       -8     
- Partials       312      347      +35     
Files with missing lines Coverage Δ
src/jobflow_remote/jobs/runner.py 78.85% <ø> (ø)
src/jobflow_remote/cli/formatting.py 85.82% <91.66%> (-0.01%) ⬇️
src/jobflow_remote/cli/utils.py 63.75% <69.56%> (+0.18%) ⬆️
src/jobflow_remote/utils/db.py 77.27% <50.00%> (-1.86%) ⬇️
src/jobflow_remote/cli/admin.py 87.87% <80.43%> (-3.99%) ⬇️
src/jobflow_remote/jobs/upgrade.py 87.91% <87.91%> (ø)
src/jobflow_remote/cli/runner.py 64.90% <57.14%> (+35.30%) ⬆️
src/jobflow_remote/jobs/jobcontroller.py 78.35% <66.21%> (-0.88%) ⬇️
src/jobflow_remote/jobs/daemon.py 67.89% <80.00%> (+11.76%) ⬆️

@davidwaroquiers
Copy link
Member Author

Hi @gpetretto

Still a few things to be done but I think before going on, it would be better to have the expert's eye on this ;)

src/jobflow_remote/cli/admin.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Outdated Show resolved Hide resolved
tests/db/cli/test_admin.py Outdated Show resolved Hide resolved
Copy link
Contributor

@gpetretto gpetretto left a comment

Choose a reason for hiding this comment

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

I have added some more comments to the latest changes

src/jobflow_remote/cli/admin.py Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Show resolved Hide resolved
src/jobflow_remote/cli/admin.py Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Show resolved Hide resolved
src/jobflow_remote/jobs/jobcontroller.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/admin.py Show resolved Hide resolved
tests/db/jobs/test_daemon.py Outdated Show resolved Hide resolved
Copy link
Member Author

@davidwaroquiers davidwaroquiers left a comment

Choose a reason for hiding this comment

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

I think it's all good. I did not test myself the functionality though. I would say it might be something to mention in the next release that if people encounter "weird things" when starting/stopping, they should open an issue. What do you think ?
I can't approve my own PR even if it has more become yours ;-)

tests/db/conftest.py Outdated Show resolved Hide resolved
tests/db/conftest.py Outdated Show resolved Hide resolved
tests/db/cli/test_admin.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/admin.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/admin.py Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Outdated Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Show resolved Hide resolved
src/jobflow_remote/jobs/daemon.py Show resolved Hide resolved
Copy link
Member Author

@davidwaroquiers davidwaroquiers left a comment

Choose a reason for hiding this comment

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

Added last few comments or suggestions.

doc/source/user/runner.rst Outdated Show resolved Hide resolved
doc/source/user/runner.rst Outdated Show resolved Hide resolved
doc/source/user/runner.rst Outdated Show resolved Hide resolved
doc/source/user/runner.rst Outdated Show resolved Hide resolved
doc/source/user/runner.rst Show resolved Hide resolved
tests/db/jobs/test_daemon.py Outdated Show resolved Hide resolved
tests/db/jobs/test_daemon.py Outdated Show resolved Hide resolved
Copy link
Member Author

@davidwaroquiers davidwaroquiers left a comment

Choose a reason for hiding this comment

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

All good! Can't approve as it was initially my PR. Bit approved 😀

@gpetretto gpetretto merged commit 6d6ed9d into develop Oct 24, 2024
5 checks passed
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.

Check there is not already a runner running
3 participants