diff --git a/emmet-cli/emmet/cli/decorators.py b/emmet-cli/emmet/cli/decorators.py index 00351dd20d..854499bd2d 100644 --- a/emmet-cli/emmet/cli/decorators.py +++ b/emmet-cli/emmet/cli/decorators.py @@ -52,7 +52,7 @@ def wrapper(*args, **kwargs): with open(ETAG, "r") as fd: etag = fd.readline().strip() - gists_iterator = gh.gists(etag=etag) + gists_iterator = gh.gists(number=20, etag=etag) if gists_iterator.etag != etag: with open(ETAG, "w") as fd: fd.write(gists_iterator.etag) diff --git a/emmet-cli/emmet/cli/entry_point.py b/emmet-cli/emmet/cli/entry_point.py index 2dd0c2ca8e..ab564b5d79 100644 --- a/emmet-cli/emmet/cli/entry_point.py +++ b/emmet-cli/emmet/cli/entry_point.py @@ -1,10 +1,10 @@ import logging import os -from io import StringIO - import click -from github3 import authorize, login -from multiprocessing_logging import install_mp_handler + +from io import StringIO +from github3 import GitHub +from github3.session import GitHubSession from emmet.cli.admin import admin from emmet.cli.calc import calc @@ -80,6 +80,7 @@ def emmet(spec_or_dbfile, run, issue, sbatch, ntries, bb, yes, no_dupe_check, ve CREDENTIALS = os.path.join(os.path.expanduser("~"), ".emmet_credentials") if not os.path.exists(CREDENTIALS): + from github3 import authorize # TODO not supported anymore user = click.prompt("GitHub Username") password = click.prompt("GitHub Password", hide_input=True) auth = authorize( @@ -94,12 +95,11 @@ def emmet(spec_or_dbfile, run, issue, sbatch, ntries, bb, yes, no_dupe_check, ve with open(CREDENTIALS, "r") as fd: token = fd.readline().strip() - ctx.obj["GH"] = login(token=token) + ctx.obj["GH"] = gh = GitHub(session=GitHubSession(default_read_timeout=30)) + gh.login(token=token) else: click.secho("DRY RUN! Add --run flag to execute changes.", fg="green") - install_mp_handler(logger=logger) - def safe_entry_point(): try: diff --git a/emmet-cli/emmet/cli/tasks.py b/emmet-cli/emmet/cli/tasks.py index 2febeeaa67..0f42f1ba08 100644 --- a/emmet-cli/emmet/cli/tasks.py +++ b/emmet-cli/emmet/cli/tasks.py @@ -432,6 +432,9 @@ def parse(task_ids, snl_metas, nproc, store_volumetric_data): # noqa: C901 f"nmax = {nmax} but chunk size = {chunk_size} -> sequential parsing." ) + from multiprocessing_logging import install_mp_handler + install_mp_handler(logger=logger) + pool = multiprocessing.Pool(processes=nproc) gen = VaspDirsGenerator() iterator = iterator_slice(gen, chunk_size) # process in chunks