question

David Chan avatar image
1 Like"
David Chan asked David Chan commented

Problem in premepting operator in subflow

Hi, I tried to premept an operator in subflow. I have problem in performing the Save to Context and Release token. I have attached the model. Please advice. Thanks.

break-model-dc.fsm

David

subflowpreemption
break-model-dc.fsm (42.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Logan Gold avatar image
1 Like"
Logan Gold answered David Chan commented

I believe the token that is passing through the Save Context and Release Token activities is in a different instance of your sub flow than any tokens that enter Zone1. While running the model, I can see there are different instances being used in the Quick Properties of the sub flow:

Since the Instance Creation method of this sub flow is set to Global, the top instance is that Global instance. However, in the picklist option in the Pick Operator field of the Processors, the Owner Object is set to the Operator. This appears to create the second instance.

If you click on the Tools/ProcessFlow/SubFlow line, then click on the Open PF View, it brings up the instance which only shows the token in the preempt part of the Process Flow and no tokens in the other section. If you open the Operator1 PF View, it will show any tokens in the Zone1 section of the sub flow, but not the token in the preempt activities.

So as far as the different preempt activities are concerned, there are no tokens in Zone1 to save context of or release to the Custom Code activity.

You'll either need to make sure all the tokens are part of the same instance of your subflow or use a General Process Flow to do all the Process Flow logic. To make sure all tokens are a part of the same instance, you could change the Owner Object in the Pick Operator logic on the Processors to:

Model.find("Tools/ProcessFlow/SubFlow");

Then, change how the Operator is referenced in the sub flow since current will no do that. However, I'm not familiar enough with this way to reference sub flows to know if this will always work. I just know that in my testing, it seems to.

If you want to make the same Process Flow logic work in a General Process Flow, you can set the Pick Operator fields in the Processors to be 0, then use an Event-Triggered Source to point to the OperatorReference event of the Processors. Then, you can use all the same activities you are using now in the sub flow minus the Start and Finish activities (and making sure all the references are set correctly for the Operator, Processors, etc.). I am more familiar with this way of using Process Flow and is my preferred way of doing things.


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

David Chan avatar image David Chan commented ·
@Logan Gold

Thanks. Let me try out and get back to you

David

0 Likes 0 ·