more meaningful message

if add_xxx (Results) does not find matching datasets, inform the user
about this fact instead of saying
TypeError: object of type 'IMapUnorderedIterator' has no len()
This commit is contained in:
Martin Diehl 2020-08-27 00:14:37 +02:00
parent b9f1421c6b
commit c5761831e2
1 changed files with 4 additions and 0 deletions

View File

@ -1065,6 +1065,10 @@ class Result:
lock = mp.Manager().Lock()
groups = self.groups_with_datasets(datasets.values())
if len(groups) == 0:
print('No matching dataset found, no data was added.')
return
default_arg = partial(self._job,func=func,datasets=datasets,args=args,lock=lock)
for result in util.show_progress(pool.imap_unordered(default_arg,groups),len(groups)):