如何在eclipse中关闭hadoop源代码中的推测性执行

时间:2017-04-17 15:47:05

标签: java eclipse hadoop hadoop2

我需要在hadoop源代码中关闭它,我在eclipse中找不到它的包。 https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/mapreduce/Job.html#setReduceSpeculativeExecution%28boolean%29

1 个答案:

答案 0 :(得分:2)

如果要禁用推测执行,请在 #include <iostream> #include <string> #include <cctype> using namespace std; int main() { double getaReal(); //function prototype double realnumber; cout << "Enter a number: "; realnumber = getaReal(); cout << "The number entered is a real number: " <<realnumber << endl; return 0; } bool isvalidReal(string str) //function to find real numbers. { int start = 0; int i; bool valid = true; bool sign = false; if (int(str.length()) == 0) valid = false; //check for empty string if (str.at(0) == '-' || str.at(0) == '+') //check for sign { sign = true; start = 1; //check for real num at position 1 } if (sign && int(str.length()) == 1) valid = false; //make sure there's atleast 1 char after the sign i = start; while (valid && i<int(str.length())) { if (!isdigit(str.at(i)) && (str.at(i) != '.')) valid = false; //found a non-digit character i++; // move to next character } return valid; } double getaReal() { bool isvalidReal(string); //function declaration prototype bool isnotreal = true; string input; while (isnotreal) { try { cin >> input; //accepts user input if (!isvalidReal(input)) throw input; } catch (string e) { cout << "No real number has been detected, continue to\n enter string values: "; continue; //continues user input } isnotreal = false; } return atof(input.c_str()); } 中添加这些属性。

mapred-site.xml

或者在作业级别,在Driver类中设置属性。

<property>
   <name>mapreduce.map.speculative</name>
   <value>false</value>
</property>
<property>
   <name>mapreduce.reduce.speculative</name>
   <value>false</value>
</property>

有关其源代码,请参阅:hadoop-mapreduce-projectJobJobConf