-
Notifications
You must be signed in to change notification settings - Fork 5
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
Improve polling and logging #86
Conversation
cps/tasks/download.py
Outdated
if "creating" in line: | ||
self.progress += 0.025 | ||
log.info("Download progress: %s", self.progress) | ||
if "Running ANALYZE" in line: | ||
self.progress = 0 | ||
line = p.stdout.readline() | ||
if "extracting" in line: | ||
self.message = "Downloading media..." | ||
self.progress += 0.077 | ||
elif "downloading" in line: | ||
self.progress += 0.077 | ||
elif "download" in line: | ||
self.progress += 0.077 | ||
elif "merging" in line: | ||
self.progress += 0.077 | ||
elif "adding" in line: | ||
self.progress += 0.075 | ||
break | ||
else: | ||
self.progress += 0.077 | ||
log.info("Download progress: %s", self.progress) |
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.
These lines need more explaining:
- How were the 8 numbers chosen?
- Why is 0.077 used 5 times, and 0.075 used once?
- Why is a
break
statement now needed with "adding", unlike in the past? - Does 0.075 do anything at all, if it breaks out of the while loop, and is overwritten soon after (on Line 102) with
self.progress = 1
- Can the solitary test for "creating" (on Line 48) possibly be made a part of the if-elif-elif-elif-elif-else structure further below?
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.
I refactored it and got rid of pattern matching. The logging will be more aligned with #68. However it builds on a customization made to xklb's underlying yt_dlp code, in which I use progress hooks.
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.
builds on a customization made to xklb's underlying yt_dlp code
What xklb or yt-dlp code are you talking about, to help others understand?
in which I use progress hooks
What line number in your code? (Thanks!)
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.
I am talking about this changes:
deldesir/library@f923477
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.
@chapmanjacobd just FYI! 🏗️
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.
I am talking about this changes: chapmanjacobd/[email protected]:library:main
@deldesir please clarify:
-
Are you asking everyone to change how they install IIAB with Calibre-Web ?
-
Are you asking them to customize xklb code, after pipx install xklb ?
-
Please spell out precisely (AI²) whatever you are suggesting (Thanks!)
AI² = Articulate Assumptions, Intentions & Intuition
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.
No need to customize xklb. IIAB install instructions remain the same.
This will build upon progress hooks
xklb can be too verbose
Is this revised PR tested? (Thanks!) |
It's being actively tested on 10.8.0.70. An example test is to try to download this video https://www.youtube.com/watch?v=r2wBcCIlMGw. It will fail, but thanks to enhanced logging we now know why it fails. The error is read from the database too, as suggested by @chapmanjacobd |
QUESTION: Why are commits 322046c and e52ae66 reducing logging verbosity? Many bugs are very urgently in need of more detailed (or at least most illustrative) logging — rather than less! Just a few examples here:
|
@codewiz is this logging design solid? Or getting closer? |
Show errors in tasks view
I was testing log levels and wanted to find the optimal one to capture efficiently progress information. I will keep Summary of this PR:
NB. A new related PR will be shipped to add a "retry" button in tasks' "actions column. |
Just FYI I'm not in favor of this PR auto-closing these 3 issues:
(The above 3 issues are certainly related, but they were carefully written up to address larger issues like systemd's journalctl logging that will certainly be needed later, but those things are likely far above and beyond this current PR #86, which needs to remain tightly focused.) |
Positive: While I don't yet understand this PR's core assumptions... (it definitely needs more AI² = Articulate Assumptions, Intentions & Intuition) ...the good news is that today it's starting to converge — to become progressively more Clearly Explained + Cleanly Understandable. |
Add "format options" instructions to test large size videos. Co-authored-by: A Holt <[email protected]>
Co-authored-by: A Holt <[email protected]>
FYI this PR #86 inspired...
The goal (as explained there) is smaller PR's and smaller (sometimes even Artisanal?!) ideas: TDD momentum = Architectural Humility + Collaboration Authenticity 🪜 https://en.wikipedia.org/wiki/A_journey_of_a_thousand_miles_begins_with_a_single_step |
More progress ongoing: |
Progress continues: |
@deldesir should this PR be closed? (If so, please explain what is replacing and why, Thanks!) |
Yes. It was abandoned in favor of smaller PRs. Already merged #87 was the first one spinned off it. |
This PR has following changes:
- Enhanced logging.
- Added more detailed error handling for database operations and subprocess execution.
- Wrapped database operations in a try-except block for better error handling.
- Ensured consistent progress updates.
Tested on Ubuntu 24.04 (10.8.0.70)