Skip to content

Commit 90cb84d

Browse files
committed
debug
1 parent e049e52 commit 90cb84d

File tree

1 file changed

+3
-24
lines changed
  • src/python/espressomd

1 file changed

+3
-24
lines changed

src/python/espressomd/zn.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import subprocess
2121
import numpy as np
2222
import zndraw.type_defs
23-
import zndraw.zndraw
23+
import zndraw
2424
import zndraw.utils
2525
import zndraw.draw
2626
import znsocket
@@ -421,7 +421,6 @@ class Visualizer():
421421
"""
422422

423423
SERVER_PORT = None
424-
SOCKET_PORT = None
425424

426425
def __init__(self,
427426
system: espressomd.system.System = None,
@@ -488,12 +487,9 @@ def _start_server(self):
488487
"""
489488
Start the ZnDraw server through a subprocess
490489
"""
491-
self.socket_port = zndraw.utils.get_port(default=6374)
492-
493490
Visualizer.SERVER_PORT = self.port
494-
Visualizer.SOCKET_PORT = self.socket_port
495491

496-
self.server = subprocess.Popen(["zndraw", "--no-browser", f"--port={self.port}", f"--storage-port={self.socket_port}"],
492+
self.server = subprocess.Popen(["zndraw", "--no-browser", f"--port={self.port}"],
497493
stdout=subprocess.DEVNULL,
498494
stderr=subprocess.DEVNULL
499495
)
@@ -502,25 +498,8 @@ def _start_zndraw(self):
502498
"""
503499
Start the ZnDraw client and connect to the server
504500
"""
505-
config = zndraw.zndraw.TimeoutConfig(
506-
connection=10,
507-
modifier=0.25,
508-
between_calls=0.1,
509-
emit_retries=3,
510-
call_retries=1,
511-
connect_retries=3,
512-
)
513-
while True:
514-
try:
515-
self.r = znsocket.Client(
516-
address=f"{self.url}:{self.SOCKET_PORT}")
517-
break
518-
except BaseException:
519-
time.sleep(0.5)
520-
521501
url = f"{self.url}:{self.SERVER_PORT}"
522-
self.zndraw = zndraw.zndraw.ZnDrawLocal(
523-
r=self.r, url=url, token=self.token, timeout=config)
502+
self.zndraw = zndraw.ZnDraw(url=url, token=self.token)
524503
parsed_url = urllib.parse.urlparse(
525504
f"{self.zndraw.url}/token/{self.zndraw.token}")
526505
self.address = parsed_url._replace(scheme="http").geturl()

0 commit comments

Comments
 (0)