我们在多台服务器上安装了 Alteryx,并且希望能够从命令行或 powershell 远程运行作业,而不是通过 Alteryx API。
多年来,我一直在本地从命令行和 powershell 在本地运行 alteryx 流,但现在使用多台服务器,我们需要以这种方式执行某些流,但要从 react Web 应用程序触发。我们尝试了 API,它可以工作,但作业通常排队太久,我们需要近乎实时的响应,这些作业在几秒钟内运行。我们的解决方案是在 Alteryx API 外部触发,以便在资源过多的工作节点上立即执行。
我们的问题是,当测试在本地运行时运行良好的脚本时,它运行所有其他命令都很好,除了执行 alteryxenginecmd.exe 程序。
如果我将 Start-Process 与 passthru 一起使用,它会生成一个进程,但没有来自 alteryx 作业的输出,也没有检测到错误。如果我使用 Call operator & if failed 说它找不到工作流,那么 alteryxenginecmd.exe 正在触发,但没有读取或接收作为参数运行的流的完整路径。但它在本地运行良好。我已使用凭据强制登录以清除任何凭据问题,但结果没有变化。
我知道 Powershell 有一些奇怪的地方,如果脚本是从远程服务器运行的,可能需要对如何指定命令进行一些调整?
这是我想从远程服务器运行的脚本,它在所示的 4 个场景中的任何一个都可以正常工作
$rundate = (Get-Date -format 'u') -replace "-","" -replace ":","" -replace " ","-"
$Pgm2Run = "\<somepath>\RunScriptRemote\RunRemoteTest2 - NoDB.yxmd"
$Bat2Run = "\\<somepath>\RunScriptRemote\RunRemoteTestJob.bat"
$JobLogFile = "\<somepath>\RunScriptRemote\LogsJob\JobTranscript $rundate.txt"
$ScriptLogFile = "\<somepath>\RunScriptRemote\LogsScript\RunJobTranscript $rundate.txt"
Start-Transcript -Path $ScriptLogFile
echo " "
echo "$rundate Start --> "
Echo "$rundate Before Start-Process"
#1 Start-Process -filepath "AlteryxEngineCmd.exe" -ArgumentList `"$Pgm2Run`" -RedirectStandardOutput $JobLogFile -Wait -PassThru
#2 Start-Process -filepath $Bat2Run -RedirectStandardOutput $JobLogFile -Wait -PassThru
#3 & AlteryxEngineCmd.exe "$Pgm2Run"
AlteryxEngineCmd.exe "$Pgm2Run"
echo "$rundate After Start-Process"
echo "$rundate End --> "
Stop-Transcript
此命令在 Server1 上运行以在 server2 上执行上述脚本
Invoke-Command -ComputerName server2 -FilePath "\\<somepath>\RunScriptRemote\RunAlteryxAndLogIt.ps1"
这是结果:
20200831-094309Z Before Start-Process
AlteryxEngineCmd.exe Version 2019.4.8.22007 © Alteryx, Inc. - All Rights Reserved.
Started running \\<somepath>\RunRemoteTest2 - NoDB.yxmd
Error - Alteryx Engine: Can't read the file "
Invoke-Command -ComputerName server2 -FilePath "\\<somepath>\RunScriptRemote\RunRemoteTest2 - NoDB.yxmd"
Finished in 0.020 seconds with 1 error
20200831-094309Z After Start-Process
我不确定这是一个 powershell 的东西,它很可能是一个 Alteryx 的东西,因为这个问题似乎正在正确执行那个 exe。该脚本从远程服务器正确触发,我测试了其他命令并且一切正常,我似乎无法让执行此 exe 的人在远程运行时工作,尽管在本地运行相同的脚本时它在本地工作正常。它就像一个脚本运行另一个脚本的障碍。
任何熟悉从另一台服务器远程运行 exe 的 powershell 专家?