2 HCE project, Python bindings, Distributed Tasks Manager application. 3 Event objects definitions. 6 @file ftest_dc_CrawlerTask_batch_processing.py 7 @author Oleksii <developers.hce@gmail.com> 8 @link: http://hierarchical-cluster-engine.com/ 9 @copyright: Copyright © 2013-2014 IOIX Ukraine 10 @license: http://hierarchical-cluster-engine.com/license/ 15 from collections
import namedtuple
16 from subprocess
import Popen
17 from subprocess
import PIPE
22 "http://www.yomiuri.co.jp/sports/mlb/20140407-OYT1T50015.html?from=ytop_top" 26 PYTHON_BINARY=
"/usr/bin/python" 27 CRAWLER_BINARY=
"../../bin/crawler.py" 28 CFG=
"--config=../../ini/crawler.ini" 31 Results = namedtuple(
"Results",
"exit_code output err")
35 input_pickled_object = pickle.dumps(input_object)
36 process = Popen([PYTHON_BINARY, CRAWLER_BINARY, CFG], stdout=PIPE, stdin=PIPE)
37 (output, err) = process.communicate(input=input_pickled_object)
38 exit_code = process.wait()
39 return Results(exit_code, output, err)
42 if __name__ ==
"__main__":
48 generalResponse = pickle.loads(result.output)
50 assert generalResponse.errorCode == GeneralResponse.ERROR_OK
def processFullBatch(input_object)