vorta icon indicating copy to clipboard operation
vorta copied to clipboard

vorta --create should block and return borg exit status

Open drws opened this issue 3 years ago • 1 comments

Describe the bug

Currently vorta --create Profile signals Vorta to start Borg and exits immediately. By doing so it cannot signal back when the backup is finished and whether it finished successfully. I'm thinking that vorta --create should be blocking during Borg run and return its exit status to make it more informative overall and to provide blocking ability for scripts that need it. Users that don't want it can still fork the process rather easily. Or an additional switch could be added to only signal Vorta and exit immediately (as is the current behavior), vorta --start --create Profile for example.

Environment (please complete the following information):

  • OS: Arch Linux
  • Vorta version: 0.8.7
  • Installed from: OS repository

drws avatar Aug 04 '22 09:08 drws

I aggree that blocking and returning a proper status code would be an enhancement.

real-yfprojects avatar Aug 05 '22 14:08 real-yfprojects

I would like to work on this, please assign it to me 😄. Also, can you help me understand how I can block vorta instead of exiting? This should be done while the vorta window is open, and then close it when the task completes by using some sort of signal right?

diivi avatar Mar 15 '23 18:03 diivi

I looked through the code, in application.py::create_backup_action(), self.jobs_manager.add_job(job) this lines seems to be adding the job for vorta to execute. As this is a BorgCreateJob, I will know that the event is completed from the create.py::finished_event() method right? Now should I add another parameter to this job during creation that will inform me whether it was created normally or via the command line from another instance? I can check for this parameter in the finished_event() method and maybe send a message to the other instance that will inform it about any errors in execution?

diivi avatar Mar 15 '23 18:03 diivi

Hey @real-yfprojects, I might need two instances of vorta to be open while the backup is running. How do I send a message from the main instance to the instance that was created by the command line? This is needed to inform the second instance that a backup was completed/ errored. I see that the qt_single_application.py::sendMessage() method only sends a message to the main instance. self.app.isRunning() returns False from the main instance even when another instance is open.

diivi avatar Mar 16 '23 04:03 diivi

I will know that the event is completed from the create.py::finished_event() method right? Now should I add another parameter to this job during creation that will inform me whether it was created normally or via the command line from another instance?

You can connect to BorgJob.result instead.

self.app.isRunning() returns False from the main instance even when another instance is open.

You shouldn't need isRunning.

How do I send a message from the main instance to the instance that was created by the command line?

You have to implement a new method e.g. reply that uses _inSocket to answer.

real-yfprojects avatar Mar 16 '23 16:03 real-yfprojects