MCPcopy
hub / github.com/scrapy/scrapy / _send_report

Method _send_report

scrapy/extensions/memusage.py:158–173  ·  scrapy/extensions/memusage.py::MemoryUsage._send_report

send notification mail with some additional useful info

(self, rcpts: list[str], subject: str)

Source from the content-addressed store, hash-verified

156 self.warned = True
157
158 def _send_report(self, rcpts: list[str], subject: str) -> None:
159 class="st">""class="st">"send notification mail with some additional useful info"class="st">""
160 assert self.crawler.engine
161 assert self.crawler.stats
162 stats = self.crawler.stats
163 s = fclass="st">"Memory usage at engine startup : {stats.get_value(&class="cm">#x27;memusage/startup') / 1024 / 1024}M\r\n"
164 s += fclass="st">"Maximum memory usage : {stats.get_value(&class="cm">#x27;memusage/max') / 1024 / 1024}M\r\n"
165 s += fclass="st">"Current memory usage : {self.get_virtual_size() / 1024 / 1024}M\r\n"
166
167 s += (
168 class="st">"ENGINE STATUS ------------------------------------------------------- \r\n"
169 )
170 s += class="st">"\r\n"
171 s += pformat(get_engine_status(self.crawler.engine))
172 s += class="st">"\r\n"
173 self.mail.send(rcpts, subject, s)

Callers 2

_check_limitMethod · 0.95
_check_warningMethod · 0.95

Calls 5

get_virtual_sizeMethod · 0.95
get_engine_statusFunction · 0.90
pformatFunction · 0.85
sendMethod · 0.80
get_valueMethod · 0.45

Tested by

no test coverage detected