Message Boards Message Boards

Run ChannelListeners in remote kernel or local kernel?


Has anyone had any success on running a channel listener in a kernel. eg

  1. Create Channel (CreateChannel["test" ])
  2. Spin up kernel to process resuls
  3. Send channel message from another process.

I can not get the channel listener active in this scenario. When I run it from the front end it works but in the kernel it does not. Any suggestions would be appreciated:

     list = {1,   2}; 
   ParallelMap[{Print["Processing job: ", #]; 
   listener = ChannelListen["test", myfunc]; 
   Print["listener: ", listener, " kern ", $KernelID, " job ", #]; 
   Pause[60]} &, list]

   myfunc[a_Association] := 
      Print["printed from my func", a , " in kern: ", $KernelID] ];

IN ANOTHER SESSION: ChannelSend["test", <|"a" -> "hello", "msg" -> RandomReal[]|>]

POSTED BY: Scott Sproule
1 year ago

Group Abstract Group Abstract