【发布时间】:2018-11-21 03:03:30
【问题描述】:
我有一个只能同步工作的 powershell 函数。我想更新此函数,以便可以并行触发对 Python 脚本的多个调用。有没有人知道如何使用 powershell 异步调用 Python 脚本,记住每个 Python 脚本本质上都是一个 while 循环,直到 24 小时过去才会结束。 powershell 函数接受远程机器、python 虚拟环境、python 脚本的路径和参数。
这是目前为止所做的:
function Run-Remote($computerName, $pname, $scriptPath, $pargs)
{
$cred = Get-QRemote-Credential
Invoke-Command -ComputerName $computerName -Credential $cred -ScriptBlock {powershell -c "$Using:pname '$Using:scriptPath' $Using:pargs"} -ConfigurationName QRemoteConfiguration
}
【问题讨论】:
标签: python function powershell parallel-processing asynchronous