How to make a node to wait until the last file in a folder is processed ?.

Questions and answers on how to get the most out of FFAStrans
veks
Posts: 84
Joined: Fri Oct 25, 2019 6:51 am

Re: How to make a node to wait until the last file in a folder is processed ?.

Post by veks »

emcodem wrote: Thu Jan 09, 2020 7:08 pm That is a really good question!
There are many ways to overcome this but typically users don't mind if the nodes after join are executed multiple times. E.g. why would it be a problem for you that the text file is overwritten 5 times?

One example solution:
You take the first branch and insert a populate processor after delivery, create and set the user variable "main_branch" to "1". After the "hold" node that synchronizes all jobs, insert a "conditional" and check if the variable "main_branch" is "1". This will cause only 1 branch to go on and 5 branches to "fail".

If you really want to dive into this with me, let me know your questions please.
Problem is that I need to run a python script at the end of a workflow, only once.
Script checks all transcoded files, moves them, renames them, checks audio etc.

Can you send me a FFAStrans exported template with such example that does this?

Because, I've tried to do this via conditional and it didn't do nothing:
if $exists(%directory_location%\VOD\%s_source_name%_1.mp4) == 1
if $exists(%directory_location%\VOD\%s_source_name%_2.mp4) == 1
if $exists(%directory_location%\VOD\%s_source_name%_3.mp4) == 1
if $exists(%directory_location%\VOD\%s_source_name%_4.mp4) == 1
if $exists(%directory_location%\VOD\%s_source_name%_5.mp4) == 1
if $exists(%directory_location%\VOD\%s_source_name%_6.mp4) == 1
SCREENSHOT: http://prntscr.com/qloc2r

As I'm trying to check if each profile exists in this folder.
I couldn't check all with that source name (%s_source_name%*) because there is a SMIL and TTML files with same source name.

I've added that conditional just after the all nodes, after deliveries.
What I've done wrong? And why it didn't work for me?

Thanks!

EDIT:
I've tried your recommendation, and problem is that it gets to the that point of conditional (main_branch) but it won't continue.
It seems that synchronize for some reason doesn't wait for all jobs to be finished or something like that... Not sure...?
Errors: http://prntscr.com/qlopi0
WORKFLOW: http://prntscr.com/qloq9t
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: How to make a node to wait until the last file in a folder is processed ?.

Post by emcodem »

Hey veks,

i am happy to see that you understood my approach, well done! Not sure why the Hold node does not work as you expect it, it works in my test workflow below. Maybe you get out whats the difference?


Here the Workflow for 0.9.4
Merge_Branches.xml
(14.96 KiB) Downloaded 429 times

This is what it looks like
Merge_Branches.png
Merge_Branches.png (24.16 KiB) Viewed 4106 times
Additional note, in your IF statement, you miss to encapsulate the strings with "",
you do:
$exists(c:\temp\test.mxf)

correct is:
$exists("c:\temp\test.mxf")
emcodem, wrapping since 2009 you got the rhyme?
Post Reply