-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I have to pass lot of python codes to multiprocessing, how can i achive this
import multiprocessing
#pool = multiprocessing.Pool(joblib.cpu_count())
pool = multiprocessing.Pool(4)
results = pool.map(getScoreForEachMethod, arg_instances[0:100])
pool.close()
pool.join()
def getScoreForEachMethod(arg):
logger_datetime_str = arg[0]
symbolName = arg[1]
symbolId = arg[2]
daily = arg[3]
weekly = arg[4]
monthly = arg[5]
methodId = arg[6]
methodCode = arg[7]
scoreSymbolParams = arg[8]
lot_time = arg[9]
customMethodobject=arg[10]
allowed_param = {
"priceDaily": priceDaily,
"volumeDaily": volumeDaily,
"priceWeekly": priceWeekly,
"volumeWeekly": volumeWeekly,
"priceMonthly": priceMonthly,
"volumeMonthly": volumeMonthly,
"parameters": parameters,
"score": score
}
exec(customMethod,allowed_param)
return allowed_param
so here customMethodobject is the customcode i have to run using exec where i want use seval.
the code is multiline and can use the allowed_params and some arthimetics
HOw can i do this
Metadata
Metadata
Assignees
Labels
No labels