Page 1 of 1

Count active jobs in folder, if amount goes higher than x, send report

Posted: Wed Jan 18, 2023 3:15 pm
by PdFUser5000
Is there a way to monitor the amount of job folders in a workflow folder? In my workflow sometimes queues appear and i would like to receive a notification if let's say, there are more than 20 job folders in it. Hot folder monitor kinda does something like this, but it just monitors if files are moving/not moving through it.

Or is this something that's achievable via scripting?

Re: Count active jobs in folder, if amount goes higher than x, send report

Posted: Thu Jan 19, 2023 8:08 am
by freddyp
Can you explain a bit more what the reasoning behind this is? Is it because these jobs take up too much processing power and hold back other jobs? Is it because somebody probably made a mistake? Even if you receive a notification, what does that bring? You may not be there, or by the time you react the jobs have been processed. Perhaps there are other ways to solve your problem.

Re: Count active jobs in folder, if amount goes higher than x, send report

Posted: Mon Jan 23, 2023 2:08 pm
by PdFUser5000
When a queue appears, some jobs need to be rushed. Unless im watching the folder all the time, i have no information if there is a queue or not. I also can't set a priority when the jobs are inserted to the flow, because the urgency might not be needed at the point of input.

Re: Count active jobs in folder, if amount goes higher than x, send report

Posted: Mon Jan 23, 2023 6:11 pm
by freddyp
Do jobs arrive into the flow as individual files or as job folders?

If it is as job folders, then it is quite easy to send a message. There is a variable [Job.FileCount]. For an individual file it is of course 1, for a job folder it will have the count of all the files in the folder. You can build a condition that checks if the value of the variable is higher than a certain value.

If it is individual files, then you can try with "Assemble job". You could for example configure it to assemble "After N minutes" (e.g. 5 minutes). The result is a job folder with all the files that arrived in a period of 5 minutes after the first file arrived. You can then check if [Job.FileCount] is higher than a certain value and send a message. You can use "Ungroup job" to get all the files back out of the job folder.

The Switch 2022 Fall release has a feature to rush jobs. You can do that from the Portal. Watch the recording of the December workshop for more information on how to use that.