class_docstr: Actor to perform distributed training.
class_docstr_tok: ["Actor","to","perform","distributed","training","."]
docstr: Finds a free port on the current node.
docstr_tok: ["Finds","a","free","port","on","the","current","node","."]
code: def find_free_port(self):
      """Finds a free port on the current node."""
      with closing(
          socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      ) as s:
          s.bind(("", 0))
          s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          return s.getsockname()[1]
  
file_path: ray/doc/source/ray-core/examples/lm/ray_train.py
imports: import copy
  import math
  import socket
  import time
  from contextlib import closing
  import fairseq
  from fairseq import options
  from fairseq_cli.train import main
  import ray
label_desc: Use image node_id 4 for calling the RayDistributedActor obj's underlying member method code with example usage: obj.find_free_port() and returns: s