mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 07:25:04 +02:00
Make file cleanup part of default crawler behaviour
This commit is contained in:
parent
ec95dda18f
commit
e21795ee35
1 changed files with 10 additions and 2 deletions
|
|
@ -244,8 +244,15 @@ class Crawler(ABC):
|
||||||
desc = f"[bold bright_cyan]Downloading[/] {escape(str(path))}"
|
desc = f"[bold bright_cyan]Downloading[/] {escape(str(path))}"
|
||||||
return DownloadToken(self._limiter, fs_token, desc)
|
return DownloadToken(self._limiter, fs_token, desc)
|
||||||
|
|
||||||
async def cleanup(self) -> None:
|
async def _cleanup(self) -> None:
|
||||||
await self._output_dir.cleanup()
|
log.explain_topic("Decision: Clean up files?")
|
||||||
|
if self.error_free:
|
||||||
|
log.explain("No warnings or errors occurred during this run")
|
||||||
|
log.explain("Cleaning up files")
|
||||||
|
await self._output_dir.cleanup()
|
||||||
|
else:
|
||||||
|
log.explain("Warnings or errors occurred during this run")
|
||||||
|
log.explain("Not cleaning up files")
|
||||||
|
|
||||||
async def run(self) -> None:
|
async def run(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
@ -255,6 +262,7 @@ class Crawler(ABC):
|
||||||
|
|
||||||
with log.show_progress():
|
with log.show_progress():
|
||||||
await self._run()
|
await self._run()
|
||||||
|
await self._cleanup()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def _run(self) -> None:
|
async def _run(self) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue