in submitit/core/core.py [0:0]
def batch(self) -> tp.Iterator[None]:
if self._delayed_batch is not None:
raise RuntimeError('Nesting "with executor.batch()" contexts is not allowed.')
self._delayed_batch = []
try:
yield None
except Exception as e:
logger.get_logger().error(
'Caught error within "with executor.batch()" context, submissions are dropped.\n '
)
if isinstance(e, AttributeError):
logger.get_logger().error(
'Note that accesssing jobs attributes is forbidden within "with executor.batch()" context'
)
raise e
finally:
delayed_batch = self._delayed_batch
self._delayed_batch = None
if not delayed_batch:
warnings.warn(
'No submission happened during "with executor.batch()" context.', category=RuntimeWarning
)
return
jobs, submissions = zip(*delayed_batch)
new_jobs = self._internal_process_submissions(submissions)
for j, new_j in zip(jobs, new_jobs):
j.__dict__.update(new_j.__dict__) # fill in the empty shell, the pickle way