When we kick off a batch job with the WebRun node in IPA, is there a way to delay the flow from moving to the next node until the job successfully completes? Or do we have to use a Wait node and determine how long the job usually takes to run?
Thanks in advance for your help!
I also query QUEUEDJOB, but use it a little differently. The query below checks the job's staus code in QUEUEDJOB every .01 seconds and breaks out of the loop when the status is no longer zero. Then the select returns the final status code of the job so you can check and act on it.
DECLARE @status as integer DECLARE @timer as decimal(8,0) SET @status = 0 SET @timer = 1
WHILE @status = 0 BEGIN WAITFOR DELAY '00:00:00.100' SET @status = (SELECT STATUS FROM .dbo.QUEUEDJOB WHERE JOBNUMBER = '') --PRINT @status IF @timer = 6000 BREAK ELSE SET @timer = @timer + 1 --PRINT @timer END
SELECT A.STATUS FROM .dbo.QUEUEDJOB A WHERE A.JOBNUMBER = ''
Sorry, sql did not paste in properly:
WHILE @status = 0 BEGIN WAITFOR DELAY '00:00:00.100' SET @status = (SELECT STATUS FROM .dbo.QUEUEDJOB WHERE JOBNUMBER = 'xxxxx') --PRINT @status IF @timer = 6000 BREAK ELSE SET @timer = @timer + 1 --PRINT @timer END
SELECT A.STATUS FROM .dbo.QUEUEDJOB A WHERE A.JOBNUMBER = 'xxxxx'
Here is the example written in IPA as mentioned above. You might have more control over error handling if you do it this way as opposed to SQL.