@@ -66,30 +66,30 @@ def __init__(self, hostname, port, server_path=""):
66
66
self .hostname = hostname
67
67
self .port = port
68
68
69
- #start server locally
69
+ # start server locally
70
70
if (hostname .lower () == "localhost" or hostname == LOCALHOST ) and not DynaSolver .grpc_local_server_on ():
71
- #LOG.debug("Starting solver server")
72
-
71
+ # LOG.debug("Starting solver server")
72
+
73
73
if len (server_path ) == 0 :
74
- server_path = os .getenv (' ANSYS_PYDYNA_SOLVER_SERVER_PATH' )
75
- if server_path is None :
76
- print (' Please set the environment variable for ANSYS_PYDYNA_SOLVER_SERVER_PATH' )
77
- return
74
+ server_path = os .getenv (" ANSYS_PYDYNA_SOLVER_SERVER_PATH" )
75
+ if server_path is None :
76
+ print (" Please set the environment variable for ANSYS_PYDYNA_SOLVER_SERVER_PATH" )
77
+ return
78
78
if os .path .isdir (server_path ):
79
79
threadserver = ServerThread (1 , port = port , ip = hostname , server_path = server_path )
80
- #threadserver.setDaemon(True)
80
+ # threadserver.setDaemon(True)
81
81
threadserver .start ()
82
82
waittime = 0
83
83
while not DynaSolver .grpc_local_server_on ():
84
84
sleep (5 )
85
85
waittime += 5
86
86
print (waittime )
87
87
if waittime > 60 :
88
- print (' Failed to start pydyna solver server locally' )
88
+ print (" Failed to start pydyna solver server locally" )
89
89
break
90
-
90
+
91
91
else :
92
- print (' Failed to start pydyna solver server locally,Invalid server path!' )
92
+ print (" Failed to start pydyna solver server locally,Invalid server path!" )
93
93
94
94
temp = hostname + ":" + str (port )
95
95
self .channel = grpc .insecure_channel (temp )
@@ -112,7 +112,7 @@ def __init__(self, hostname, port, server_path=""):
112
112
# DynaSolver.logger.propagate = False
113
113
# self.logger = DynaSolver.logger
114
114
self .logger = logging .getLogger ("DynaSolver" )
115
-
115
+
116
116
@staticmethod
117
117
def grpc_local_server_on () -> bool :
118
118
"""Check if the server is launched locally.
@@ -298,7 +298,7 @@ def upload(self, fname):
298
298
#
299
299
# First packet contains the filename. The rest hold the contents.
300
300
#
301
- #self.logger.debug("upload: %s" % fname)
301
+ # self.logger.debug("upload: %s" % fname)
302
302
fsize = 0
303
303
304
304
def push_packets (fname ):
@@ -441,15 +441,15 @@ def start(self, nproc, solver_fname=""):
441
441
self .logger .debug ("start: %d" % nproc )
442
442
# request = dynasolver_pb2.DynaSolverStart()
443
443
request = DynaSolverStart ()
444
- #request.exename = b"mppdyna"
445
- request .exename = bytes (solver_fname ,' utf-8' )
444
+ # request.exename = b"mppdyna"
445
+ request .exename = bytes (solver_fname , " utf-8" )
446
446
request .nproc = nproc
447
447
response = self .stub .start_solver (request )
448
448
if response .status == tag .RUNNING :
449
449
raise RunningError ("LSDYNA is already running" )
450
450
return
451
451
452
- def start_locally (self , preset = "MPP_DOUBLE" ,input = "" , nproc = 1 ,memory = 20 ):
452
+ def start_locally (self , preset = "MPP_DOUBLE" , input = "" , nproc = 1 , memory = 20 ):
453
453
"""Begin execution with the given string as the command-line arguments.
454
454
455
455
Parameters
@@ -460,12 +460,12 @@ def start_locally(self, preset="MPP_DOUBLE",input="", nproc=1,memory=20):
460
460
461
461
self .logger .debug ("start: %d" % nproc )
462
462
request = DynaSolverStartLocal ()
463
- request .prset = bytes (preset ,' utf-8' )
464
- request .input = bytes (input ,' utf-8' )
463
+ request .prset = bytes (preset , " utf-8" )
464
+ request .input = bytes (input , " utf-8" )
465
465
request .nproc = nproc
466
466
request .memory = memory
467
467
response = self .stub .start_solver_locally (request )
468
- #if response.status == tag.RUNNING:
468
+ # if response.status == tag.RUNNING:
469
469
# raise RunningError("LSDYNA is already running")
470
470
return
471
471
0 commit comments