Re: Logical problem.
Posted in 1996
In <4tb3ba$bjt@cssun.mathc> Jack postulates whilst scratching thoughtfully: >I have a scheduler which waits for files and a datetime to occur before >running a process. So at a given datetime the process is 'queued' but >cannot run until it's source files/tables are ready. So far no problem. >Whenever a source file arrives or becomes ready. A check is made to >determine which processes use the file and a queue entry is made for each >of those processes. >Files are supposed to arrive within specific windows, but have a history >of being up to 2 days late, or roughly 1 day early. >Now comes the kicker. >process A needs file X and creates file Y. process A runs daily. >process B needs file Y and Z. process B runs once monthly. Process B needs >THAT days version of file Y. >- daily - >process A is queued. >file X arrives. >scheduler makes a queue entry for process A/file X. >process A is now viable and is run. file Y is created >scheduler makes a queue entry for process B/file Y. >next day... same thing except that since B/Y is already queued, it is not >re-queued. >- monthly - >file Z arrives. >scheduler makes a queue entry for process B/file Z. >process B is now due and is queued. > ---> process B is now 'viable' and scheduler kicks it off. > (Because B/Y queue entry has existed for awhile) >file X arrives >process A runs. >PROPER VERSION of file Y is created. Too late - B has already run or is >running. >I want a non-kludgey way to fix this. I could: >- force process B to depend on a third file which is created by process A > on the monthly basis. But then every time I add a like process 'B' I have > to go back and modify the appropriate 'A' process. >- ONLY make the file queue entry when file 'Y' is created after the proper > datetime. But then what happens when the correct file Y arrives early? > I miss the window for that month. >- have a process which unqueues specific files - but then how to stop IT > from running when the time is right, and which time is right? >- Make process B depend on process A - add inter-process dependency - so that > the file queue entry for file 'Y' is only made when the correct datetime > version of process A is run. I think you have it. If A knows about X's timestamp, it should be able to produce Y with the correct date/time. B should look at each Y and only queue up when the correct Y is present. B will obviously need to be a bit flexible and queue when either Z or the correct Y arrives. A question however. If X can arrive within a 3 day time period, and A only runs daily, then 3 or 4 X's could arrive in a single 24 hour period (assumedly overwriting each prior X). How does A cope with this, and what do you do if the monthly X is overwritten before A gets it's grubby little paws on it? Bryan Tonnet