parameters: (self,
                   cur_rank,
                   max_run_times,
                   max_slot_times,
                   role=None,
                   node_type='Compute',
                   task_id=None,
                   ops=None,
                   program=None)
docstring: :param cur_rank (int): Current rank of the task node.
          :param max_run_times (int): The max run times of the task node.
          :param max_slot_times (int): The mas slot times of the task node.
          :param role (int): The role of the task node.
          :param node_type (str): The type of the task node, default is 'Compute'
          :param task_id (int): The task id of the task node.
          :param ops (list): A list of op.desc to init the task node.
          :param program (Program): An instance of Program to init the task node.
docstring_summary: :param cur_rank (int): Current rank of the task node.
          :param max_run_times (int): The max run times of the task node.
          :param max_slot_times (int): The mas slot times of the task node.
          :param role (int): The role of the task node.
          :param node_type (str): The type of the task node, default is 'Compute'
          :param task_id (int): The task id of the task node.
          :param ops (list): A list of op.desc to init the task node.
          :param program (Program): An instance of Program to init the task node.
docstring_tokens: : param cur_rank ( int ) : Current rank of the task node . : param max_run_times ( int ) : The max run times of the task node . : param max_slot_times ( int ) : The mas slot times of the task node . : param role ( int ) : The role of the task node . : param node_type ( str ) : The type of the task node default is Compute : param task_id ( int ) : The task id of the task node . : param ops ( list ) : A list of op . desc to init the task node . : param program ( Program ) : An instance of Program to init the task node .
function: def __init__(self,
                   cur_rank,
                   max_run_times,
                   max_slot_times,
                   role=None,
                   node_type='Compute',
                   task_id=None,
                   ops=None,
                   program=None):
          """
          :param cur_rank (int): Current rank of the task node.
          :param max_run_times (int): The max run times of the task node.
          :param max_slot_times (int): The mas slot times of the task node.
          :param role (int): The role of the task node.
          :param node_type (str): The type of the task node, default is 'Compute'
          :param task_id (int): The task id of the task node.
          :param ops (list): A list of op.desc to init the task node.
          :param program (Program): An instance of Program to init the task node.
          """
          # NOTE: ops should be checked by `is not None`, since it may be empty list
          assert ((ops is not None) ^ (program is not None)), \
              "Should provide only one of ops or program to task node."
          if not self.previous:
              self.previous = 'program' if program else 'ops'
          assert (program is not None and self.previous == 'program') or \
                 (ops is not None and self.previous == 'ops'), \
                 "In one program, task node should be inited in the same way, all by ops or all by program."
          if ops is not None:
              assert role is not None and task_id is not None, \
                  "If init task node with ops, should provide `role` and `task_id`."
              self.node = core.TaskNode(role, ops, cur_rank,
                                        int(task_id), max_run_times,
                                        max_slot_times)
              print("Creating task node by ops. The role is:",
                    self.role(), "and the id is:", self.task_id())
          else:
              self.program = program
              self.node = core.TaskNode(program.desc, cur_rank, max_run_times,
                                        max_slot_times)
              print("Creating task node by program. The id is:", self.task_id())
          self.node.set_type(node_type)
function_tokens: def __init__ ( self , cur_rank , max_run_times , max_slot_times , role = None , node_type = 'Compute' , task_id = None , ops = None , program = None ) : # NOTE: ops should be checked by `is not None`, since it may be empty list assert ( ( ops is not None ) ^ ( program is not None ) ) , "Should provide only one of ops or program to task node." if not self . previous : self . previous = 'program' if program else 'ops' assert ( program is not None and self . previous == 'program' ) or ( ops is not None and self . previous == 'ops' ) , "In one program, task node should be inited in the same way, all by ops or all by program." if ops is not None : assert role is not None and task_id is not None , "If init task node with ops, should provide `role` and `task_id`." self . node = core . TaskNode ( role , ops , cur_rank , int ( task_id ) , max_run_times , max_slot_times ) print ( "Creating task node by ops. The role is:" , self . role ( ) , "and the id is:" , self . task_id ( ) ) else : self . program = program self . node = core . TaskNode ( program . desc , cur_rank , max_run_times , max_slot_times ) print ( "Creating task node by program. The id is:" , self . task_id ( ) ) self . node . set_type ( node_type )