Suppose we have a library A
witch behavior depends on value of some
environment variable. A_CONFIG_PATH
actually. Some of my tasks use
this library with different A_CONFIG_PATH
for each task. I do it in a
way of
import os
import A
def task(**kw):
os.environ['A_CONFIG_PATH'] = '/home/me/current/task/config/path'
A.do_some_stuff(kw)
This fine until all tasks process synchronously. But now I need concurrency in this tasks processing.
So how I can guarantee that each task will not corrupt another with its own A_CONFIG_PATH if I run each task in separate thread/process or something like this.