# Buggy code
def _reproduce(
    self, executors: dict, jobs: Optional[int] = 1
) -> Mapping[str, Mapping[str, str]]:
    """Run dvc repro for the specified BaseExecutors in parallel.

    Returns:
        dict mapping stash revs to the successfully executed experiments
        for each stash rev.
    """
    result: Dict[str, Dict[str, str]] = defaultdict(dict)

    manager = Manager()
    pid_q = manager.Queue()
    with ProcessPoolExecutor(max_workers=jobs) as workers:
        futures = {}
        for rev, executor in executors.items():
            future = workers.submit(
                executor.reproduce,
                executor.dvc_dir,
                pid_q,
                rev,
                name=executor.name,
            )
            futures[future] = (rev, executor)

        try:
            wait(futures)
        except KeyboardInterrupt:
            # forward SIGINT to any running executor processes and
            # cancel any remaining futures
            pids = {}
            while not pid_q.empty():
                rev, pid = pid_q.get()
                pids[rev] = pid
            for future, (rev, _) in futures.items():
                if future.running():
                    os.kill(pids[rev], signal.SIGINT)
                elif not future.done():
                    future.cancel()

        for future, (rev, executor) in futures.items():
            rev, executor = futures[future]
            exc = future.exception()

            try:
                if exc is None:
                    exp_hash, force = future.result()
                    result[rev].update(
                        self._collect_executor(executor, exp_hash, force)
                    )
                else:
                    # Checkpoint errors have already been logged
                    if not isinstance(exc, CheckpointKilledError):
                        logger.exception(
                            "Failed to reproduce experiment '%s'",
                            rev[:7],
                            exc_info=exc,
                        )
            except CancelledError:
                logger.error(
                    "Cancelled before attempting to reproduce experiment '%s'",
                    rev[:7],
                )
            finally:
                executor.cleanup()

    return result


# Traceback (FileNotFoundError)
Adding '.dvc/config.local' to '.dvc/.gitignore'.
Adding '.dvc/tmp' to '.dvc/.gitignore'.
Adding '.dvc/experiments' to '.dvc/.gitignore'.
Adding '.dvc/cache' to '.dvc/.gitignore'.
Check for update is enabled.
assuming default target 'dvc.yaml'.
fetched: [(3,)]
Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66'
Patching experiment workspace
Removing '/tmp/tmp8e9_4d6f'
Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Stashed experiment 'f951c9d' for future execution.
Reproducing experiment revs 'f951c9d'
Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166'
Writing '/tmp/tmpmml3mawm/.dvc/config'.
Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'.
Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
fetched: [(7583,)]
unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
------------------------------------------------------------
Traceback (most recent call last):
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main
ret = cmd.run()
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run
**self._repro_kwargs,
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run
return run(self.repo, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper
return f(repo, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run
target=target, params=params, **kwargs
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one
results = self.reproduce([stash_rev], keep_stash=False)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper
return f(exp, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce
checkpoint_reset=checkpoint_reset,
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__
self._config(cache_dir)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config
with open(local_config, "w") as fobj:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
------------------------------------------------------------
Adding '.dvc/config.local' to '.dvc/.gitignore'.
Adding '.dvc/tmp' to '.dvc/.gitignore'.
Adding '.dvc/experiments' to '.dvc/.gitignore'.
Adding '.dvc/cache' to '.dvc/.gitignore'.
Version info for developers:
DVC version: 1.10.2 (pip)
---------------------------------
Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid
Supports: gs, http, https
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/nvme0n1p2
Caches: local
Remotes: local
Workspace directory: ext4 on /dev/nvme0n1p2
Repo: dvc (subdir), git

# Fixed code
def _reproduce(
    self, executors: dict, jobs: Optional[int] = 1
) -> Mapping[str, Mapping[str, str]]:
    """Run dvc repro for the specified BaseExecutors in parallel.

    Returns:
        dict mapping stash revs to the successfully executed experiments
        for each stash rev.
    """
    result: Dict[str, Dict[str, str]] = defaultdict(dict)

    manager = Manager()
    pid_q = manager.Queue()

    rel_cwd = relpath(os.getcwd(), self.repo.root_dir)
    with ProcessPoolExecutor(max_workers=jobs) as workers:
        futures = {}
        for rev, executor in executors.items():
            future = workers.submit(
                executor.reproduce,
                executor.dvc_dir,
                pid_q,
                rev,
                name=executor.name,
                rel_cwd=rel_cwd,
                log_level=logger.getEffectiveLevel(),
            )
            futures[future] = (rev, executor)

        try:
            wait(futures)
        except KeyboardInterrupt:
            # forward SIGINT to any running executor processes and
            # cancel any remaining futures
            pids = {}
            while not pid_q.empty():
                rev, pid = pid_q.get()
                pids[rev] = pid
            for future, (rev, _) in futures.items():
                if future.running():
                    os.kill(pids[rev], signal.SIGINT)
                elif not future.done():
                    future.cancel()

        for future, (rev, executor) in futures.items():
            rev, executor = futures[future]
            exc = future.exception()

            try:
                if exc is None:
                    exp_hash, force = future.result()
                    result[rev].update(
                        self._collect_executor(executor, exp_hash, force)
                    )
                else:
                    # Checkpoint errors have already been logged
                    if not isinstance(exc, CheckpointKilledError):
                        logger.exception(
                            "Failed to reproduce experiment '%s'",
                            rev[:7],
                            exc_info=exc,
                        )
            except CancelledError:
                logger.error(
                    "Cancelled before attempting to reproduce experiment '%s'",
                    rev[:7],
                )
            finally:
                executor.cleanup()

    return result