Skip to content

Instantly share code, notes, and snippets.

@skshetry
Created March 16, 2021 06:50
Show Gist options
  • Save skshetry/052a69b8dbeea5564d4c65fb73272e30 to your computer and use it in GitHub Desktop.
Save skshetry/052a69b8dbeea5564d4c65fb73272e30 to your computer and use it in GitHub Desktop.
commits = self.iter_commits()
jobs = config["core"].get("jobs")
max_workers = jobs if len(commits) > jobs else len(commits)
index_max_workers = None if jobs / max_workers < 2 else int(jobs / max_workers)
executor = ThreadPoolExecutor(max_workers=max_workers, thread_name_prefix="dvc_collect")
def gen():
for commit in commits:
fs = fs_from_commit(commit)
index = Index(fs, max_threads=index_max_workers)
repo_fs = RepoFS(index, fs)
yield repo_fs
with executor:
results = list(executor.map(collect, gen()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment