Details
-
Feature
-
Status: Released (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Current Situation
- If jobs are not executed at the planned point in time or if they are late being executed then this information is visible from the "Daily Plan" view.
- Users have to actively check the daily plan for late jobs.
Desired Behavior
- JobScheduler should send a notification about late jobs:
- a job should be available that can be scheduled for repeated execution during the day.
- the information included with the job output corresponds to what is visible from the "Daily Plan" view in JOC Cockpit.
Implementation
- The functionality is available with the Get-JobSchedulerDailyPlan cmdlet:
Get-JSDailyPlan -Late
-
- As a prerequisite the PowerShell Command Line Interface should be available for an Agent with Windows or Linux.
- The job implementation looks like this:
<job title="Report Daily Plan late jobs" process_class="agent_windows"> <script language="powershell"><![CDATA[ Import-Module $env:SCHEDULER_DATA/config/powershell/Modules/JobScheduler; Connect-JS -Url $JOCCockpitUrl -Credential $JOCCockpitCredential | Out-Null; # start mode mapping $startModes = @{"0"="single start"; "1"="repeat start-start"; "2"="repeat end-start"}; # Dates in local time zone, output includes local date format Get-JSDailyPlan -Late -Timezone (Get-Timezone) ` | Select-Object -Property @{name="Job Chain/Job"; expression={ "$($_.jobChain)$($_.job)"}}, ` @{name="Order ID"; expression={$_.orderId}}, ` @{name="Status"; expression={$_.state._text}}, ` @{name="Job Stream"; expression={$_.jobStream}}, ` @{name="Late"; expression={$_.late}}, ` @{name="Start Type"; expression={ $startModes[ "$($_.startMode)"] }}, ` @{name="Repeat Interval"; expression={$_.period.repeat}}, ` @{name="Planned Start Time"; expression={ Get-Date $_.plannedStartTime }}, ` @{name="Expected End Time"; expression={ Get-Date $_.expectedEndTime }}, ` @{name="Expected Duration (sec.)"; expression={ (New-Timespan -Start "$($_.plannedStartTime)" -End "$($_.expectedEndTime)").Seconds }}, ` @{name="Start Time"; expression={ Get-Date $_.startTime }}, ` @{name="End Time"; expression={ Get-Date $_.endTime }}, ` @{name="Duration (sec.)"; expression={ (New-Timespan -Start "$($_.startTime)" -End "$($_.endTime)").Seconds }} ]]></script> <run_time/> </job>
- For notification
- the report can be stored to an Excel file, see PowerShell CLI 1.2 - Use Cases - Daily Plan Report
- the report can be forwarded by mail, see PowerShell CLI 1.2 - Use Cases - Report Automation
Maintainer Notes
- The PowerShell module ships independently from JobScheduler releases and offers the functionality starting from release 1.2.1, see https://github.com/sos-berlin/scheduler-cli-powershell