Wait for Flow Validation before running script

Post Reply
DHemken
Newbie
Posts: 2
Joined: Wed Dec 13, 2017 8:16 pm

Wait for Flow Validation before running script

Post by DHemken »

Im Trying to Get a Job to run in VDP only one at a time because if another job attempts to enter the segment of the flow it will overwrite the artwork for the job that is currently running. I need a single Folder to pass a Hold job point and wait until VDP outputs something (or timeout if it never reaches VDP). im currently using the code below

Entry Point:

Code: Select all

var uniquekey="AF29 Press"

var started = s.getGlobalData( uniquekey, "Started" );

var finished = s.getGlobalData( uniquekey, "Finished" );

var timeout = s.getGlobalData( uniquekey, "timeout" );

var time=job.getVariableAsString('[Switch.Date:Format="hh:mm",TimeZone="System"]',s);

var bRelease="false";

if ((finished=="true") || (!started && timeout==time)){
	bRelease="true";
	
	s.log(-1,"Finished="+finished)
s.log(-1,"started="+started)
s.log(-1,"timeout="+timeout)
 var hour=job.getVariableAsNumber('[Switch.Date:Format="hh",TimeZone="System"]',s);
 var minute=job.getVariableAsNumber('[Switch.Date:Format="mm",TimeZone="System"]',s);
 minute+=5;//wait up to five minutes for start
 if (minute>59){
		minute-=60
		hour+=1
		 }
 
  if (hour>23){
		hour-=24		
		 }
  
  timeout=hour.toString()
		  timeout+=":"
				   timeout+=minute.toString();
		  
  s.log(2,timeout)
s.setGlobalData( uniquekey, "Started", "false" );
s.setGlobalData( uniquekey, "Finished", "false");
s.setGlobalData( uniquekey, "timeout", timeout);
}else{
s.log(-1,"waiting for time "+timeout)
}

bRelease;
Before VDP (to tell timeout not to run because VDP got the job...)

Code: Select all

var uniquekey="AF29 Press"
s.setGlobalData( uniquekey, "Started", "True" )

"true"

End point (to tell entry point it is safe to allow next job)

Code: Select all

var uniquekey="AF29 Press"
s.setGlobalData( uniquekey, "Finished","true" )
s.setGlobalData( uniquekey, "Started","false" )
"true"
However when the flow starts it trips the entry script without actually sending a file... and then the files are stuck there. Im looking for a way to wait until the flow has validated and will actually allow the file to pass the hold point before actually running the script in the entry point (all 3 are hold points with scripted release expressions)


Example:
Flow.PNG
Flow.PNG (26.58 KiB) Viewed 3228 times
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Wait for Flow Validation before running script

Post by Padawan »

In the "Entry point" script expression you set bRelease to false and unless I am missing something you never change it and then return bRelease at the end of the script. So it will always return false. Since jobs only pass the hold job when the script expression is true the jobs never pass the hold job.

It's also not clear to me how you implement your timeout? I see that a timeout in the format of hh:mm is stored in the script, but I don't see where that is actually used.

I don't have SmartStream, so I might be missing something. But personally, I would do it like this:
- I assume that SmartStream cleans up the artwork in the artwork folder when the job is processed?
- I'm not sure for which cases you implement a timeout, so that's why my method doesn't have any timetout ;)

I would build a flow where:
- You have one Hold Job, on the location of the current "Entry" Hold Job
- You set "Delay scheme" to None in the properties of the hold job itself
- In the properties of the outgoing connection of the hold job, set folder constraint to Yes
- Set maximum file count to 1
- Set target folder to the location of your Artwork folder.

This way the Hold Job will only allow jobs to pass when the "Artwork" folder is empty.
Post Reply