[SOLVED] Tasks not executing in parallel


#6

Really? Why do mine always show up with the with listed as location? Am I doing something wrong?
download


#7

I have been using that all wrong…thanks for clearing that up!


#8

Different… But not wrong. As they say around here “open world” so you can pretty much do it however you like. Inside the piston in Edit mode they would look like this:

image

But when saved they look like this:

image

image


#9

Ah…I’m not using Location, I’m using $Location. Evidently, they are different. :smiley:
When you use $location, the with shows up in display and edit mode.


#10

As I said, “Open world”. :slight_smile:


#11

fyi async only matters when there is a wait statement. each async statement tells the piston to not pause execution at the next wait and continue executing the piston with the statement following the with block containing the wait.

also fyi piston parallelism when turned on creates a 2nd instance of the piston to handle incoming events. while there will be 2 instances of the piston all variables in the define block are shared and each piston does not get its own instance of variables.


#12

Hey sir;

I didnt see that way. The “with” came because I needed to use a device and put some following commandas for that device alone. Is there another way to write that and do the same thing?


#13

Done for it and worked flawlessly. Is there an way for setting this by default? Because if I want something for wait I would put that inserted into the code anyways.


#14

So, async doesn’t start all with’s for the same if at the same time, it just skips the wait? Am i getting that correct? This is getting more confusing rather than less. LOL Just when you think you understand something…

Also, if you set up two piston with the same trigger included in both, will both fire at the same time by default or do you have to engage parallelism to get them to both fire?


#15

Not that I’ve ever seen. You have to set it each time you want it that way. You’d probably have to ask for a new feature to get this to be happen.


#16

async tells webcore to not pause the piston at any wait timer within the async block rather continue execution with the statements after the async block.

two pistons with the same trigger would both receive the same event and get triggered without parallelism being set. parallelism is only required when you want two copies of the same piston to run and handle events that meant for just that piston. each event meant for that piston will be sent to one of the copies of that piston.


Passing variables through pistons
#17

if there is no wait statement in the code then using async serves no purpose.


#18

Thank you! This finally makes sense.


#19

@bangali I am trying to execute the use case you’re describing, i.e., I am spawning multiple pistons that are executing on different devices, however I cannot get this to work. The device is getting passed as an $arg to the spawned piston, but it’s not controlling all of them properly. They do correctly receive the ‘Turn On’ command when called, but only the last one gets the Turn Off command.


#20

start a new thread with a green snapshots of the pistons? :slight_smile:


#21

Thanks, I had already created a new thread, which I just updated based on where I am right now. Still struggling to get this to work…Here’s the link: Passing variables through pistons


#22

says - ignore in the last post on that thread. :slight_smile:


#23

It’s meant for the comment only, I had a comment in the original message and cant figure out how to delete completely:-(, will change the message


#24

ahh. click the … at the bottom of that post and it will show a delete icon.


#25

Thanks I found it a few minutes ago…i am clearly a newbie