mirror of https://github.com/scrapy/scrapy.git
[Solved] JOBDIR= None for when Scheduler initializes disk queue even if JOBDIR is empty string (#6124)
Co-authored-by: John Doe <johndoe@email.com>
This commit is contained in:
parent
7e6da37170
commit
04024f1e79
|
|
@ -1120,7 +1120,7 @@ modify this setting in your project, modify :setting:`ITEM_PIPELINES` instead.
|
|||
JOBDIR
|
||||
------
|
||||
|
||||
Default: ``''``
|
||||
Default: ``None``
|
||||
|
||||
A string indicating the directory for storing the state of a crawl when
|
||||
:ref:`pausing and resuming crawls <topics-jobs>`.
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ class Scheduler(BaseScheduler):
|
|||
|
||||
def _dqdir(self, jobdir: Optional[str]) -> Optional[str]:
|
||||
"""Return a folder name to keep disk queue state at"""
|
||||
if jobdir is not None:
|
||||
if jobdir:
|
||||
dqdir = Path(jobdir, "requests.queue")
|
||||
if not dqdir.exists():
|
||||
dqdir.mkdir(parents=True)
|
||||
|
|
|
|||
|
|
@ -206,6 +206,8 @@ ITEM_PROCESSOR = "scrapy.pipelines.ItemPipelineManager"
|
|||
ITEM_PIPELINES = {}
|
||||
ITEM_PIPELINES_BASE = {}
|
||||
|
||||
JOBDIR = None
|
||||
|
||||
LOG_ENABLED = True
|
||||
LOG_ENCODING = "utf-8"
|
||||
LOG_FORMATTER = "scrapy.logformatter.LogFormatter"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ from scrapy.settings import BaseSettings
|
|||
|
||||
|
||||
def job_dir(settings: BaseSettings) -> Optional[str]:
|
||||
path: str = settings["JOBDIR"]
|
||||
if path and not Path(path).exists():
|
||||
path: Optional[str] = settings["JOBDIR"]
|
||||
if not path:
|
||||
return None
|
||||
if not Path(path).exists():
|
||||
Path(path).mkdir(parents=True)
|
||||
return path
|
||||
|
|
|
|||
Loading…
Reference in New Issue