diff --git a/paddle/fluid/train/custom_trainer/feed/accessor/epoch_accessor.cc b/paddle/fluid/train/custom_trainer/feed/accessor/epoch_accessor.cc index cd73f918eaa44fe645a2efc0314bc577e6845864..1773c05666dca18e18d4f2fe9f041e1c4635c3bf 100755 --- a/paddle/fluid/train/custom_trainer/feed/accessor/epoch_accessor.cc +++ b/paddle/fluid/train/custom_trainer/feed/accessor/epoch_accessor.cc @@ -49,11 +49,15 @@ namespace feed { set_status(EpochStatusFiled::CheckpointPathField, _last_checkpoint_path); set_status(EpochStatusFiled::DateField, format_timestamp(epoch_id, "%Y%m%d-%H%M")); set_status(EpochStatusFiled::InferenceBaseKeyField, _inference_base_model_key); - if (epoch_id > _last_done_epoch_id) { - // 保留末尾1000数据 - auto fs = _trainer_context->file_system.get(); - std::string done_str = paddle::string::join_strings(_done_status, '\t'); - fs->append_line(_done_file_path, done_str, 1000); + + auto* env = _trainer_context->environment.get(); + if (env->is_master_node(EnvironmentRole::WORKER)) { + if (epoch_id > _last_done_epoch_id) { + // 保留末尾1000数据 + auto fs = _trainer_context->file_system.get(); + std::string done_str = paddle::string::join_strings(_done_status, '\t'); + fs->append_line(_done_file_path, done_str, 1000); + } } return 0; }