forked from jasonjinchen/Threading
/
sample.php
40 lines (30 loc) · 943 Bytes
/
sample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include_once 'common.inc.php';
t::clearAll();
$count=100;
$data=range(0, $count);
t::i(null, "Control Thread START");
$test=new MapReduce();
$test->setSize(10);
$test->setMaxThread(100);
$test->passPhraseToChild(true);
$test->setData($data);
$test->setMapperName("data");
$test->setPhraseName("INIT_SUM");
$test->clearReducer();
$test->clearDefaultReducer();
$test->addDefaultReducer("http://cto.gcgchina.com/t/sample.child.php");
$test->addReducer(1,"http://cto.gcgchina.com/t/sample.child.php");
$result=$test->execute(1);
print_r($result);
$test->setData(range(0,$result['result'][0]));
$test->setMapperName("data");
$test->setPhraseName("SUM_SUM");
$test->clearReducer();
$test->clearDefaultReducer();
$test->addDefaultReducer("http://cto.gcgchina.com/t/sample.child.php");
$test->addReducer(2,"http://cto.gcgchina.com/t/sample.child.php");
$result=$test->execute(1);
t::i(null, "Control Thread END");
print_r($result);
?>