Skip to content

Commit

Permalink
client: retry flag, submit docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Jan 22, 2021
1 parent 9ae6a16 commit ea07c70
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,20 @@ def submit_contributions(
contributions,
skip_dupe_check=False,
ignore_dupes=False,
retry=False,
per_page=100,
max_workers=3,
):
"""Convenience function to submit a list of contributions"""
"""Convenience function to submit a list of contributions
Args:
contributions (list): list of contribution dicts to submit
skip_dupe_check (bool): skip check for duplicates of identifiers and components
ignore_dupes (bool): force duplicate components to be submitted
retry (bool): keep trying until all contributions successfully submitted
per_page (int): number of contributions to submit in each chunk/request
max_workers (int): number of parallel requests to use to submit chunk
"""
tic = time.perf_counter()

if max_workers > MAX_WORKERS:
Expand Down Expand Up @@ -532,18 +542,17 @@ def post_future(chunk):

self._run_futures(futures, total=len(contribs))

if existing["unique_identifiers"]:
if existing["unique_identifiers"] and retry:
existing = self.get_contributions(project_name)
contribs = [
c
for c in contribs
if c["identifier"] not in existing["identifiers"]
]
else:
contribs = []
print(
"unique_identifiers=False: Resubmit failed contributions manually."
)
contribs = [] # abort retrying
if not existing["unique_identifiers"] and retry:
print("Please resubmit failed contributions manually.")

self.load()
toc = time.perf_counter()
Expand Down

0 comments on commit ea07c70

Please sign in to comment.