Re: [sumo-user] [not working] traci.subscriptions with multiple traci clients from the same function using connections.

2019-01-15 Thread Jakob Erdmann
Hello,
the problem with this approach is that traci commands line traci.init or
even traci.simulationStep only return once the simulation has sent it's
repsonse status. However, the response status is only sent after all
clients have sent their commands. Thus you get a deadlock in your code when
running all clients in the same thread.
regards,
Jakob

Am Mo., 14. Jan. 2019 um 17:29 Uhr schrieb Lara CODECA <
lara.cod...@eurecom.fr>:

> Dear All,
>
> I implemented 2 python classes (stepListeners) that require to use
> traci.subscriptions
> (http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Subscriptions
> ).
> These classes are independent from each other, and in some cases have
> overlapping subscriptions
> (subscriptions to the same elements). I cannot change the classes (for
> compatibility reasons), so
> I'm trying to use:
> - multiple clients, one for each class
>   (
> http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_the_same_simulation_from_multiple_clients
> ).
> - from the same _main() function
> (
> http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_parallel_simulations_from_the_same_TraCI_script
> )
>
> I tried all the possible ordering of start/init, getConnection, setOrder
> and they hang on line 2
> (Loading configuration... done. ***Starting server on port 59759 ***)
> """
>  1 # TraCI client #1
>  2 traci.start(['sumo', '-c',
> '../MoSTScenario/scenario/most.traci.sumocfg',
>  3  '--num-clients', '2'], port=59759, label='pypml')
>  4 # TraCI client #2
>  5 traci.init(port=59759, label='triggers')
>  6
>  7 _pypml_handler = traci.getConnection('pypml') # with and without
> simulationStep() after.
>  8 _pypml_handler.setOrder(1) # number can be anything
>  9 logging.info('PyPML TraCI client acquired.')
> 10
> 11 _triggers_handler = traci.getConnection('triggers')
> 12 _triggers_handler.setOrder(2) # number can be anything
> 13 logging.info('Triggers TraCI client acquired.')
> """
>
> If I use them one at the time (connections only / multiple clients in
> separated files) all works
> fine. Is there a way to use these 2 functionalities together?
>
> Thanks in advance for your time :)
>
> All the Best,
> Lara
>
> --
> Lara CODECA
> Postdoc
> Tel : 04.93.00.81.51
>
> EURECOM
> Campus SophiaTech
> http://www.eurecom.fr/
> ___
> sumo-user mailing list
> sumo-user@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
___
sumo-user mailing list
sumo-user@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user


[sumo-user] [not working] traci.subscriptions with multiple traci clients from the same function using connections.

2019-01-14 Thread Lara CODECA
Dear All,

I implemented 2 python classes (stepListeners) that require to use 
traci.subscriptions
(http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Subscriptions).
These classes are independent from each other, and in some cases have 
overlapping subscriptions
(subscriptions to the same elements). I cannot change the classes (for 
compatibility reasons), so
I'm trying to use:
- multiple clients, one for each class
  
(http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_the_same_simulation_from_multiple_clients).
- from the same _main() function
(http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_parallel_simulations_from_the_same_TraCI_script)

I tried all the possible ordering of start/init, getConnection, setOrder and 
they hang on line 2
(Loading configuration... done. ***Starting server on port 59759 ***)
"""
 1 # TraCI client #1
 2 traci.start(['sumo', '-c', '../MoSTScenario/scenario/most.traci.sumocfg',
 3  '--num-clients', '2'], port=59759, label='pypml')
 4 # TraCI client #2
 5 traci.init(port=59759, label='triggers')
 6
 7 _pypml_handler = traci.getConnection('pypml') # with and without 
simulationStep() after.
 8 _pypml_handler.setOrder(1) # number can be anything
 9 logging.info('PyPML TraCI client acquired.')
10
11 _triggers_handler = traci.getConnection('triggers')
12 _triggers_handler.setOrder(2) # number can be anything
13 logging.info('Triggers TraCI client acquired.')
"""

If I use them one at the time (connections only / multiple clients in separated 
files) all works
fine. Is there a way to use these 2 functionalities together?

Thanks in advance for your time :)

All the Best,
Lara

-- 
Lara CODECA
Postdoc
Tel : 04.93.00.81.51

EURECOM
Campus SophiaTech
http://www.eurecom.fr/
___
sumo-user mailing list
sumo-user@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user