Verified Commit 15ae7634 authored by Oskar Roesler's avatar Oskar Roesler
Browse files

Add threading at Clone.clone and Pull.pull for now, maybe refactored in the future.

parent 6a86b5af
from git import Repo
from aurci.general import Routines
import os
from concurrent.futures import ThreadPoolExecutor
class Clone(Routines):
......@@ -13,9 +14,10 @@ class Clone(Routines):
def clone(self):
if self.package=="all":
t = ThreadPoolExecutor(max_workers=(os.cpu_count()))
repos = self.gh_organization.get_repos(type="all", sort="full_name", direction="desc")
for repo in repos:
Clone(repo.name, self.verbosity, self.output).cloning()
t.submit(Clone(repo.name, self.verbosity, self.output).cloning)
else:
self.cloning()
......@@ -24,8 +26,9 @@ class Pull(Routines):
def pull(self):
if self.package=="all":
t = ThreadPoolExecutor(max_workers=(os.cpu_count()))
for folder in os.listdir("./packages"):
Pull(folder, self.verbosity, self.output).pull()
t.submit(Pull(folder, self.verbosity, self.output).pull)
else:
repo = Repo(path=self.path)
repo.git.stash()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment