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

interop in linux :feature request: #43

Closed
bakuzen opened this issue Feb 12, 2020 · 6 comments
Closed

interop in linux :feature request: #43

bakuzen opened this issue Feb 12, 2020 · 6 comments

Comments

@bakuzen
Copy link

bakuzen commented Feb 12, 2020

Interop works beautifully when the psi app is running in Windows (and I can interop with Linux modules in other languages) using zmq. However, I'd like to setup an app on a Linux box and it would be really helpful to have interop capabilities.

@AshleyF
Copy link
Contributor

AshleyF commented Feb 13, 2020

What specific issue are you running into? In the latest release, interop (Microsoft.Psi.Interop) as well as the core \psi runtime are .NET Standard libraries and are expected to work cross-platform (any mixture of Linux/Mac/Windows). Please let us know of roadblocks we can investigate.

@bakuzen
Copy link
Author

bakuzen commented Feb 13, 2020

It might be a version problem. Here's my command and the response:

>dotnet add package Microsoft.Psi.Interop Writing /tmp/tmpFbCiBD.tmp info : Adding PackageReference for package 'Microsoft.Psi.Interop' into project '/home/casey/psi_logger/psi_logger.csproj'. info : Restoring packages for /home/casey/psi_logger/psi_logger.csproj... info : GET https://api.nuget.org/v3-flatcontainer/microsoft.psi.interop/index.json info : OK https://api.nuget.org/v3-flatcontainer/microsoft.psi.interop/index.json 229ms error: Unable to find a stable package Microsoft.Psi.Interop with version error: - Found 5 version(s) in nuget.org [ Nearest version: 0.10.16.1-beta ] error: Package 'Microsoft.Psi.Interop' is incompatible with 'all' frameworks in project '/home/casey/psi_logger/psi_logger.csproj'.

@AshleyF
Copy link
Contributor

AshleyF commented Feb 13, 2020

Very strange! I can repro this. However, if I append a specific version it works: dotnet add package Microsoft.Psi.Interop -v 0.10.16.0-beta.

@AshleyF
Copy link
Contributor

AshleyF commented Feb 13, 2020

BTW, I just verified that the following works with both ends running under Ubuntu. Hopefully this works for you:

import zmq, json

socket = zmq.Context().socket(zmq.SUB)
socket.connect("tcp://localhost:12345")
socket.setsockopt(zmq.SUBSCRIBE, '')

while True:
   [topic, message] = socket.recv_multipart()
   j = json.loads(message)
   print "Message: ", repr(j['message'])
using System;
using Microsoft.Psi;
using Microsoft.Psi.Interop;
using Microsoft.Psi.Interop.Format;
using Microsoft.Psi.Interop.Serialization;
using Microsoft.Psi.Interop.Transport;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var p = Pipeline.Create())
            {
	        var gen = Generators.Range(p, 0, 1000, TimeSpan.FromMilliseconds(100));
                var sin = gen.Select(x => Math.Sin(x / 100.0));
                var mq = new NetMQWriter<double>(p, "sin-topic", "tcp://localhost:12345", JsonFormat.Instance);
                sin.PipeTo(mq);
                p.Run();
            }
        }
    }
}

@bakuzen
Copy link
Author

bakuzen commented Feb 13, 2020

That worked! Thank you!

(though I needed to use the same version for Microsoft.Psi.Runtime)

@AshleyF
Copy link
Contributor

AshleyF commented Apr 15, 2020

Glad it worked. I'm closing this issue, but please feel free to reopen it if you're still having trouble.

@AshleyF AshleyF closed this as completed Apr 15, 2020
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

2 participants