diff --git a/python/paddle/io/dataloader/dataloader_iter.py b/python/paddle/io/dataloader/dataloader_iter.py index 84260dc90ca56..ed64f5da3d9e9 100644 --- a/python/paddle/io/dataloader/dataloader_iter.py +++ b/python/paddle/io/dataloader/dataloader_iter.py @@ -704,11 +704,10 @@ def _get_data(self): if len(failed_workers) > 0: self._exit_thread_unexpectedly() pids = ', '.join(str(w.pid) for w in failed_workers) - logging.warning( - "DataLoader {} workers exit unexpectedly, " - "pids: {}".format(len(failed_workers), pids) + raise RuntimeError( + f"DataLoader {len(failed_workers)} workers exit unexpectedly, " + f"pids: {pids}" ) - return # get(timeout) will call _poll(timeout) and may raise IOError if isinstance(e, (IOError, queue.Empty)):