Skip to content

Enable OMCSessionZMQ to connect to an already running omc #148

Closed

Description

@bilderbuchi

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.

Activity

  1. sjoelund commented on Dec 9, 2021

    @sjoelund
    Member

    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.

  2. bilderbuchi commented on Dec 9, 2021

    @bilderbuchi
    Author

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

  3. arun3688 commented on Dec 9, 2021

    @arun3688
    Collaborator

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

  4. bilderbuchi commented on Dec 10, 2021

    @bilderbuchi
    Author

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

  5. scottlittle commented on Jun 24, 2024

    @scottlittle

    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.

  6. syntron commented on Jun 14, 2025

    @syntron
    Contributor

    See PR #295 ;-)

  7. added this to the 4.0.0 milestone on Jun 17, 2025
  8. added theissue type on Jun 17, 2025
  9. adeas31 commented on Aug 21, 2025

    @adeas31
    Member

    @syntron this is supported now, right?

  10. syntron commented on Aug 21, 2025

    @syntron
    Contributor

    @adeas31 yes it is supported - see OMCSession.OMCProcessPort or as example: test_ZMQ.test_omcprocessport_execute()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions