diff --git a/mp_api/client/contribs/client.py b/mp_api/client/contribs/client.py index 0b6e4bd1..fa3429c7 100644 --- a/mp_api/client/contribs/client.py +++ b/mp_api/client/contribs/client.py @@ -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 @@ -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()