Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor the status of scrapy while running

Tags:

scrapy

scrapyd

I want to know what is going on while scrapy is running , how can i monitor the status ?

like image 689
Spy Avatar asked Nov 25 '25 15:11

Spy


1 Answers

There are two methods. The first method, here is a example from the official document.

telnet localhost 6023
>>> est()
Execution engine status
time()-engine.start_time : 8.62972998619
engine.has_capacity() :         False
len(engine.downloader.active) :         16
engine.scraper.is_idle() :      False
engine.spider.name :        followall
engine.spider_is_idle(engine.spider) :      False
engine.slot.closing :       False
len(engine.slot.inprogress) :       16
len(engine.slot.scheduler.dqs or []) :      0
len(engine.slot.scheduler.mqs) :        92
len(engine.scraper.slot.queue) :        0
len(engine.scraper.slot.active) :       0
engine.scraper.slot.active_size :       0
engine.scraper.slot.itemproc_size :         0
engine.scraper.slot.needs_backout() :   False

For more information, please refer to the official document.

The second method seems a little simpler. You can get get the status of crawler through the following method:

    self.crawler.stats.get_stats() 
or 
    spider.crawler.stats.get_stats()

So, just print out the status as you like.

like image 170
zczhuohuo Avatar answered Nov 27 '25 15:11

zczhuohuo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!