code: def test_submitit_respects_main(tmp_path):
      # TODO: I think this is the root cause of issue #11
      # https://github.com/facebookincubator/submitit/issues/11
      # Some programs like pytorch-lightning are dependent on the value of __main__
      # See how `pdb` manage to restore the correct __main__:
      # https://sourcegraph.com/github.com/python/cpython/-/blob/Lib/pdb.py#L1549
      # But maybe we could fix #11 by just using
      # `from submitit.core.submission import submitit_main`
      # as in https://github.com/facebookincubator/submitit/issues/11#issuecomment-713148952
  
      def get_main() -> str:
          # pylint: disable=import-outside-toplevel
          import __main__  # type: ignore
  
          return getattr(__main__, "__file__", "")
  
      main = get_main()
      ex = LocalExecutor(tmp_path)
      j_main = ex.submit(get_main).result()
      assert main == j_main
  
file_path: submitit/submitit/test_pickle.py
imports: import pickle
  from weakref import ref
  import pytest
  from .local.debug import DebugExecutor
  from .local.local import LocalExecutor
label_desc: Use image node_id 6 for calling a global function with example usage: test_submitit_respects_main(tmp_path) and returns: getattr