如何从 HPC 集群中获取完整的作业名称
How to get full job name from HPC cluster
我需要从 HPC 集群获取作业名称。
我是 运行 通过 powershell 命令:
Hpc>powershell -command "& {&'Add-PSSnapIn' Microsoft.HPC}"; "& {&'Get-HpcJob' -Scheduler il-winhpc4}"
我得到了列表,但无论我做什么 - 名字只是字符数,不是全名。
有任何想法吗?
Id Name State Owner Priority NumberOfTask s
-- ---- ----- ----- -------- ------------
5323613 Deploy ... Running WINHPC4\tfsbuild 30
5323614 Deploy ... Running WINHPC4\tfsbuild 30
5323643 Deploy ... Running WINHPC4\tfsbuild 30
如此处的详细说明:https://poshoholic.com/2010/11/11/powershell-quick-tip-creating-wide-tables-with-powershell/,PowerShell 输出格式化程序正在尝试获取您的输出并适合控制台供您阅读。
您可以通过三个主要选项来更改此设置; Format-Table -AutoSize | Out-String -Width nnnn
、Format-List
或 ConvertTo-Json
:
外链:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Format-Table -Auto | Out-String -Width 4000"
# The same kind of table you have, but with horizontal scrolling.
格式列表:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Format-List"
Id: 5323613
Name: Deploy thing to place
State: running
ConvertTo-Json(或其他机器可读格式,如 XML):
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | ConvertTo-Json"
[
{
"Id": 5323613,
"Name": "Deploy thing to place",
"State": "Running"
},
..
]
这是假设您需要所有其他信息。如果你不这样做,也许你可以这样做:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Select-Object Id, Name"
或
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Select-Object -ExpandProperty Name"
注意。您不需要像您拥有的那样多的 &{&'';&{&'
之类的东西。我想你根本不需要。
我需要从 HPC 集群获取作业名称。 我是 运行 通过 powershell 命令:
Hpc>powershell -command "& {&'Add-PSSnapIn' Microsoft.HPC}"; "& {&'Get-HpcJob' -Scheduler il-winhpc4}"
我得到了列表,但无论我做什么 - 名字只是字符数,不是全名。 有任何想法吗?
Id Name State Owner Priority NumberOfTask s
-- ---- ----- ----- -------- ------------
5323613 Deploy ... Running WINHPC4\tfsbuild 30
5323614 Deploy ... Running WINHPC4\tfsbuild 30
5323643 Deploy ... Running WINHPC4\tfsbuild 30
如此处的详细说明:https://poshoholic.com/2010/11/11/powershell-quick-tip-creating-wide-tables-with-powershell/,PowerShell 输出格式化程序正在尝试获取您的输出并适合控制台供您阅读。
您可以通过三个主要选项来更改此设置; Format-Table -AutoSize | Out-String -Width nnnn
、Format-List
或 ConvertTo-Json
:
外链:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Format-Table -Auto | Out-String -Width 4000"
# The same kind of table you have, but with horizontal scrolling.
格式列表:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Format-List"
Id: 5323613
Name: Deploy thing to place
State: running
ConvertTo-Json(或其他机器可读格式,如 XML):
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | ConvertTo-Json"
[
{
"Id": 5323613,
"Name": "Deploy thing to place",
"State": "Running"
},
..
]
这是假设您需要所有其他信息。如果你不这样做,也许你可以这样做:
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Select-Object Id, Name"
或
powershell -command "Add-PSSnapIn Microsoft.HPC; Get-HpcJob -Scheduler il-winhpc4 | Select-Object -ExpandProperty Name"
注意。您不需要像您拥有的那样多的 &{&'';&{&'
之类的东西。我想你根本不需要。