Class: BlackStack::MyCrawlProcess
- Inherits:
-
MyLocalProcess
- Object
- MyProcess
- MyChildProcess
- MyLocalProcess
- BlackStack::MyCrawlProcess
- Defined in:
- lib/mycrawlprocess.rb
Overview
process class
Constant Summary
Constants inherited from MyProcess
BlackStack::MyProcess::DEFAULT_MINIMUM_ENLAPSED_SECONDS
Instance Attribute Summary collapse
-
#bot ⇒ Object
Returns the value of attribute bot.
-
#browser ⇒ Object
Returns the value of attribute browser.
-
#nErrors ⇒ Object
Returns the value of attribute nErrors.
-
#nSuccesses ⇒ Object
Returns the value of attribute nSuccesses.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
Attributes inherited from MyProcess
#assigned_division_changed, #assigned_process, #assigned_process_changed, #division_name, #email, #id, #id_client, #id_division, #logger, #minimum_enlapsed_seconds, #password, #verify_configuration, #worker_name, #ws_port, #ws_url
Instance Method Summary collapse
- #canRun? ⇒ Boolean
-
#initialize(the_worker_name, the_division_name, the_minimum_enlapsed_seconds = MyProcess::DEFAULT_MINIMUM_ENLAPSED_SECONDS, the_verify_configuration = true, the_email = nil, the_password = nil) ⇒ MyCrawlProcess
constructor
constructor.
- #whyCantRun ⇒ Object
Methods inherited from MyLocalProcess
#division, #run, #updateWorker, #worker
Methods inherited from MyProcess
#division, #doSleep, fullWorkerName, #fullWorkerName, #get, #hello, kill, #list, macaddress, #notify, #pid, #ping, #process, #run, #set, #updateWorker, #worker
Constructor Details
#initialize(the_worker_name, the_division_name, the_minimum_enlapsed_seconds = MyProcess::DEFAULT_MINIMUM_ENLAPSED_SECONDS, the_verify_configuration = true, the_email = nil, the_password = nil) ⇒ MyCrawlProcess
constructor
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mycrawlprocess.rb', line 9 def initialize( the_worker_name, the_division_name, the_minimum_enlapsed_seconds=MyProcess::DEFAULT_MINIMUM_ENLAPSED_SECONDS, the_verify_configuration=true, the_email=nil, the_password=nil ) super(the_worker_name, the_division_name, the_minimum_enlapsed_seconds, the_verify_configuration, the_email, the_password) self.nErrors = 0 self.nSuccesses = 0 self.browser = nil self.proxy = nil self.bot = nil end |
Instance Attribute Details
#bot ⇒ Object
Returns the value of attribute bot.
6 7 8 |
# File 'lib/mycrawlprocess.rb', line 6 def bot @bot end |
#browser ⇒ Object
Returns the value of attribute browser.
6 7 8 |
# File 'lib/mycrawlprocess.rb', line 6 def browser @browser end |
#nErrors ⇒ Object
Returns the value of attribute nErrors.
6 7 8 |
# File 'lib/mycrawlprocess.rb', line 6 def nErrors @nErrors end |
#nSuccesses ⇒ Object
Returns the value of attribute nSuccesses.
6 7 8 |
# File 'lib/mycrawlprocess.rb', line 6 def nSuccesses @nSuccesses end |
#proxy ⇒ Object
Returns the value of attribute proxy.
6 7 8 |
# File 'lib/mycrawlprocess.rb', line 6 def proxy @proxy end |
Instance Method Details
#canRun? ⇒ Boolean
25 26 27 28 29 30 |
# File 'lib/mycrawlprocess.rb', line 25 def canRun?() super && nErrors < Params.getValue("crawl.company.discretion.max_errors") && nSuccesses < Params.getValue("crawl.company.discretion.max_successes") #(Params.getValue("crawl.company.use_proxy")==false || Company.availableProxiesWithDiscretionForCrawl() > 0) end |
#whyCantRun ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mycrawlprocess.rb', line 32 def whyCantRun() ret = super if (ret.to_s.size == 0) if (self.nErrors >= Params.getValue("crawl.company.discretion.max_errors")) return "Reached the max number of errors (#{self.nErrors.to_s})" end if (self.nSuccesses >= Params.getValue("crawl.company.discretion.max_successes")) return "Reached the max number of successes (#{self.nSuccesses.to_s})" end end return ret end |