-
Notifications
You must be signed in to change notification settings - Fork 9
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
Backup tools: rsync progress; logging change #166
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #166 +/- ##
=======================================
Coverage 99.90% 99.90%
=======================================
Files 10 10
Lines 2066 2085 +19
=======================================
+ Hits 2064 2083 +19
Misses 2 2 ☔ View full report in Codecov by Sentry. |
I think that not capturing the output of rsync is OK as the best solution among those you describe, but happy to hear if @sphuber also agrees or not |
@sphuber This should be good now, give it a quick check if you have time. |
To summarize the discussion @eimrek and myself had: ideally the progress of rsync also goes through the logging system as then it can be fully controlled by the caller, e.g. |
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.
Thanks @eimrek , looks good to me
Hi,
this PR contains two changes:
1) remove the logger argument from BackupManager, and instead only use the logger object of this library.
This change is motivated by the fact that in aiida-core, the default logging level is REPORT (23) and the logger.info messages of this library are not outputted, which give information about the progress and should probably be shown by default. After these changes, the logger instead should be controlled in the aiida-core via something like
Although, perhaps there is a better way to do it, similarly to the other loggers (as is done in aiida.common.log.py).
In principle, I can also revert to using the logger argument, but then i probably should also create a custom log level called REPORT in this library, if i want to log consistently with aiida-core.
2) Enable rsync progress indication (with
--info=progress2
) and output the stdout directly to the user, without capturing itIf i call
subprocess.run(rsync_args, capture_output=False)
, the stdout of rsync is passed directly from the subprocess to the user, bypassing any logging system. Although this has drawbacks (e.g. it won't show up in logs, e.g. when redirecting to a file), it allows to show the updating progress indicator to the user running the CLI sees. The output is captured and not shown, however, if the logging level is above INFO. The motivation behind why I just bypass capturing the output is that if the stdout is captured, it's not possible (i think; or at least not without writing a lot of code) to output a in-place updating progress indicator via the logging system.As this has the drawback, I think it would be good to discuss and get opinions (@giovannipizzi @sphuber).
Two possible alternatives would be