Schedule task; waiting for file
Im not using the folder monitoring piece yet. Basically I run a folder import waiting for a file that comes between 8am and 10am. So the map will run multiple times during the period. It’ll continue running after a file is imported, is there anyway to stop it once a file has been imported ?
Im pretty sure the file monitoring method would only run when theres a file but due to version issue, we’ll have to wait till we upgrade to turn that on
Thanks for any help
Im pretty sure the file monitoring method would only run when theres a file but due to version issue, we’ll have to wait till we upgrade to turn that on
Thanks for any help
Answers
No, there really isn’t a way to do this.
In your case, since you expect the file to be there between 8am & 10am, then your map should be scheduled to run for those same start/end times. or perhaps 7:55am to 10:05am just in case.
And as you note, if the file comes in at 8:12 and the map runs and processes it at 8:15 – then YES the map would run until 10am and then stop running. So yes the map execution would be wasted since you don’t expect another file – but since the map run should just take a few seconds to run and find there is no source it isn’t really hurting anything.
But I suppose if we really didn’t want the map running after it processed the one file you could:
1. Use an ‘after map’ task, and update the ScheduleMaster.Active = 0 for the map
Because now that the schedule is no longer active, it won’t run again after processing.
I tested that and it worked great for me.
Now of course your issue is the schedule is no longer active – meaning it won’t run again Tomorrow!
So the only way to resolve that would be to re-enable the schedule either manually – or else probably make a different map (or better yet, a SQL job) to run at 7:55am which would re-enable the Active flag on that schedule
In your case, since you expect the file to be there between 8am & 10am, then your map should be scheduled to run for those same start/end times. or perhaps 7:55am to 10:05am just in case.
And as you note, if the file comes in at 8:12 and the map runs and processes it at 8:15 – then YES the map would run until 10am and then stop running. So yes the map execution would be wasted since you don’t expect another file – but since the map run should just take a few seconds to run and find there is no source it isn’t really hurting anything.
But I suppose if we really didn’t want the map running after it processed the one file you could:
1. Use an ‘after map’ task, and update the ScheduleMaster.Active = 0 for the map
Because now that the schedule is no longer active, it won’t run again after processing.
I tested that and it worked great for me.
Now of course your issue is the schedule is no longer active – meaning it won’t run again Tomorrow!
So the only way to resolve that would be to re-enable the schedule either manually – or else probably make a different map (or better yet, a SQL job) to run at 7:55am which would re-enable the Active flag on that schedule
so this works perfectly except for when I turn the Schedule Active back on. ie I set a sql job to turn it on at 10:01am. It started to run the map even though it was set for 8AM till 10AM. So last week I moved the sql update job to 10:45am. The Map started to run at 10:45am. Not sure why its running. Im moving it to 8pm at night. weird…