Hello Sebastian,

Thanks for your reply. It's very helpful.

I had to get the raw content of the docker-compose.yml file provided because wget was giving HTML headers. Other than that, everything worked until the part below:
```
requests.post('http://localhost:52426/generateModels', data={
   'module': 'nestmlmodule',
   'models': models
})
```
where I get the output "<Response [400]>" and the server side does not respond. At the moment I am using this iaf model to ensure it's not a model problem. Get request seem to be working, but post to generateModel isn't e.g.

```
>>> resp=requests.post('http://localhost:52426/generateModels', data=data)
>>> print(resp.content)
b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>&#x27;NoneType&#x27; object has no attribute &#x27;get&#x27;</p>\n'
>>> resp=requests.get('http://localhost:52426/')
>>> print(resp.content)
b'{"nest":"3.8.0","nestml":"8.0.0-rc3"}\n'
```
I also realise that no directories were created in the process so maybe that's why? I see there's the function `do_generate_models()` in here that should do something like that.

Finally, I just wanted to clarify that I want to simulate our models on a computer cluster that supports NEST server. NESTML is necessary because of its flexibility in creating models. Docker, on the other hand, is not really required; I'm just using it for convenience. Please let me know if I should switch to a different installation method.

Thanks


On Wed, Jan 15, 2025 at 7:04 PM Sebastian Spreizer <spreizer@web.de> wrote:

Hello Pablo,


I apologize for the second mail.

I used wrong namespace of NEST Client because I looked into example file of NEST Client.
I have already created PR to fix the wrong namespace in example.

it should be:
```
from nest_client import NESTClient
nestsc = NESTClient()
...


```

Best
Sebastian


On 1/15/25 01:13, Pablo Alejandro wrote:

Hi Everyone,

Apologies for sending the message below again. I think my last post was done incorrectly and no one got notifications.

-----------------------------------------

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


_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org


--
Pablo Alejandro