2019独角兽企业重金招聘Python工程师标准>>>

About Projects 关于项目
==============
在大多数情况下,一个项目就是为一个网站编写的脚本
In most cases, a project is one script you write for one website.项目是独立的,但是您可以将另一个项目用`from projects import other_project`的方式导入为模块
* Projects are independent, but you can import another project as a module with `from projects import other_project`
一个项目有五种状态:`TODO`, `STOP`, `CHECKING`, `DEBUG` and `RUNNING`
* A project has 5 status: `TODO`, `STOP`, `CHECKING`, `DEBUG` and `RUNNING`TODO  刚刚创建一个可编辑的脚本- `TODO` - a script is just created to be writtenSTOP  如果您希望项目停止,您可以将项目标记为'STOP'- `STOP` - you can mark a project as `STOP` if you want it to STOP (= =).CHECKING 当正在运行的项目被修改时,为了防止不完整的修改,项目状态将被自动设置为“CHECKING”。- `CHECKING` - when a running project is modified, to prevent incomplete modification, project status will be set as `CHECKING` automatically.DEBUG`/`RUNNING 这两种状态对spider没有区别。但是当它第一次运行时,将它标记为‘DEBUG’,然后在检查之后将其更改为‘RUNNING’。- `DEBUG`/`RUNNING` - these two status have no difference to spider. But it's good to mark it as `DEBUG` when it's running the first time then change it to `RUNNING` after being checked.
爬行速度控制是通过`rate`和`burst`与令牌桶]与[token-bucket](http://en.wikipedia.org/wiki/token_bucket)算法
* The crawl rate is controlled by `rate` and `burst` with [token-bucket](http://en.wikipedia.org/wiki/Token_bucket) algorithm.rate 表示一秒钟有多少请求- `rate` - how many requests in one secondburst 考虑到这种情况,`rate/burst = 0.1/3`,意思是每10s爬取1个网页。当所有任务都完成后,项目每分钟都在检查最后的更新列表。假设有3个新列表,pyspider将“burst”爬3个任务无需等待3×10秒,然而,第四任务需要等待10秒- `burst` - consider this situation, `rate/burst = 0.1/3`, it means that the spider scrawls 1 page every 10 seconds. All tasks are finished, project is checking last updated items every minute. Assume that 3 new items are found, pyspider will "burst" and crawl 3 tasks without waiting 3*10 seconds. However, the fourth task needs wait 10 seconds.
若要删除一个项目,请将“group”设置为“delete”并将状态设置为“STOP”,并等待24小时。
* To delete a project, set `group` to `delete` and status to `STOP`, wait 24 hours.`on_finished` callback
--------------------
你可以在项目中重写“on_finished”方法,当task_queue变成0时该方法将被触发
You can override `on_finished` method in the project, the method would be triggered when the task_queue goes to 0.
例子1:当你开始一个项目去爬取一个网站的100个页面,当100个页面爬取成功或者重试失败的时候,"on_finished"回调方法将被执行
Example 1: When you start a project to crawl a website with 100 pages, the `on_finished` callback will be fired when 100 pages are successfully crawled or failed after retries.
例子2:一个项目在“auto_recrawl”任务时,“on_finished”回调将不会触发,因为当auto_recrawl任务存在时,时间队列不可能变为0.
Example 2: A project with `auto_recrawl` tasks will **NEVER** trigger the `on_finished` callback, because time queue will never become 0 when there are auto_recrawl tasks in it.
例子3:一个项目在在每次新任务提交的时候通过“@every”装饰方法将触发“on_finished”回调。
Example 3: A project with `@every` decorated method will trigger the `on_finished` callback every time when the newly submitted tasks are finished.

转载于:https://my.oschina.net/sijinge/blog/1526542

pyspider爬虫学习-文档翻译-About-Projects.md相关推荐

  1. pyspider爬虫学习-教程2-AJAX-and-more-HTTP.md

    2019独角兽企业重金招聘Python工程师标准>>> Level 2: AJAX and More HTTP =========================== 在上篇文章中, ...

  2. Python3 爬虫学习笔记 C17【爬虫框架 pyspider — 基本使用】

    Python3 爬虫学习笔记第十七章 -- [爬虫框架 pyspider - 基本使用] 文章目录 [17.1]初识 pyspider [17.2]使用 pyspider [17.2.1]主界面 [1 ...

  3. Python3 爬虫学习笔记 C18【爬虫框架 pyspider — 深入理解】

    Python3 爬虫学习笔记第十八章 -- [爬虫框架 pyspider - 深入理解] 文章目录 [18.1]启动参数 [18.2]运行单个组件 [18.2.1]运行 Scheduler [18.2 ...

  4. Python爬虫学习系列教程

    大家好哈,我呢最近在学习Python爬虫,感觉非常有意思,真的让生活可以方便很多.学习过程中我把一些学习的笔记总结下来,还记录了一些自己实际写的一些小爬虫,在这里跟大家一同分享,希望对Python爬虫 ...

  5. python网络爬虫权威指南 豆瓣_豆瓣Python大牛写的爬虫学习路线图,分享给大家!...

    豆瓣Python大牛写的爬虫学习路线图,分享给大家! 今天给大家带来我的Python爬虫路线图,仅供大家参考! 第一步,学会自己安装python.库和你的编辑器并设置好它 我们学习python的最终目 ...

  6. 腾讯云主机Python3环境安装PySpider爬虫框架过程

    利用腾讯云服务器我们可以玩好多的技术,前面的我给大家分享的大多与网站和一些服务有关,今天我给大家分享有关腾讯云主机Python3环境安装PySpider爬虫框架过程 大家好,本篇文章为大家讲解腾讯云主 ...

  7. 新手python爬虫代码_新手小白必看 Python爬虫学习路线全面指导

    爬虫是大家公认的入门Python最好方式,没有之一.虽然Python有很多应用的方向,但爬虫对于新手小白而言更友好,原理也更简单,几行代码就能实现基本的爬虫,零基础也能快速入门,让新手小白体会更大的成 ...

  8. Python爬虫学习系列教程-----------爬虫系列 你值的收藏

    静觅 » Python爬虫学习系列教程:http://cuiqingcai.com/1052.html 大家好哈,我呢最近在学习Python爬虫,感觉非常有意思,真的让生活可以方便很多.学习过程中我把 ...

  9. python3爬虫学习笔记

    文章目录 python3的文本处理 jieba库的使用 统计hamlet.txt文本中高频词的个数 统计三国演义任务高频次数 爬虫 爬取百度首页 爬取京东某手机页面 BeautifulSoup 使用r ...

最新文章

  1. win8 网络 连接计算机名称,win8本地网络联接的名字怎么改
  2. 超越RMI,高效Java remote调用
  3. 记 thoughtworks 的一次面试
  4. iOS 自定义相机,带水印!
  5. 【译】史上最强的vimrc文件
  6. 监控USB设备插入/拔出写法2
  7. 卸载mysql 安装_MySQL萌新第一季 第二话
  8. oracle 计划名称,甲骨文修改合作伙伴计划 分为四个级别
  9. Manthan, Codefest 16
  10. leetcode 1164 python
  11. grid 安装失败 卸载grid 实操
  12. matlab仿真介绍,谈一谈|Matlab仿真项目简介
  13. 搜索引擎 —海量数据搜索
  14. Vs2010激活 系统延长期限
  15. 文本特征提取方法介绍
  16. 计算机辅助审计的应用研究,计算机辅助审计技术在我国的应用状况研究(原稿)...
  17. 极简OpenFoam编程
  18. shader拖尾_拖尾效果 - LouisSong - 博客园
  19. 分布式计算原理之分布式协调与同步(1)——分布式选举
  20. 对称加密非对称加密混合加密

热门文章

  1. 在oracle中怎么判断一个日期是否在一定时间范围内
  2. POJ-2771 Guardian of Decency 最大独立子集
  3. Sublime Text 常用插件和快捷键
  4. CBinsight | 分析101个创业失败案例,我们总结了20大失败原因
  5. IOS纯手写代码支持旋屏
  6. 推荐的 PHP 读物列表
  7. 从Jenkins迁移到Jenkins X:一场持续交付之旅\n
  8. NFS简单应用场景及简单的环境搭建
  9. 第 22 章 DDL - Data Definition Language
  10. C++Primer ch4笔记