简体   繁体   English

在 Hadoop 中,如果 mapper 或 reducer 清理方法失败会发生什么

[英]In Hadoop, what happens if the mapper or reducer cleanup method fails

Referring to this method: https://hadoop.apache.org/docs/r2.8.5/api/org/apache/hadoop/mapreduce/Mapper.html#cleanup(org.apache.hadoop.mapreduce.Mapper.Context)参考这个方法: https : //hadoop.apache.org/docs/r2.8.5/api/org/apache/hadoop/mapreduce/Mapper.html#cleanup(org.apache.hadoop.mapreduce.Mapper.Context)

  • If the mapper/reducer cleanup method fails, does the mapper/reducer task fail?如果mapper/reducer清理方法失败,mapper/reducer任务是否失败?
  • If the mapper/reducer cleanup method fails, will Hadoop retry the entire task?如果 mapper/reducer 清理方法失败,Hadoop 会重试整个任务吗?

Thanks谢谢

Applications can override the cleanup(Context) method to perform any required cleanup.应用程序可以覆盖 cleanup(Context) 方法来执行任何需要的清理。

It shall be called per Mapper task or Reducer task.每个 Mapper 任务或 Reducer 任务都会调用它。 The cleanup method shall be called at the end of each task.清理方法应在每个任务结束时调用。 If there are N mappers in execution, the corresponding cleanup will be called N times and in case if you are running M reducers in the code, it shall be invoked M times.如果有 N 个映射器在执行,则相应的清理将被调用 N 次,如果您在代码中运行 M 个减速器,它将被调用 M 次。

cleanup can be used to free the allocated memory or delete the temporary file/directory or other processing as per requirement(Like, context.write(key, value) can be used to emit a value from the cleanup method of mapper and it will be sent to reducers) cleanup 可用于释放分配的内存或删除临时文件/目录或根据要求进行其他处理(例如,context.write(key, value) 可用于从 mapper 的清理方法中发出值,它将被发送到减速器)

If the mapper/reducer cleanup method fails, does the mapper/reducer task fail?如果mapper/reducer清理方法失败,mapper/reducer任务是否失败?

If the mapper/reducer cleanup method fails, will Hadoop retry the entire task?如果 mapper/reducer 清理方法失败,Hadoop 会重试整个任务吗?

If task could not cleanup (in exception block), a separate task will be launched with same attempt-id to do the cleanup.如果任务无法清理(在异常块中),将使用相同的尝试 ID 启动一个单独的任务来进行清理。

Refer to this link for more information : https://hadoop.apache.org/docs/r2.8.5/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html有关更多信息,请参阅此链接: https : //hadoop.apache.org/docs/r2.8.5/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM