code: def train_prog(exe, program, model, pyreader, args):
      trainer_id = int(os.getenv("PADDLE_TRAINER_ID", "0"))
      start = time.time()
      batch = 0
      total_loss = 0.0
      total_acc = 0.0
      total_sample = 0
      for epoch_idx in range(args.num_epoch):
          for step, batch_feed_dict in enumerate(pyreader()):
              try:
                  cpu_time = time.time()
                  batch += 1
                  batch_loss, batch_acc = exe.run(
                      program,
                      feed=batch_feed_dict,
                      fetch_list=[model.loss, model.acc],
                  )
  
                  end = time.time()
                  if batch % args.log_per_step == 0:
                      log.info(
                          "Batch %s Loss %s Acc %s \t Speed(per batch) %.5lf/%.5lf sec"
                          % (
                              batch,
                              np.mean(batch_loss),
                              np.mean(batch_acc),
                              (end - start) / batch,
                              (end - cpu_time),
                          )
                      )
  
                  if step % args.steps_per_save == 0:
                      save_path = args.save_path
                      if trainer_id == 0:
                          model_path = os.path.join(
                              save_path, "%s" % step
                          )
                          fleet.save_persistables(exe, model_path)
              except Exception as e:
                  log.info("Pyreader train error")
                  log.exception(e)
  
file_path: PGL/legacy/examples/distribute_graphsage/cluster_train.py
imports: import argparse
  import time
  import os
  import math
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
  from paddle.fluid.transpiler.distribute_transpiler import DistributeTranspilerConfig
  import paddle.fluid.incubate.fleet.base.role_maker
  from pgl.utils.logger import log
  from model import GraphsageModel
  from utils import load_config
  import reader
label_desc: Use image node_id 5 for calling a global function with example usage: train_prog(exe, program, model, pyreader, args) without return types