Hi Everyone,
Does nest server currently support nestml models? I couldn't find examples in the documentation (even though `nestml-server` binary exists in nest3.8 docker image). Ideally, I would like to run it with MPI too.
I can run a simple example (`python test.py`) with `nest-server` running from a docker container, but the same code fails if I use `nestml-server`:
```
docker run -it --rm -e LOCAL_USER_ID=`id -u $USER` -p 52425:52425 nest/nest-simulator:3.8 nest-server start
```
works, but
```
docker run -it --rm -e LOCAL_USER_ID=`id -u $USER` -p 52426:52426 nest/nest-simulator:3.8 nestml-server start
```
fails with
```
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 199, in _new_conn
sock = connection.create_connection(
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/connection.py", line 85, in create_connection
raise err
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 789, in urlopen
response = self._make_request(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 495, in _make_request
conn.request(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 441, in request
self.endheaders()
File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output
self.send(msg)
File "/usr/lib/python3.10/http/client.py", line 976, in send
self.connect()
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 279, in connect
self.sock = self._new_conn()
File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 214, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fb8b63ea440>: Failed to establish a new connection: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 843, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 519, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=52425): Max retries exceeded with url: /exec (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb8b63ea440>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pablo/git/nest-client/test_server.py", line 4, in <module>
response = nsc.from_file('examples/NESTClient_script.py', return_vars='n_events')
File "/home/pablo/git/nest-client/nest_client/nest_client.py", line 68, in from_file
return self.exec_script(script, return_vars)
File "/home/pablo/git/nest-client/nest_client/nest_client.py", line 56, in exec_script
response = requests.post(self.url + 'exec', json=params, headers=self.headers)
File "/usr/lib/python3/dist-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 544, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 657, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=52425): Max retries exceeded with url: /exec (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb8b63ea440>: Failed to establish a new connection: [Errno 111] Connection refused'))
```
The simple python code used is shown below.
```
from nest_client import NESTClient
nsc = NESTClient()
response = nsc.from_file('examples/NESTClient_script.py', return_vars='n_events')
n_events = response['data']
print('Number of events:', n_events)
```
No nestml models are being tested for now because I don't know which functions should be used to generate code with `nest-client` e.g.
```
from pynestml.codegeneration.nest_code_generator_utils import NESTCodeGeneratorUtils
module_name, neuron_model_name, synapse_model_name = \
NESTCodeGeneratorUtils.generate_code_for(
"neuron.nestml",
"synapse.nestml",
post_ports=["post_spikes"],
codegen_opts=codegen_opts
)
```
should be rewritten to use `from nest_client import NESTClient`.
Thanks in advance,
Pablo Alejandro