Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions mp_api/client/contribs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,9 +1913,13 @@ def submit_contributions(
updating. Set list entries to `None` for components that are to be left untouched
during an update.

It is possible to quickly run Out Of Memory in the case of large/many contributions.
It is recommended to chunk your uploads to a reasonable size based on your machine capabilities
and contribution size.

Args:
contributions (list): list of contribution dicts to submit
ignore_dupes (bool): force duplicate components to be submitted
ignore_dupes (bool): force duplicate components to be submitted. If your contributions intentionally share components, set this to True.
timeout (int): cancel remaining requests if timeout exceeded (in seconds)
skip_dupe_check (bool): skip duplicate check for contribution identifiers

Expand All @@ -1925,10 +1929,15 @@ def submit_contributions(
Raises:
MPContribsClientError on malformed submitted data.
"""
if not contributions or not isinstance(contributions, list):
if not contributions:
raise MPContribsClientError(
"Please provide list of contributions to submit."
)
many_contribs_flag = 5000
if len(contributions) > many_contribs_flag:
MPCC_LOGGER.warning(
msg=f"Large number of contributions detected (>{many_contribs_flag}). OOM may occur. Batching recommended."
)

# get existing contributions
tic = time.perf_counter()
Expand Down
Loading