Hello everyone!
Just wanted to know if anyone has an example of if anyone can help me accomplish this goal.
I would like to build a script in switch that if there are multiple jobs that come into the flow at once, it would run them one by one. Once the current job thats being processed reaches a certain folder, then it would initiate the next file thats waiting to run.
I hope this makes sense, sorry if it doesn't. Thanks for any help!
Job Hold Script
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Job Hold Script
There's been at least 1 discussion in the forums for which I proposed a solution.
Job Hold Script
I post an Feature Request about just this thing last summer. And it's log at Enfocus as number 4746. We can hope that it will came in an near update..
I got suggestions in two work around from Natacha De Kegel at Enfocus;
"Following workarounds could be:
A combination of the Hold Job and Sort Job tool
The idea is to have the Sort Jobs check (using a script expression) if the
condition is met 'a file with the same name is present in a specif
folder'). If true, the file continues through the flow. If false, the job
is send to a Hold job, which can delay the job for x minutes, after which
it is re-send to the Sort Job to see if the condition is met now.
This still would require a script expression to be created.
The second option is a custom script that would act as the Hold Job, with
the extra requirement as properties (ex: path to the folder, name of the
file (to leave more freedom and not limit it to a job with exactly the
same name))."
I have my workaround in that there I uses a lot of "Hold-job" so there can't be two files in one place the same time..
I got suggestions in two work around from Natacha De Kegel at Enfocus;
"Following workarounds could be:
A combination of the Hold Job and Sort Job tool
The idea is to have the Sort Jobs check (using a script expression) if the
condition is met 'a file with the same name is present in a specif
folder'). If true, the file continues through the flow. If false, the job
is send to a Hold job, which can delay the job for x minutes, after which
it is re-send to the Sort Job to see if the condition is met now.
This still would require a script expression to be created.
The second option is a custom script that would act as the Hold Job, with
the extra requirement as properties (ex: path to the folder, name of the
file (to leave more freedom and not limit it to a job with exactly the
same name))."
I have my workaround in that there I uses a lot of "Hold-job" so there can't be two files in one place the same time..
Between jobs!
Job Hold Script
dkelly, Found your post on the hold job, but im running into the issue that's posted below it (i.e. after running multiple jobs, then if there is a delay, the global variable will not reset, so then the jobs that are coming just sit there, because the global variable is still in "working". As soon as i stop the flow and change the global variables name and re-run it, works like a charm.) Don't know if you would have something that's a work around that isn't considered a "hack" like in the future posts on that thread)
lombert, thank you for the response. Have you ran into this issue before with the global variable not unsetting after a break between jobs?
to unset the global variable i am doing (s.setGlobalData( "Processing", "HoldJob", "" );
Thanks for the help!!
EDIT:
dkelly, Also tried your "Space jobs apart" solution and still ran into the same issue. Set the timing for 20 seconds. I hope there is a solution to this.
lombert, thank you for the response. Have you ran into this issue before with the global variable not unsetting after a break between jobs?
to unset the global variable i am doing (s.setGlobalData( "Processing", "HoldJob", "" );
Thanks for the help!!
EDIT:
dkelly, Also tried your "Space jobs apart" solution and still ran into the same issue. Set the timing for 20 seconds. I hope there is a solution to this.
Job Hold Script
I missed that you asked about a script-function for Hold-job, my request to Enfocus was about the Hold-job configurator, there I wanted the same function.
Between jobs!
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Job Hold Script
hahnlogic wrote: Found your post on the hold job, but im running into the issue that's posted below it (i.e. after running multiple jobs, then if there is a delay, the global variable will not reset, so then the jobs that are coming just sit there, because the global variable is still in "working".
Hello, the script was designed to allow only 1 job to run through that section of the flow. If there's a delay with a job then it won't release another job. I can add a timeout to allow the script to release another job after a certain amount of time has passed.
Hello, the script was designed to allow only 1 job to run through that section of the flow. If there's a delay with a job then it won't release another job. I can add a timeout to allow the script to release another job after a certain amount of time has passed.
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Job Hold Script
Here's an example flow that processes only 1 job at a time. The 2nd Hold Job is used to simulate a task that takes 4 minutes to complete. The folder after that has a script that resets the lock allowing another job to be processed.
https://www.dropbox.com/s/vuhbvkoyv9wew ... 0run.sflow
https://www.dropbox.com/s/vuhbvkoyv9wew ... 0run.sflow