class_docstr: wrap_udf_in_torch_dist_launcher()
class_docstr_tok: ["wrap_udf_in_torch_dist_launcher","(",")"]
code: def test_chained_udf(self):
      # test that a chained udf_command is properly handled
      udf_command = (
          "cd path/to && python3.7 path/to/some/trainer.py arg1 arg2"
      )
      wrapped_udf_command = wrap_udf_in_torch_dist_launcher(
          udf_command=udf_command,
          num_trainers=2,
          num_nodes=2,
          node_rank=1,
          master_addr="127.0.0.1",
          master_port=1234,
      )
      expected = (
          "cd path/to && python3.7 -m torch.distributed.run "
          "--nproc_per_node=2 --nnodes=2 --node_rank=1 --master_addr=127.0.0.1 "
          "--master_port=1234 path/to/some/trainer.py arg1 arg2"
      )
      self.assertEqual(wrapped_udf_command, expected)
  
file_path: dgl/tests/tools/test_launch.py
imports: import json
  import os
  import tempfile
  import unittest
  from launch import *
label_desc: Use image node_id 2 for calling the TestWrapUdfInTorchDistLauncher obj's underlying member method code with example usage: obj.test_chained_udf() without return types