parameters: ()
docstring: This routine forks and execs a new child process and keeps track of its PID. Before we fork,
        set the current restart epoch in an env variable that processes can read if they care.
docstring_summary: This routine forks and execs a new child process and keeps track of its PID. Before we fork,
        set the current restart epoch in an env variable that processes can read if they care.
docstring_tokens: This routine forks and execs a new child process and keeps track of its PID . Before we fork set the current restart epoch in an env variable that processes can read if they care .
function: def fork_and_exec():
      """ This routine forks and execs a new child process and keeps track of its PID. Before we fork,
        set the current restart epoch in an env variable that processes can read if they care. """
  
      global restart_epoch
      os.environ['RESTART_EPOCH'] = str(restart_epoch)
      print("forking and execing new child process at epoch {}".format(restart_epoch))
      restart_epoch += 1
  
      child_pid = os.fork()
      if child_pid == 0:
          # Child process
          os.execl(sys.argv[1], sys.argv[1])
      else:
          # Parent process
          print("forked new child process with PID={}".format(child_pid))
          pid_list.append(child_pid)
function_tokens: def fork_and_exec ( ) : global restart_epoch os . environ [ 'RESTART_EPOCH' ] = str ( restart_epoch ) print ( "forking and execing new child process at epoch {}" . format ( restart_epoch ) ) restart_epoch += 1 child_pid = os . fork ( ) if child_pid == 0 : # Child process os . execl ( sys . argv [ 1 ] , sys . argv [ 1 ] ) else : # Parent process print ( "forked new child process with PID={}" . format ( child_pid ) ) pid_list . append ( child_pid )