Jobs that go into a Runaway Status (ones that have executed too long) can be handled automatically by adding a Runaway item. To determine if a Job has been running for too long, you can specify an amount of time or a percentage of average elapsed time.
- Click Definitions from the JAMS Shortcuts menu.
- Right-click a Job or Folder and select Properties.
- Click the Schedule tab.
- Click the Add Item icon.
- Select Set this Job's status to | runaway.
- In the Runaway Elapsed field, enter the amount of time (Windows System Time) the Job can execute before it is considered a Runaway Job.
- In the Runaway Elapsed Percent field, enter a percentage of elapsed time before the Job is considered a Runaway Job. This value is based on the previous run history for the Job in JAMS.
- In the Runaway Action field, select the action to occur when the Job becomes a Runaway Job. You can cancel the Job with a variety of statuses. Selecting NoAction will keep the Job running. In the example below, the Job will cancel with a completion severity of Error if the Job takes 5 hours or 500 percent of its normal execution time.
- Click Finish.
- Click Save and Close.
The RunawayElapsedPercent cannot be blank, if left at 0 does that then only alert off the RunawayElapsed time?
Hello Jared, if it is left at 0 then it will only alert off the Runaway Elapsed, that is correct.
If a job is scheduled to run every 15 min, will this resubmit the job?
Hello Aye, this element is designed to notify or to notify and cancel a job if it runs longer than a certain length of time, or a certain percent of time longer than average.
A resubmit or a repeat element should be used to run a job on a specific interval.
So if the job is running to long and we want to restart it (because some process will hang) what should we do?
Hello Artur, you can use a Notification Job to kill the Runaway job and then resubmit it. The notification job is responsible for killing the runaway job and resubmitting it immediately. The code below is defined in a Powershell job, and then set as a Notification job on the job you want to be resubmitted when it runs long.
$JAMS_NOTIFY_REASON = "<<JAMS_NOTIFY_REASON>>"
if ($JAMS_NOTIFY_REASON -eq 'RUNAWAY')
{
write-host "Killing runaway entry <<JAMS_NOTIFY_ENTRY>>"
Import-Module JAMS
Stop-JAMSEntry <<JAMS_NOTIFY_ENTRY>> -confirm:$false -Server Localhost
Submit-JAMSEntry <<JAMS_NOTIFY_JOB_NAME>> -Server Localhost
}
OK thank you, but I don't know exactly what the first sign <> means, maybe value of the parameter, could you explain? Because the second, third and fourth are the full path and the name of the first job I think.
My apologies Artur, the web page corrupted the JAMS variable symbols I was using. It should be correct now.
The <> in the first line is supposed to be <>. The web page seems to be escaping everything within the double angle brackets. I will open a ticket and send you a copy of the script so you can see the script more clearly.
OK thank you Gennaro.
I think that in the script it should be not <> but <> but with that everything works fine now :)
I created a ticket and sent you the code so there were no issues in the translation of the code. Glad to hear everything is working fine now.
For clarity, there should be two < symbols before, and two > symbols after the JAMS_NOTIFY_* built in parameters.
Hey gennaro,
In the above powershell code , where are fetching the jobs list that are running for longer time ? so that we can pass the list for jobs for the above code kill them and resubmit for another run .
Hello Sri, This job is a notification job. It is defined in the notification job element. It is not searching through the entire list of running jobs, its only attached to one job. This job is triggered when the job sends a runaway notification, and then kills the job.
Hello Gennaro,
So can we implement the same operation for all the jobs through a single job?
You can assign a notification job to a folder, so that any job in that folder will run this job when it is in a runaway status and then resubmit it. It is also possible to assign it directly to a single job.
What the different between runaway and stalled ?
The stalled status is when a job is waiting for a prerequisite, and is calculated before a job starts executing. The runaway status is when a job has been executing longer than expected, and only starts calculating when the job starts executing.
I don't see an elements tab. Is that a permissions issue?
The elements tab was replaced by the Schedule tab in JAMS 7.1.x. In JAMS 7.1.x if you need to add an element, click the Plus sign and select the operation you with to perform.
Gennaro,
If your job is running every 10-15 minutes 24/7 and you configure a runaway value so an execution doesn't go crazy run for 8 hours. When the runaway triggers and kills the job, will the scheduled executions resume itself or does job need resubmit?
Jarrod
The job needs to be resubmitted, unless an Interval Trigger is used. I would suggest using an Interval Trigger to run the job every 10-15 minutes 24/7, and then if the job runs for 8 hours and is killed, then the next interval automatically runs.
What's the difference between a job on Interval Trigger and a job with a schedule time followed by a repeat event handler?
Interval Triggers were a feature that was added in a later release of JAMS v7. Interval triggers automatically calculate the next interval they should run, and only submit the job if the previous one completes. If the next interval is missed, it will submit it on exactly the next interval that the job should run on. For example:
Job is configured to run every 10 minutes. The job starts at 12am, and runs until 12:15am, the next interval would be 12:20am and the job would be scheduled to run then after 12:15am completion.
A repeat event handler is designed to run until a specific time and calculates the next run based on the start time, end time, or completion time, and not the interval of time. The interval of time in an interval trigger is what "triggers" the next occurrence of the job.