在两个嵌套函数中并行化python代码

时间:2019-02-11 15:28:26

标签: python pandas numpy multiprocessing

我想并行化具有这种形式的一些代码:

Invoke-Command -Computername foo -ScriptBlock { 
  Set-Location c:\main-app
  .\app $Args 
} -ArgumentList 'foo', '/last', '/o'

我想使用并行化,而不是for循环,但是我不知道该怎么做,因为在function2中调用了function1,并且for循环遍历了我在function2中预先准备的对象的长度。这种“准备好的东西”不能并行化。
质量应保持顺序。
我正在Linux服务器上工作,设置可以使用的内核数量会很有帮助。
我知道function1 (arg1.1, arg1.2): estimate some model and return it function2 (arg2.1, arg2.2, arg2.3): prepare some stuff quality=[] for i in range(1,len(previously prepared stuff): model=function1(arg1.1=arg2.1, arg1.2=some_other_prepared_stuff_from_function2) q=calculate some quality criterion quality.append[q] return(quality) 包,但是我不知道如何在代码中使用它,因为我是Python的初学者。
一些帮助会很棒!

0 个答案:

没有答案