Forum Discussion

photon's avatar
photon
Contributor
20 days ago

executing and reporting on the status of Process Cube via a business rule

For starters, we're on 8.2.1.

In reviewing some automation rules that were written by my predecessors, I've been trying to move away from the Harvest folder batch processing. ...mostly, because I don't want to deal with cleaning up the clutter it leaves in the filesystem.

In most cases, it's trivial to switch to BRApi.Import.Process functions and I've done this successfully but I find that running the Process Cube from a BR acts a bit weird.

BRApi.DataQuality.Process.StartProcessCube and BRApi.DataQuality.Process.ExecuteProcessCube both start the process just fine and the process does exactly what it should. However, both methods only start the process and immediately move on to the next instruction. I can't seem to evaluate them for failure, duration, or anything else as they both instantly and always return that they finished successfully.

Question 1: Both functions seems to behave identically and incorrectly (or at least unintuitively and undesirably for me in this case.) Other than the datatype of the object they return, is there actually a difference? Does it make sense to use one over the other or is it just a matter of which one has properties that are most useful in the context of the given rule?

Edit. Question 1a: Is there a third way to execute the process that I'm missing? Maybe I shouldn't be using either of these!

I tried using a sleep/timer with a loop to repeatedly evaluate process.IsRunning but it seems to evaluate to False instantly. process.Status instantly evaluates to "Completed." Duration and Endtime likewise are static, set almost-instantaneously, and appear to be of no use whatsoever.

Question 2: What is the correct way to monitor a process like this? Specifically, I'd like to notify on failure and maybe evaluate the duration in case I want to alert someone that the processing times have gone from 30 seconds to an hour (or something, I'll figure out a way to handle that threshold.)

I imagine there must be some way of polling the status. I could conceive of doing this "manually" by querying the TaskActivity table but it seems there must be a better way. I tried using BRApi.TaskActivity.GetTaskActivityItem(si, process.UniqueID) inside of a loop to see if querying it multiple times would help and it still behaves the same way. I know there are new event handlers but those are separate rules and I don't really think they apply in this case as I only want to report on this particular process in the specific context of my lights-out automation.

No RepliesBe the first to reply