-
Notifications
You must be signed in to change notification settings - Fork 137
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
Implement multiple queues. #1045
Conversation
Thanks for taking care! So this should be merged before or after #1005? Since this is an essential feature, we should discuss it in detail before writing code. But testing different options is often needed of course. My travels are almost done and I hope to get more involved again in the next days. |
Before its better.
I have no problem rewriting this code :)
Enjoy your travel ;) |
Hello @m3nu , This is how the JobsManager looks like now (inspired from Command DP) : When a Job is added to the JobsManager, the JobsManager sends this job to the right site which is a _Queue thanks to get_site_id. If the site _Queue does not exist, it is created by the JobsManager and _Queue starts immediatly a loop in a thread (threadpool) to handle jobs. The Job is then added to a python queue. Actually, how the JobsManager handle Jobs is not relevant for the rest of the code. What is important is that you have a really simple interface to add a job to the JobsManager and your Job is encapsulated in an object which must provides get_site_id(), cancel() and run() function. It's very flexible if we want to change later how the JobsManager handle the job. The running code of a Job must be in the run method. In the run method, you can launch a thread (QThread) but don't change the UI because run is itself launch in a thread. If you want to change the UI, you can use a signal/slot mechanism. This new implementation makes BorgThread somewhat useless. The JobsManager already launch thread, so its a bit repetitive to launch a thread. Thats not matter for now and we can change this later. Notice that Jobs run on multiple cores ! |
ff72576
to
9d0112a
Compare
Hello @m3nu , this PR is almost done and I dont expect any major implementation changes. I have updated my comment above. |
83c39ba
to
6a1e8dc
Compare
6fb28e8
to
f706031
Compare
…when creating site.
…. Protect get_site_id. Tray_menu works.
54e2332
to
6476ac0
Compare
Fine I will try to remove the thread dependence.
Yes The user have to wait that every jobs are finished to run a job and can run one job at a time. The manager tracks running job. The scheduler do whatever it wants, so if on 2 profiles you run backups on repo 1 and repo 2 at same time, the backup will be parallelized. If at the same time, a third profile run a backup on repo 1, the manager will just add this job to a queue to be run later. |
Yes, the latest commit 2bff7e8 Happened, when I had a backup from one profile running and another profile was scheduled, which ran after (or at the same time). |
Sorry I missclicked and closed the PR. I cannot reproduce this. What I tried :
|
I dont have this bug too :( The method set_tray_icon in https://github.com/borgbase/vorta/blob/901992f026e2ddc968ec65430c2910fc6d657452/src/vorta/tray_menu.py is called with active=true on my laptop when I start a backup. I will try to launch vorta on Ubuntu. I hope I can catch some bugs. For the moment, I dont have these bugs on Linux Mint and tests pass. EDIT : I also had the bug on my laptop but I just not performed the right steps to reproduce. It should work now. |
"original": trans_late("BorgThread", "Original"), | ||
"deduplicated": trans_late("BorgThread", "Deduplicated"), | ||
"compressed": trans_late("BorgThread", "Compressed"), } | ||
self.category_label = {"files": trans_late("BorgJob", "Files"), |
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.
Note to self: Update translations after renaming this.
Good progress. I'm liking this more and more. There is still this random segfault in the test. |
<3
I forget to add a job to the jobs_manager in repo_add_success and the job.run() method was directly run. But Im not sure to understand why it solves this issue. If I job.run() is called, there is no thread started like before. So the program block on this call. |
Nice! Seems to have fixed it. I'll play with it a bit more and possibly fix minor bugs, like the icon that we saw. Then we make a new branch v0.8.0, since this is a bigger change and we need to keep a maintenance branch of v0.7 |
Yes, Im glad that this PR is almost done ! After this I can back to #1005, the rebase will be a pain hh. |
We should keep all large changes from here in a new branch. Mostly because Vorta is in Debian and they need to cherry-pick minor patches sometimes, but can't have too many changes. It also gives us time to properly develop a new major release without thinking about breaking stuff (as much). |
Thanks for this massive contribution! 👏 And sorry it took longer to merge it. I'm just wary of large PRs. I see you simplified a lot fo things and addressed all comments. I've added a maintenance branch for the previous version |
You're welcome. |
Hello,
This PR will help me for #1005 . It is not ready yet since cancel button doesn't work anymore. Scheduler now has the ability to run jobs on multiple repositories concurrently and run multiple jobs on one repo (by queuing them).
In the future, all jobs will be copied into the db and run later if needed. It does not solve missed backup. It solves a fail backup (Power failure for example). I wait #1005 for this because #1005 change the db.
For each repository, there is one queue. I have represented a queue by a 'site'. Between sites (ie repository), tasks run concurrently. On one site, tasks run one by one.
The user also run tasks by adding them to the queue but he can't run multiple backups because start backup button is disabled when a job is running.
Related : #830