class_docstr: Simulate distributed training.
class_docstr_tok: ["Simulate","distributed","training","."]
docstr: Create a file train{i}.conf with the required configuration to train.
  
  Each worker gets a different port and piece of the data, the rest are the
  model parameters contained in `self.config`.
docstr_tok: ["Create","a","file","train","{","i","}",".conf","with","the","required","configuration","to","train",".","Each","worker","gets","a","different","port","and","piece","of","the","data",",","the","rest","are","the","model","parameters","contained","in","`","self.config","`","."]
code: def write_train_config(self, i: int) -> None:
      """Create a file train{i}.conf with the required configuration to train.
  
      Each worker gets a different port and piece of the data, the rest are the
      model parameters contained in `self.config`.
      """
      with open(TESTS_DIR / f"train{i}.conf", "wt") as file:
          output_model = TESTS_DIR / f"model{i}.txt"
          data = TESTS_DIR / f"train{i}.txt"
          file.write(f"output_model = {output_model}\n")
          file.write(f"local_listen_port = {self.listen_ports[i]}\n")
          file.write(f"data = {data}\n")
          _write_dict(self.train_config, file)
  
imports: import copy
  import io
  import socket
  import subprocess
  from concurrent.futures import ThreadPoolExecutor
  from pathlib import Path
  from typing import Any, Dict, Generator, List
  import numpy
  import pytest
  from sklearn.datasets import make_blobs, make_regression
  from sklearn.metrics import accuracy_score
label_desc: Use image node_id 7 for calling the DistributedMockup obj's underlying member method code with example usage: obj.write_train_config(i) without return types