Skip to content

Commit

Permalink
update docs for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanime committed Jul 25, 2016
1 parent c34dc33 commit a7ffc5b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 3 additions & 1 deletion docs/topics/jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ But this will::
somearg = response.meta['somearg']
print "the argument passed is:", somearg

If you wish to log the requests that couldn't be serialized, you can set the ``SCHEDULER_DEBUG`` setting to ``True`` in the project's settings page. It is ``False`` by default.
If you wish to log the requests that couldn't be serialized, you can set the
``SCHEDULER_DEBUG`` setting to ``True`` in the project's settings page.
It is ``False`` by default.

.. _pickle: http://docs.python.org/library/pickle.html
11 changes: 9 additions & 2 deletions docs/topics/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,15 @@ SCHEDULER_DEBUG

Default: ``False``

Setting to ``True`` will log the first unserializable request encountered.
Stats collected.
Setting to ``True`` will log debug information about the requests scheduler.
This currently logs(only once) if the requests cannot be serialized to disk.
Stats counter (``scheduler/unserializable``) tracks the number of times this happens.

Example entry in logs::

1956-01-31 00:00:00+0800 [scrapy] ERROR: Unable to serialize request: <request>
- reason: <exception> - no more unserializable requests will be logged (stats being
collected)

.. setting:: SPIDER_CONTRACTS

Expand Down
13 changes: 7 additions & 6 deletions scrapy/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ def _dqpush(self, request):
try:
reqd = request_to_dict(request, self.spider)
self.dqs.push(reqd, -request.priority)
except ValueError as e: # non serializable request
except ValueError as e: # non serializable request
if self.logunser:
msg = ("Unable to serialize request: %(request)s - reason: %(reason)s"
" - no more unserializable requests will be logged"
" (stats being collected)")
msg = ("Unable to serialize request: %(request)s - reason:"
" %(reason)s - no more unserializable requests will be"
" logged (stats being collected)")
logger.error(msg, {'request': request, 'reason': e},
exc_info=True, extra={'spider': self.spider})
self.logunser = False
self.stats.inc_value('scheduler/unserializable', spider=self.spider)
self.logunser = False
self.stats.inc_value('scheduler/unserializable',
spider=self.spider)
return
else:
return True
Expand Down

0 comments on commit a7ffc5b

Please sign in to comment.