on 05-15-2012 8:10 AM
Hey experts,
Our company is implementing the redwood scheduler for all of our batch jobs. Currently, we are using autosys to run our 5,000+ jobs. A nice feature of autosys was the ability to create an easy script of putting about a 1,000 jobs on hold. We would do this for scheduled maintenence work. I'm looking at the redwoodAPI docs, and I see the function job.hold();. Does anyone know how to use this function with a specific job name?
Ok I believe I found a solution. I've created a time window that is open during regular operating hours and closed during our next scheduled outage. Then, for our specific job scheduling, I created a few submit frame's for common running frequencies (every hour, every day,etc). Within these time frame's, I selected my time window that I created. I also made sure that my submit frame has
"Skip when time window is closed" checked. Finally, I attached my time window to my Queue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This looks like a start. However, this requires touching every single job (5,000) and making this change. Does any one know about redwood scripting?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This should carry out Nanda's suggestion above via RedwoodScript if you still want to update your jobs in bulk:
{
// get all the JobDefinitions in the "GLOBAL" partition -
// Note you may need to apply some other filtering here depending on what
// JobDefinitions you want to include/exclude
for (final Iterator jdIterator = jcsSession.getPartitionByName("GLOBAL").getJobDefinitions(); jdIterator.hasNext();)
{
JobDefinition jd = (JobDefinition) jdIterator.next();
// exclude branched versions (i.e. non current copies of JobDefinitions)
//and System JobDefinitions
if (jd.isMasterVersion() && jd.isModifiable())
{
// print out the name of all JobDefinitions that are being modified.
// useful to check you're not updating anything you shouldn't
// before you uncomment the persist
jcsOut.println(jd.getName());
// set the JobDefinitions to cancel when overdue
jd.setOverdue(true);
jd.setOverdueStatus(JobStatus.Canceling);
// ensure they don't get submitted until the next Submit Frame
FinalStatusHandler fsh = jd.createFinalStatusHandler();
fsh.setAction(FinalStatusAction.ContinueSubmitFrame);
fsh.setStatus(JobStatus.Canceled);
}
}
//jcsSession.persist();
}
I'm assuming you're still asking about JobDefinitions rather than Jobs as that would be a different kettle of fish.
If you wanted to only deal with JobDefinitions that started with "ABC" you could use the following "if" statement in the above code after you retrieve the JobDefinition from the Iterator:
if (jd.getName().startsWith("ABC"))
{
//...code to act on JobDefinition here
}
To only act on JobDefinitions that have a WaitEvent, you could do the following in the same place in the code. This basically Iterates through all JobDefinitionWaitEvents for the supplied JobDefinition object. If the JobDefinition doesn't have any, the code in the "for" loop would never be executed. Effectively skipping any JobDefinition without a WaitEvent.
for (final Iterator waitEventIterator = jd.getJobDefinitionWaitEvents(); waitEventIterator.hasNext();)
{
JobDefinitionWaitEvent jdwe = (JobDefinitionWaitEvent) waitEventIterator.next();
//...code to act on JobDefinition here
}
I'm trying to use this script to fix some restart behavior's. Basically I'd like to set status of completed to Default Behavior or ContinueSubmitFrame. These jobs were set to Restart on completed which we don't want. When I run the script it gives some java errors, in particular:
"Job definition TEST handler for status Completed already exists".
I was able to change a job if it's Restart Behavior was set to Default Behavior, but not if it was set to Restart.
Is there a way to reset all the jobs Restart Behavior to Default?
There's a much easier way to do this.
When we have a maintenance window, we use the following function: Use "Time-Window".
(it's under "Environment" - on the left side then)
You should find there something like "Maintenance Window for (e.g.) SAP BI" or "Maintenance Window for CPS".
Edit that maintenance window by adding a new Element on the tab "Elemets" and add a new "element" and specifiy the time window duration.
During this time, all jobs will be on hold....
Hope this might help you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your inputs. The way I thought about was just putting a job queue on hold. The issue I wasn't sure on with that approach, was how the jobs would react after we took the queue off hold. If a job was scheduled to run every day at 7pm, we put the job queue on hold from 5-9pm, would the job run right after we took the job queue off hold? Or would the job run the next day at 7pm? We would like the latter to occur.
For the time windows, how would the jobs schedule? In the scenario above, if I made the Maintenance Time Window from 5-9pm, how would the job process? I do plan on testing these 2 methods today with some test jobs, so I'll let you know how they each behave. Thanks again!
Hi Ian,
Ian Baxter wrote:
If a job was scheduled to run every day at 7pm, we put the job queue on hold from 5-9pm, would the job run right after we took the job queue off hold? Or would the job run the next day at 7pm? We would like the latter to occur.
In every job definition/job chain there is an option to change what the jobs should do when they are overdue (please refer the picture)
By Default, the overdue job submits immediately when they are released. In you case, if you set them to cancelling, then the overdue job will get cancelled and based on the restart behaviour you have defined, it will continue (in your case it should be continue submit frame)
If you want to hold all the jobs on system, its better to hold the queues and not the jobs inividually. If you want to hold jobs on any particular system, you can hold just that queue.
If you are aiming to put certain jobs on hold and not all, then its better to create a filter on the job monitor, select all the job in that filter, right click and hold them all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.