Mark Dickinson <dicki...@gmail.com> added the comment:

Sorry Rahul: I'm not the right person to help you push this forward.

I'm sympathetic to the problem: I've encountered similar issues in "Real Code", 
where we needed to associate log outputs generated by worker pool threads with 
the actual tasks that generated those logs. But I'm not convinced either that 
setting the thread name is the right mechanism to get that association (it 
doesn't extend nicely to other executor types, for example), or that the API 
you propose is the right one (I find the duplication between `submit` and 
`submit_with_name` to be a bit much).

I'm wondering whether there's some way that executors could use contextvars to 
provide a per-task context. Then a task "name" could potentially be part of 
that context, and possibly you could write a custom log handler that read the 
name from the context when emitting log messages.

If you want to find someone to help push this forward, it may be worth posting 
on the python-ideas mailing list to get discussion going.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45689>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to