-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Abort job if more than 50% of data is missing after trying x MB #1785
Changes from 2 commits
c4a9dc1
7b46066
39a0da5
1d0212c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
# SABnzbd modules | ||
import sabnzbd | ||
from sabnzbd.constants import ( | ||
MEBI, | ||
GIGI, | ||
ATTRIB_FILE, | ||
JOB_ADMIN, | ||
|
@@ -1172,6 +1173,8 @@ def remove_article(self, article: Article, success: bool): | |
# Check the availability of these first articles | ||
if cfg.fail_hopeless_jobs() and cfg.fast_fail(): | ||
job_can_succeed = self.check_first_article_availability() | ||
if not job_can_succeed: | ||
abort_reason = "https://sabnzbd.org/not-complete (check_first_article_availability)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand you want to specify, but this is not usefull for regular users, let's not modify the text. |
||
|
||
# Remove from file-tracking | ||
articles_left = nzf.remove_article(article, success) | ||
|
@@ -1187,14 +1190,22 @@ def remove_article(self, article: Article, success: bool): | |
|
||
# Check if we can succeed when we have missing articles | ||
# Skip check if retry or first articles already deemed it hopeless | ||
if not success and job_can_succeed and not self.reuse and cfg.fail_hopeless_jobs(): | ||
job_can_succeed, _ = self.check_availability_ratio() | ||
if not success and job_can_succeed and not self.reuse: | ||
# Abort if more than 50% is missing after reaching missing_threshold_mbytes | ||
job_can_succeed = self.check_missing_threshold_mbytes() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should only be called if |
||
if not job_can_succeed: | ||
abort_reason = "https://sabnzbd.org/not-complete (missing_threshold_mbytes)" | ||
|
||
if job_can_succeed and cfg.fail_hopeless_jobs(): | ||
job_can_succeed, _ = self.check_availability_ratio() | ||
if not job_can_succeed: | ||
abort_reason = "https://sabnzbd.org/not-complete (check_availability_ratio)" | ||
|
||
# Abort the job due to failure | ||
if not job_can_succeed: | ||
self.fail_msg = T("Aborted, cannot be completed") + " - https://sabnzbd.org/not-complete" | ||
self.fail_msg = T("Aborted, cannot be completed") + " - " + abort_reason | ||
self.set_unpack_info("Download", self.fail_msg, unique=False) | ||
logging.debug('Abort job "%s", due to impossibility to complete it', self.final_name) | ||
logging.debug('Abort job "%s", due to impossibility to complete it (%s)', self.final_name, abort_reason) | ||
return True, True, True | ||
|
||
# Check if there are any files left here, so the check is inside the NZO_LOCK | ||
|
@@ -1511,6 +1522,14 @@ def check_first_article_availability(self): | |
return False | ||
return True | ||
|
||
def check_missing_threshold_mbytes(self): | ||
""" Return false if more than 50% is missing after downloading missing_threshold_mbytes MB """ | ||
if self.bytes_missing > self.bytes_downloaded: | ||
missing_threshold = cfg.missing_threshold_mbytes() * MEBI | ||
if missing_threshold and self.bytes_tried > missing_threshold: | ||
return False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other tests will only do a debug log. How about either a debug or info log for each test, like this? |
||
return True | ||
|
||
@synchronized(NZO_LOCK) | ||
def set_download_report(self): | ||
""" Format the stats for the history information """ | ||
|
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.
Could you move this after the
req_completion_rate
?Both here and in
cfg.py
.