Automated Restart?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jo8712
Participant
Posts: 12
Joined: Tue Nov 04, 2003 7:41 am

Automated Restart?

Post by jo8712 »

I have a job sequence that needs to run continuously throughout the day. Basically, the sequence waits for a file to appear and when it sees this file kicks off a number of jobs within the sequence. At the end of the sequence, I delete the file. I somehow need to restart the job again so it will then began waiting on the next occurance of the file. Any ideas how to do this?
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: Automated Restart?

Post by ogmios »

If the file only appears a single time every day schedule your job once every day.

If the file can appear multiple times you'll have to write your own BASIC sequence job to get it done by looping (wait for file... do run... wait for file... do run...). Some hints:
* Use DSWaitForFile instead of sleeping to wait/check for a file to appear;
* Build in some way that the job will automatically stop in the evening (either by time or by checking for an extra "stop" file);
* Also consider what to do when a single run fails: reset or wait until manual user intervention.

Then schedule this job once every morning and you're good to go.

Ogmios
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Nice ideas ogmios, But to prevent the off-chance that the server crashes and you have a running job at this time, I would prefer to have some system schedualed batch that will periodically sample for new files and if they exist runs the apropriate DS job.
this way you prevent the hastle of dealing with ugly stuff if and when your server crashes and you have a running job.
I agree that it still may happen but if you have most of the time a running job that waits for a file your bound to find yourself with it running when bad things happen.
this is only IMHO.
IHTH
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

There are several other solutions, it's just preference I think.

If the DataStage server crashes unexpectedly our operators do a category by category check on the jobs anyway and they didn't need to do this for the last year.

The advantage of keeping it in DataStage is that it's simpler for the operators. If the job is not running just restart it in DataStage, without the need to go meddling in UNIX/other tools.

Ogmios
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

well ogmios,
first of all this is a windows platform we talk about, at least that is what the user wrote as the platform.
secondly if you design it as I said it's operator free, it simply runs automatically, which means you might want to put some notifications to the person in charge of the job.
in any case if the server crashes and DS was corrupted due to it, a simple operator can't solve the problem at hand, so reducing the chance of it ever happening is prefered IMHO
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A job is not permitted to attach itself (see help on DSAttachJob) and therefore can not re-start itself.
To effect conditional re-start, the best solution (imho, of course) is to have detection of the file handled by a job control routine (or job sequence); it then triggers the actual job, which deletes the file when it's done.
The job control routine has a loop, so it goes back to waiting for the file to appear. Build timeout capability into this loop. Also, only run this job once per day, scheduled to start at, say, 00:10 and finishing at, say 23:50 (depending on run time). This daily pause will allow resources to be freed.
You also need a mechanism for manual stop of the job, for example by bringing a different file into existence, so that system maintenance can be performed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply