You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been using Loky to do some batch-processing on a supercomputer. So far this has worked well. This library has saved me a significant amount of time. However, I'm now running into an issue.
As far as my understanding on Loky goes each job submitted runs in a pool of worker processes outside of the main-process.
I'm wondering if the stdout / stderr of each job submitted to the reusable worker pool can be captured to a separate file. Currently it's being spewed out on the main process, either on stdout/stderr or the python logger, but this is making individual jobs hard to debug as I'm crunching through thousands of jobs over the course of a few days resulting in gigabytes of logging to be produced in a single file.
Here's a short code example on what I'm trying to achieve.
importsysfromlokyimportget_reusable_executor, wrap_non_picklable_objectsfromloky.backend.contextimportget_context, set_start_methodclassJob():
def__init__(self, jid):
self.id=jid@wrap_non_picklable_objectsdef_loky_run_job(job):
# stdout / stderr produced when this code runs needs to be intercepted to separate files# and not dumped on the main process console or python loggererrors= []
try:
print('job runs here')
exceptException:
# catch exceptions in case the job failsexc_type, _, trace=sys.exc_info()
exc_info=traceback.format_exc()
trace=traceback.extract_tb(trace, 1)[0]
print('LokyExecution encountered exception ({}) during execution:\n{}'.format(exc_type.__name__, exc_info))
errors.append((exc_type.__name__, exc_info, trace[0], trace[1]))
returnjob.id, errorsnr_of_workers=2executor=get_reusable_executor(
max_workers=nr_of_workers,
timeout=3600, # respawn workers after 1 hour of inactivityreuse=True,
)
jobs= [Job(jid) forjidinrange(1, 1000)]
futures= [executor.submit(_loky_run_job, job) forjobinjobs]
The text was updated successfully, but these errors were encountered:
Hi, I've been using Loky to do some batch-processing on a supercomputer. So far this has worked well. This library has saved me a significant amount of time. However, I'm now running into an issue.
As far as my understanding on Loky goes each job submitted runs in a pool of worker processes outside of the main-process.
I'm wondering if the stdout / stderr of each job submitted to the reusable worker pool can be captured to a separate file. Currently it's being spewed out on the main process, either on stdout/stderr or the python logger, but this is making individual jobs hard to debug as I'm crunching through thousands of jobs over the course of a few days resulting in gigabytes of logging to be produced in a single file.
Here's a short code example on what I'm trying to achieve.
The text was updated successfully, but these errors were encountered: