Here is a sample code for submission filter, which may help
https://github.com/Azure-Samples/hpcpack-samples/tree/master/Scheduler/Filters/exe/Submission%20JobSize
HPC pack 2019 job submission filters doesn't work
Hello, everyone,
I am using HPC Pack 2019, and I want to add a submission filter (filter.bat) in HPC Cluster Manager-Options-Job Scheduler Configuration-Filter , to make changes to job property values by modifying the job XML file, such like Priority, RequestedNodes, OrderBy, etc.
In this page https://learn.microsoft.com/en-us/powershell/high-performance-computing/understanding-activation-and-submission-filters?view=hpc19-ps, I knew the job submission filter should return an exit code 0 or 1. So I wrote the filter.bat and filter.ps1 like below:
filter.bat
REM @ echo off
set pscmdline='PowerShell .\filter.ps1 ""%1""'
for /f %%a in (%pscmdline%) do ( set var=%%a)
set CODE=%var%
exit /b %CODE%
endlocal
filter.ps1
param($xml)
$xmlAttr = New-Object -TypeName XML
$xmlAttr.Load($xml)$CsvPath = (Split-Path -Parent $MyInvocation.MyCommand.Definition) + "\NodeValue.csv"
$csvdata = Import-Csv $CsvPathforeach ($f in $csvdata) {
if ( $f.Metric -eq "HPCCoresInUse" -and $f.Value -eq 0 ) {
$xmlAttr.Job.Priority="Normal"
$xmlAttr.Save($xml)
return 1
}
}
return 0
But when I submitted a job, it failed at once with the error "The Job has encountered an error: "An unexpected exception occurred while validating the job. Please try submitting the job later. If the problem persists, please contact your system administrator or check the HPC Server event log for more details.""
I also tried to convert to the filter.ps1 to filter.exe, but it also failed when I submitted a job with another error "Submission Filter timed out after 15000ms"
I also wrote an job activation filters in the same way, and it works very well. What can I do to solve this problem? Thanks.
Azure Virtual Machines
1 answer
Sort by: Most helpful
-
Chenling Zhang 76 Reputation points
2021-12-06T09:16:55.403+00:00