You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable OMCSessionZMQ to connect to an already running omc #148
As a user, I would like to be able to connect to an already running omc --interactive process that is listening at a certain host/port.
That is, I want OMCSessionZMQ to not start a separate omc process here if I pass in an endpoint, URI, socket/port that defines where my omc is listening.
This would be useful to enable OMPython to use an omc instance that is running elsewhere, e.g. in a managed container (that I can't start myself, so the present docker support does not help here) or on a (powerful) remote server.
OMC itself can be started to listen and perhaps you could connect to it. But it will only allow 1 connection and quits after the connection dies. It might not be so convenient to connect to it, but could perhaps be added as an option.
Sounds good! These restrictions would be OK for our use case.
I imagine I would independently start omc --interactive --interactivePort 666 and then in Python do session = OMCSessionZMQ(port=666) (could reuse the existing port argument), session = OMCSessionZMQ(uri='localhost:666') or session = OMCSessionZMQ(uri='\\SOMEMACHINE:666') etc.
If omc can be convinced to not die after a connection dies, that could be useful, but that need is not currently on my radar.
More than 1 concurrent connection I don't see as too useful, currently (I imagine that would need significant rework in omc, too).
@arun3688 great! I think that an additional host argument (defaulting to localhost) will be useful to pair with port, then one can easily assemble a proper connection string.
I would also like this feature. I am using a Mac host with a custom docker container with OpenModelica programs installed. I am able to connect to the container with a ZMQ session, but I am not able to use OMPython because of this.
Activity
sjoelund commentedon Dec 9, 2021
OMC itself can be started to listen and perhaps you could connect to it. But it will only allow 1 connection and quits after the connection dies. It might not be so convenient to connect to it, but could perhaps be added as an option.
bilderbuchi commentedon Dec 9, 2021
Sounds good! These restrictions would be OK for our use case.
I imagine I would independently start
omc --interactive --interactivePort 666and then in Python dosession = OMCSessionZMQ(port=666)(could reuse the existingportargument),session = OMCSessionZMQ(uri='localhost:666')orsession = OMCSessionZMQ(uri='\\SOMEMACHINE:666')etc.If omc can be convinced to not die after a connection dies, that could be useful, but that need is not currently on my radar.
More than 1 concurrent connection I don't see as too useful, currently (I imagine that would need significant rework in omc, too).
arun3688 commentedon Dec 9, 2021
@bilderbuchi , I guess we could use the existing
portargument to connect to an existing omc connection, I can add that featurebilderbuchi commentedon Dec 10, 2021
@arun3688 great! I think that an additional
hostargument (defaulting tolocalhost) will be useful to pair withport, then one can easily assemble a proper connection string.scottlittle commentedon Jun 24, 2024
I would also like this feature. I am using a Mac host with a custom docker container with OpenModelica programs installed. I am able to connect to the container with a ZMQ session, but I am not able to use OMPython because of this.
syntron commentedon Jun 14, 2025
See PR #295 ;-)
adeas31 commentedon Aug 21, 2025
@syntron this is supported now, right?
syntron commentedon Aug 21, 2025
@adeas31 yes it is supported - see OMCSession.OMCProcessPort or as example: test_ZMQ.test_omcprocessport_execute()