class_docstr: Implementation for running pytest with distributed execution.
  
  There are 2 parameters that can be modified:
      - world_size: Union[int,List[int]] = 2 -- the number of processes to launch
      - backend: Literal['nccl','mpi','gloo'] = 'nccl' -- which backend to use
  
  Features:
      - able to call pytest.skip() inside tests
      - works with pytest fixtures, parametrize, mark, etc.
      - can contain multiple tests (each of which can be parametrized separately)
      - class methods can be fixtures (usable by tests in this class only)
      - world_size can be changed for individual tests using @pytest.mark.world_size(world_size)
      - class_tmpdir is a fixture that can be used to get a tmpdir shared among
        all tests (including DistributedFixture)
  
  Usage:
      - class name must start with "Test"
      - must implement one or more test*(self, ...) methods
  
  Example:
      @pytest.fixture(params=[10,20])
      def val1(request):
          return request.param
  
      @pytest.mark.fast
      @pytest.mark.parametrize("val2", [30,40])
      class TestExample(DistributedTest):
          world_size = 2
  
          @pytest.fixture(params=[50,60])
          def val3(self, request):
              return request.param
  
          def test_1(self, val1, val2, str1="hello world"):
              assert int(os.environ["WORLD_SIZE"]) == self.world_size
              assert all(val1, val2, str1)
  
          @pytest.mark.world_size(1)
          @pytest.mark.parametrize("val4", [70,80])
          def test_2(self, val1, val2, val3, val4):
              assert int(os.environ["WORLD_SIZE"]) == 1
              assert all(val1, val2, val3, val4)
class_docstr_tok: ["Implementation","for","running","pytest","with","distributed","execution",".","There","are","2","parameters","that","can","be","modified",":","-","world_size",":","Union","[","int",",","List","[","int","]","]","=","2","--","the","number","of","processes","to","launch","-","backend",":","Literal","[","'nccl","'",",","'mpi","'",",","'gloo","'","]","=","'nccl","'","--","which","backend","to","use","Features",":","-","able","to","call","pytest.skip","(",")","inside","tests","-","works","with","pytest","fixtures",",","parametrize",",","mark",",","etc",".","-","can","contain","multiple","tests","(","each","of","which","can","be","parametrized","separately",")","-","class","methods","can","be","fixtures","(","usable","by","tests","in","this","class","only",")","-","world_size","can","be","changed","for","individual","tests","using","@","pytest.mark.world_size","(","world_size",")","-","class_tmpdir","is","a","fixture","that","can","be","used","to","get","a","tmpdir","shared","among","all","tests","(","including","DistributedFixture",")","Usage",":","-","class","name","must","start","with","``","Test","''","-","must","implement","one","or","more","test","*","(","self",",","...",")","methods","Example",":","@","pytest.fixture","(","params=","[","10,20","]",")","def","val1","(","request",")",":","return","request.param","@","pytest.mark.fast","@","pytest.mark.parametrize","(","``","val2","''",",","[","30,40","]",")","class","TestExample","(","DistributedTest",")",":","world_size","=","2","@","pytest.fixture","(","params=","[","50,60","]",")","def","val3","(","self",",","request",")",":","return","request.param","def","test_1","(","self",",","val1",",","val2",",","str1=","''","hello","world","''",")",":","assert","int","(","os.environ","[","``","WORLD_SIZE","''","]",")","==","self.world_size","assert","all","(","val1",",","val2",",","str1",")","@","pytest.mark.world_size","(","1",")","@","pytest.mark.parametrize","(","``","val4","''",",","[","70,80","]",")","def","test_2","(","self",",","val1",",","val2",",","val3",",","val4",")",":","assert","int","(","os.environ","[","``","WORLD_SIZE","''","]",")","==","1","assert","all","(","val1",",","val2",",","val3",",","val4",")"]
code: def run(self, **fixture_kwargs):
      self._current_test(**fixture_kwargs)
  
imports: import os
  import time
  import inspect
  from abc import ABC, abstractmethod
  from pathlib import Path
  import torch
  import torch.multiprocessing
  import deepspeed
  import deepspeed.comm
  from torch.multiprocessing import Process
  import pytest
  from _pytest.outcomes import Skipped
  from _pytest.fixtures import FixtureLookupError, FixtureFunctionMarker
label_desc: Use image node_id 2 for calling the DistributedTest obj's underlying member method code with example usage: obj.run() without return types