pyzmq

Limit number of cores used by OMPython

一个人想着一个人 提交于 2019-12-25 02:24:42
问题 Background I need to run a blocks simulation. I've used OMEdit to create the system and I call omc to run the simulation using OMPython with zmq for messaging. The simulation works fine but now I need to move it to a server to simulate the system for long times. Since the server is shared among a team of people, it uses slurm to queue the jobs. The server has 32 cores but they asked me to use only 8 while I tune my script and then 24 when I want to run my final simulation. I've configured

ZMQ socket connect timeout

天涯浪子 提交于 2019-12-24 21:36:23
问题 I'm trying to connect a socket to an endpoint until the socket receives data from that endpoint. This is because the endpoint might not exist at that time. Currently the connect stalls, i'm guessing because it can't resolve the hostname and that takes a while. Is there any way to set a timeout on a socket connect? import zmq import time endpoint = 'tcp://doesnt_exist:12345' ctx = zmq.Context.instance() s = ctx.socket(zmq.SUB) t = time.time() try: s.connect(endpoint) except Exception: pass

MQL5 Zmq PUB socket not being received by Python zmq SUB socket

随声附和 提交于 2019-12-24 01:56:08
问题 I'm trying to set up a PUB socket in MQL5 and a SUB socket in Python that will receive messages. I have this in MQL5: #include <Zmq/Zmq.mqh> Context context("helloworld"); Socket socket(context,ZMQ_PUB); string BROKER; int OnInit() { if (socket.bind("tcp://*:5556")) { Print("Error"); } else Print("Bound"); BROKER = AccountInfoString(ACCOUNT_COMPANY); return(INIT_SUCCEEDED); } void OnTick() { MqlTick last_tick; string str; if(SymbolInfoTick(Symbol(),last_tick)) { StringConcatenate(str, BROKER,

return value from zmq socket

别等时光非礼了梦想. 提交于 2019-12-24 00:45:50
问题 I am using Socket.IO to have a client webpage fetch data dynamically from my Node.JS server. On the server-side, I am forwarding the request to a Python backend using the zeromq socket library (REQ/REP structure, see the rrclient.js example from zguide). However, since my server is acting as the socket.io server, I have to wrap my response as follows in order to send it back to the specific client: socket.on('app_request',function(appRequest){ //route this request to the backend. var results

Reading the stdout from slave nodes with ipcluster

人走茶凉 提交于 2019-12-23 13:22:42
问题 I've set up a cluster using ipcluster start --n=8 then accessed it using from IPython.parallel import Client c=Client() dview=c[:] e=[i for i in c] I'm running processes on the slave nodes (e[0]-e[7]) which take a lot of time and I'd like them to send progress reports to the master so I can keep an eye on how far through they are. There are two ways I can think to do this but so far I haven't been able to implement either of them, despite hours of trawling through question pages. Either I

Cannot import zmq in python (install issue)

不想你离开。 提交于 2019-12-22 07:03:41
问题 I can't seem to install pyzmq on my macbook (OSX 10.9.1) First call was to run: sudo pip install pyzmq There was an error that libzmq couldn't be found, and it appeared to try and compile the bundled version: jono@air:~ $ sudo pip install pyzmq Password: Downloading/unpacking pyzmq Downloading pyzmq-14.0.1.tar.gz (867kB): 867kB downloaded Running setup.py egg_info for package pyzmq no previously-included directories found matching 'docs/build' no previously-included directories found matching

ZMQ REP, knowing who send the request

妖精的绣舞 提交于 2019-12-22 04:08:02
问题 I m currently using zmq with python. Server is using REP socket. Do I have a way, when recv a message, to know who send it ? If a receive 2 messages, I just need to know if they come from the same user or not, so an uid for example would be enough. 回答1: It looks like you want to implement async request handling on the server side: you let the server accept requests, process them asynchronously, and send the responses back to clients whenever the response data is available for each request.

Are there any Python 2.7 alternatives to ZeroMQ that are released under the BSD or MIT license?

半世苍凉 提交于 2019-12-21 17:33:30
问题 I am seeking Python 2.7 alternatives to ZeroMQ that are released under the BSD or MIT license. I am looking for something that supports request-reply and pub-sub messaging patterns. I can serialize the data myself if necessary. I found Twisted from Twisted Matrix Labs but it appears to require a blocking event loop, i.e. reactor.run(). I need a library that will run in the background and let my application check messages upon certain events. Are there any other alternatives? 回答1: Give nanomsg

How to expose a container port outside of docker/container using docker-compose?

南笙酒味 提交于 2019-12-21 04:54:08
问题 I have a container that it has several ports, I want to have access to one of its ports ( 9001 ) outside of this docker as remote. My docker IP is: 172.17.0.1 My container IP is: 172.19.0.23 My server IP is: 192.168.1.131 I have searched about that and I found expose port keyword, and I did it but not worked. How to expose docker ports to make your containers externally accessible Reference This is my docker-compose file: version: '3' services: nginx: image: nginx:latest container_name: nginx

How could I set hwm in the push/pull pattern of zmq?

好久不见. 提交于 2019-12-20 05:31:25
问题 I have found a similar question, ZeroMQ: HWM on PUSH does not work, but it couldn't solve my problem. I want to control the number of messages that the push socket queues, but it doesn't work and still queues 1000 messages. So I want to know how to set the hwm of the push socket. Thanks in advance. My environment is: libzmq 4.0.4, pyzmq 14.1.0, python 3.3 Here's my code: server.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import random import zmq class TestPush(object): def __init__(self