Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion data_registry/process_manager/task/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.urls import reverse
from scrapyloganalyzer import ScrapyLogFile

from data_registry.exceptions import ConfigurationError, RecoverableError, UnexpectedError
from data_registry.exceptions import ConfigurationError, IrrecoverableError, RecoverableError, UnexpectedError
from data_registry.models import Job, Task
from data_registry.process_manager.util import TaskManager, skip_if_not_started
from data_registry.util import CHANGE, scrapyd_url
Expand Down Expand Up @@ -144,6 +144,9 @@ def get_status(self):
url = f"https://{Site.objects.get_current().domain}{path}"
logger.warning("%s has warnings: %s\n%s\n", self, url, "\n".join(messages))

if scrapy_log.error_rate > 0.15: # 15%
raise IrrecoverableError(f"The crawl had a {scrapy_log.error_rate} error rate")

return Task.Status.COMPLETED

raise RecoverableError(f"Unable to find status of Scrapyd job {scrapyd_job_id}")
Expand Down