Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable OMCSessionZMQ to connect to an already running omc #148

Open
bilderbuchi opened this issue Dec 9, 2021 · 5 comments
Open

Enable OMCSessionZMQ to connect to an already running omc #148

bilderbuchi opened this issue Dec 9, 2021 · 5 comments

Comments

@bilderbuchi
Copy link

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.

@sjoelund
Copy link
Member

sjoelund commented 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
Copy link
Author

bilderbuchi commented Dec 9, 2021

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
Copy link
Collaborator

arun3688 commented Dec 9, 2021

@bilderbuchi , I guess we could use the existing port argument to connect to an existing omc connection, I can add that feature

@bilderbuchi
Copy link
Author

bilderbuchi commented Dec 10, 2021

@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.

@scottlittle
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants