I'd like to get a notification from god when a process stops as a result of an error, but not otherwise. I'm looking for behavior like this example from doc/god.asciidoc:
w.transition(:up, :start) do |on|
on.condition(:process_exits) do |c|
c.notify = 'tom'
end
end
... except that only triggers if the process exits with a nonzero status. Do I need to write a custom :process_exits_with_error condition? If so, how would I find the exit status?
Related
I have a queue,followed by selectoutput. the problem is that the agent does not go out from the queue.In this case the agent should choose the third exit of the selectoutput, so it is not possible (i presume) that the agent does not go out because the following block is full.What could be the reason? Thanks
the reason is that the condition that you think is true, is actually false, because anylogic calculates first the condition in the select output block, and then it runs the code on the "on exit" action of the queue7 block...
So my guess here, is that you are doing something on the on exit action, that changes the result for the condition.. but it's already too late..
use the "on at exit" action or sometimes you need to put a dummy delay of 1 milisecond or so between your last block before the selectoutput and the selectoutput to ensure your condition is met correctly
This is the order in which things happen:
on at exit queue
check condition
on exit queue
on enter select output
I am looking for a way to update the test socket test status (the color: Green, Yellow, Red etc) indicator while the test is running. What I am experiencing is that the red color would appear only at the end of the entire test sequence if any of the test steps fail. If any of the tests in any of the subsequences fail, I can see Red appear on the right side in status indicator for any particular steps however, I would like to know how to have the status of the Execution Annunciator updated during run time as opposed to at the end of the test. As the sequence execution pointer goes through various steps during it's hard to see what failed as the pointer moves to next step after execution. In sequences that run for a long period of time, I would like to know by looking at the socket status whether any of the steps failed rather than waiting till the end of the sequence.
I tried looking at the report but it scrolls down and makes it impossible to see if anything has failed so far...!
See the screenshot below:
Thank you,
I am trying to run a child job in tLoop. The child job connects to salesforce and downloads "Account" object to local SQL Server table. There are problems with connection to Salesforce, it takes few attempts to connect. Hence, I put the connection stuff in child job and now trying to call the child job in a loop. Below is the image of my parent job.
As you can see in image the tRunJob_1 has error because of Salesforce connection problem in child job. This is correct behaviour.
The setRetryConnect that is connected to OnComponentError has this code: context.retryConnect = true;
The setRetryConnect that is connected to OnComponentOk has this code: context.retryConnect = false;
So, I am tripping this context variable depending on whether child job succeeds or fails.
My tLoop looks as below:
I want the tLoop to run as many times till the condition remains true. That is till the time it continues to error out. However, it just iterates once and then stops. Could anyone please let me know what correction need to be done here to make the tLoop work?
I couldn't re-pro your issue with SalesForce but by looking at your job what I feel is that when you say - "it just iterates once and then stops" is the expected behavior.
As per your job flow after the tRunJob you are using OnComponentOk/OnComponentError trigger which would process and stop the job run as it would have completed the job execution. What it would have ideal was to keep everything in a subjob post tLoop so that it will iterate till the condition is met.
Sample job for explanation -
Here used tSetGlobalVar to define a global variable (in place of your context variable). Then use the globalMap variable as ((Boolean)globalMap.get("tLoop")) in your "Condition" for the tLoop.
And then finally run some code in the tJava component that does something and conditionally sets the global variable to false to mark the ending of loop.
tRunJob provides an Return Code ((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))
If you're running your child Job a number of times and want your Job to exit with non-Zero if one of these iterations fails, then after each iteration, you should test this return code and store it in your own globalMap Object if it is non-zero
int returnCode = ((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"));
if (returnCode > 0) {
globalMap.put("tLoop", false);
}
else {
System.out.println(returnCode);
};
Found the answer myself, posting it here so that it may help others. It appears like OnComponentError breaks the tLoop. Disabled the OnComponentError flow and un-checked the 'Die on Child Error' checkbox in tRunJob.
The tLoop remains as it is. No changes here.
The retryConnect will use the below code. It uses CHILD_RETURN_CODE to check whether the child job threw error. In case of success, its value is 0. I am tripping the variable when the child job succeeds, so the loop will stop. As you can see, the tLoop shows 2 iterations, it is working as expected now. Thanks.
I'm trying out some code that is supposed to block until moving to a new simulation time step (similar to waiting for sys.tick_start in e).
I tried writing a function that does this:
task wait_triggered();
event e;
`uvm_info("DBG", "Waiting trig", UVM_NONE)
-> e;
$display("e.triggered = ", e.triggered);
wait (!e.triggered);
`uvm_info("DBG", "Wait trig done", UVM_NONE)
endtask
The idea behind it is that I trigger some event, meaning that its triggered field is going to be 1 when control reaches the line with wait(!e.triggered). This line should unblock in the next time slot, when triggered is going to be cleared.
To test this out I added some other thread that consumes simulation time:
fork
wait_triggered();
begin
`uvm_info("DBG", "Doing stuff", UVM_NONE)
#1;
`uvm_info("DBG", "Did stuff", UVM_NONE)
end
join
#1;
$finish(1);
I see the messages Doing stuff and Did stuff, but Wait trig done never comes. The simulation also stops before reaching the finish(1). One simulator told me that this is because no further events have been scheduled.
All simulators exhibit the same behavior, so there must be something I'm missing. Could anyone explain what's going on?
The problem is with wait (!e.triggered); when e.triggered is changing from 1 to zero. It has to change in a region where nothing can be scheduled, so whether it changes at the end of the current time slot, or the beginning of the next time slot is unobservable. So the wait will hang waiting for the end of the current time slot, which never comes.
I think the closest thing to what you are looking for is #1step. This blocks for the smallest simulation precision time step. But I've got to believe there is a better way to code what you want without having to know if time is advancing.
Having the following process
and a message boundary event which has cancelActivity set to false so that after Should cancel the Sub Process could continue where it was before the event was received - in case that No was selected.
How could I simulate as if cancelActivity was set to true in case that the user selects Yes (i.e. cancel/stop Sub Process when the No end is reached)?
Please ask if I wasn't clear about this.
With the boundary event attached to the sub process, there is no way of going to another task after should cancel.
You can neither use link events (not allowed from parent to sub process), nor a simple sequence flow (not allowed between two processes).
So I guess you need attach the message event to each relevant task within the sub process or you need to use two separate boundary events (one interrupting and one non-interrupting).
Further the answer above.
The process flow really doesnt properly capture your requirement.
You should have the email event running in parallel to your sub process.
On receipt of the email, flow directly into the should cancel human/user task.
If yes, send a signal event (signals are easier to implement than messages) that is captured by a signal boundary event receiver on the sub process and simply flow to the end (i.e. terminate).
If no, you simply exit (you may need to start another email receiver - depends on your requirements).
This way, the sub process boundary event is not triggered until after you have made your decision to terminate or not.
Hope this helps.
maybe you need the bpmn definition below