Parallel activity example

activities

#1

Please share one small demo on how to use parallel activity. Please share if and XAML is available.


What is the use of Parallel Activity in UI Path?
#2

#3

There used to be some bugs with this have they been resolved now?

@andraciorici


#4

Example for Parallel Activity in UiPath
Parallel.xaml (11.6 KB)

Regards,
Poovarasan Guna.


#5

“The ParallelActivity activity lets you schedule two or more child SequenceActivity activity branches for processing at the same time. Although branch SequenceActivity activities are scheduled to start processing at the same time, they do not start processing at the same time. Processing begins with the execution of one activity that is contained in one of the SequenceActivity branches. When that activity is completed, the next activity in sequence in another branch executes, and so on. Activity execution switches between the SequenceActivity branches, with one activity executing at a time until all the SequenceActivity branches finish executing. This completes the processing of the ParallelActivity activity. ParallelActivity does not guarantee the exact order of execution across the SequenceActivity branches.”

An excerpt from the MSDN site says that, the activities within each sequence are completed one after the other i.e. Activity 1 starts inside sequence 1, and then the control switches to Activity 1 inside sequence 2 until Activity 1 is completed inside all sequences. But according to the workflow made by @Poovarasan2, all the three notepad TypeInto activities complete in the same time. Is my understanding wrong somehow?


#6

Hey @ankwoods

Your understanding is correct and that is also correct what MSDN article says.

Here You are not able to detect the difference because of the Type Into Activity with Simulate property checked.

if you will check simulate of the Type into Property.it simulates the type using the technology of the target application. This input method(Simulate) is the fastest of the three(Default, Simulate type, Window Messages) and works in the background. By default, this check box is not selected. If neither this nor the SendWindowMessages check boxes are selected, the default method performs the click using the hardware driver. The default method is the slowest, it cannot work in the background, but it is compatible with all desktop apps.

You can give it a simple try with simple write line activity as well with different Text . then you will observe what MSDN says. Once it will complete first sequence of parallel then it will move to next.
Or it can jump to the next also if you will use with invoke with isolated.Check it here. This is all about operating system Context switching as per Round Robin Algo on a single CPU.

If you will pass more activities after type into in the same sequence you will observe the behavior. :slight_smile: What MSDN Article States.

Regards…!!
Aksh


#7

I want to quickly explain how I used this activity, if you run into something similar in the future or someone else is going through this thread latter.

I had an excel macro that was bringing up a VB message box as soon as the file was being opened. I used Parallel Activity to open the excel word book, using Read Range Activity on the right side of the parallel window and Click Activity on the left, which clicked “ok” on the message to make it disappear. Please note this was not possible before hand, as UIPath is inconsistent when it came to do this.

Hope this helps someone else as well!


#8

Thanks a million @aksh1yadav


#9

One more scenario while using agent assisted automation, we want to execute two event based on two different triggers, we can use parallel.


#10

hi go here for understanding parallel watch part 1 and part 2


#11

Hi Akshay ,

As we had discussion early regarding parallel activity. you just told me that it will start executing the code from right side to left side .
but As per my understanding it will start running the sequence from left side to right side .

please find the sample xmal

Thanks
Vijay Bharti

Parallel.xaml (9.9 KB)


#12

Hi @VijayBharti

If you remember my exact words then i was telling you about the execution flow with Runtime behavior.
So suppose their is one Parallel Activity we are using with 3 sequences like Sequence1, Sequence2, Sequence3.

Now the Parallel Activity has only 3 childrens.It schedules Sequence 1, Sequence 2 and Sequence 3 and then they are executed as they pop off the Stack.

So here is the fact for you which i was saying( i was thinking you are aware with a basic behavior which everyone can observe by studio after running but things like how it happens in the background, so i was telling you :slight_smile: it will pick up sequence from Left to right so first Stack item will be Sequence3,then second one will be Sequence2 then Sequence 1.

Now it will pop up the Top Element from Stacak that is Sequece 1 and will Execute it. then 2nd one and so on.This is how works.

To be Honest it does not use only Stack their is we can say a combination of Queue and Stack because their is some chances like one of the activities in the sequence can go idle then Sequence will be blocked by a pending bookmark so control will pass to the next Sequence until all the Sequences are blocked waiting for a bookmark.

Note - Now you might come with one question how you can make a sequence to go in a idle state with a bookmark so simple just use Delay.

Parallel Activity follows a very simple pattern.It schedules it’s child activities and then it allows the child activities scheduling to do their task they suppose to do.

The interesting thing about parallel is Parallel doesn’t care how the child activities schedule their children.

Regards…!!
Aksh


#13

@aksh1yadav .

Based on what i heard from you side,i just gave the explanation but after reading your above comment i am also agree with this fact . :grin:

Thanks & Regards
Vijay Bharti