PyFemtet 0.3.4__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/PKG-INFO +1 -1
- pyfemtet-0.3.5/pyfemtet/__init__.py +1 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/dispatch_extensions.py +18 -3
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/opt/base.py +3 -3
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/opt/interface.py +8 -3
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyproject.toml +1 -1
- pyfemtet-0.3.4/pyfemtet/__init__.py +0 -1
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/LICENSE +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/README.md +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/her_ex40_parametric.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/_old/_SW_Femtet.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/core.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/logger.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/opt/_FemtetWithNX/update_model.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-0.3.4 → pyfemtet-0.3.5}/pyfemtet/opt/monitor.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.5"
|
|
@@ -144,11 +144,12 @@ def _get_subprocess_log_prefix():
|
|
|
144
144
|
return f'({current_process().name}) '
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
|
|
147
|
+
def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT, strict_pid_specify=True) -> Tuple[IFemtet, int]:
|
|
148
148
|
"""Launch Femtet by new process and connect to it.
|
|
149
149
|
|
|
150
150
|
Args:
|
|
151
151
|
timeout (int or float, optional): Seconds to wait for connection. Defaults to DISPATCH_TIMEOUT.
|
|
152
|
+
strict_pid_specify (bool): If True, try to connect the launched femtet process strictly. If False, launch new process but try to connect any connectable femtet.
|
|
152
153
|
|
|
153
154
|
Raises:
|
|
154
155
|
FemtetNotFoundException: Launched Femtet is not found for some reason (i.e. failed to launch Femtet).
|
|
@@ -157,12 +158,26 @@ def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
|
|
|
157
158
|
Returns:
|
|
158
159
|
Tuple[IFemtet, int]:
|
|
159
160
|
"""
|
|
161
|
+
# launch femtet
|
|
160
162
|
util.execute_femtet()
|
|
161
163
|
pid = util.get_last_executed_femtet_process_id()
|
|
162
164
|
logger.debug(f'Target pid is {pid}.')
|
|
163
|
-
for
|
|
165
|
+
for _ in tqdm(range(5), 'wait for launch femtet...'):
|
|
164
166
|
sleep(1)
|
|
165
|
-
|
|
167
|
+
|
|
168
|
+
# dispatch femtet
|
|
169
|
+
if strict_pid_specify:
|
|
170
|
+
Femtet, pid = dispatch_specific_femtet(pid, timeout)
|
|
171
|
+
else:
|
|
172
|
+
# worker process なら排他処理する
|
|
173
|
+
try:
|
|
174
|
+
with Lock('simply-dispatch-femtet'):
|
|
175
|
+
Femtet, pid = dispatch_femtet()
|
|
176
|
+
except RuntimeError as e:
|
|
177
|
+
if "distributed.lock.Lock" in str(e):
|
|
178
|
+
Femtet, pid = dispatch_femtet()
|
|
179
|
+
else:
|
|
180
|
+
raise e
|
|
166
181
|
return Femtet, pid
|
|
167
182
|
|
|
168
183
|
|
|
@@ -709,7 +709,7 @@ class AbstractOptimizer(ABC):
|
|
|
709
709
|
subprocess_idx,
|
|
710
710
|
worker_status_list,
|
|
711
711
|
wait_setup,
|
|
712
|
-
skip_set_fem,
|
|
712
|
+
skip_set_fem=False,
|
|
713
713
|
) -> None:
|
|
714
714
|
|
|
715
715
|
# 自分の worker_status の取得
|
|
@@ -1293,7 +1293,7 @@ class FEMOpt:
|
|
|
1293
1293
|
if not self.opt.is_cluster:
|
|
1294
1294
|
subprocess_indices = subprocess_indices[1:]
|
|
1295
1295
|
worker_addresses = list(self.client.nthreads().keys())
|
|
1296
|
-
assert
|
|
1296
|
+
assert max(subprocess_indices) <= len(worker_addresses)-1, f'コア数{len(worker_addresses)}は不足しています。'
|
|
1297
1297
|
worker_addresses = worker_addresses[:len(range(n_parallel))] # TODO: ノードごとに適度に振り分ける
|
|
1298
1298
|
if not self.opt.is_cluster:
|
|
1299
1299
|
worker_addresses[0] = 'Main'
|
|
@@ -1310,7 +1310,7 @@ class FEMOpt:
|
|
|
1310
1310
|
|
|
1311
1311
|
# actor の設定
|
|
1312
1312
|
self.status = OptimizationStatus(self.client)
|
|
1313
|
-
self.worker_status_list = [OptimizationStatus(self.client, name) for name in worker_addresses]
|
|
1313
|
+
self.worker_status_list = [OptimizationStatus(self.client, name) for name in worker_addresses] # tqdm 検討
|
|
1314
1314
|
self.status.set(OptimizationStatus.SETTING_UP)
|
|
1315
1315
|
self.history = History(self.history_path, self.client)
|
|
1316
1316
|
self.history.init(
|
|
@@ -9,7 +9,7 @@ import pandas as pd
|
|
|
9
9
|
import psutil
|
|
10
10
|
from pywintypes import com_error
|
|
11
11
|
from pythoncom import CoInitialize, CoUninitialize
|
|
12
|
-
from win32com.client import constants
|
|
12
|
+
from win32com.client import constants, Dispatch
|
|
13
13
|
from dask.distributed import get_worker
|
|
14
14
|
from femtetutils import util
|
|
15
15
|
|
|
@@ -119,6 +119,7 @@ class FemtetInterface(FEMInterface):
|
|
|
119
119
|
femprj_path=None,
|
|
120
120
|
model_name=None,
|
|
121
121
|
connect_method='auto',
|
|
122
|
+
strict_pid_specify=False,
|
|
122
123
|
**kwargs
|
|
123
124
|
):
|
|
124
125
|
"""Initializes the FemtetInterface.
|
|
@@ -144,12 +145,13 @@ class FemtetInterface(FEMInterface):
|
|
|
144
145
|
self.model_name = model_name
|
|
145
146
|
self.connect_method = connect_method
|
|
146
147
|
|
|
147
|
-
#
|
|
148
|
+
# その他のメンバーの宣言や初期化
|
|
148
149
|
self.Femtet = None
|
|
149
150
|
self.quit_when_destruct = False
|
|
150
151
|
self.connected_method = 'unconnected'
|
|
151
152
|
self.parameters = None
|
|
152
153
|
self.max_api_retry = 3
|
|
154
|
+
self.strict_pid_specify = strict_pid_specify
|
|
153
155
|
|
|
154
156
|
# dask サブプロセスのときは femprj を更新し connect_method を new にする
|
|
155
157
|
try:
|
|
@@ -198,9 +200,12 @@ class FemtetInterface(FEMInterface):
|
|
|
198
200
|
|
|
199
201
|
def _connect_new_femtet(self):
|
|
200
202
|
logger.info('└ Try to launch and connect new Femtet process.')
|
|
201
|
-
|
|
203
|
+
|
|
204
|
+
self.Femtet, _ = launch_and_dispatch_femtet(strict_pid_specify=self.strict_pid_specify)
|
|
205
|
+
|
|
202
206
|
self.connected_method = 'new'
|
|
203
207
|
|
|
208
|
+
|
|
204
209
|
def _connect_existing_femtet(self, pid: int or None = None):
|
|
205
210
|
logger.info('└ Try to connect existing Femtet process.')
|
|
206
211
|
# 既存の Femtet を探して Dispatch する。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyfemtet"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.5" # ignored by versioning plugin
|
|
4
4
|
description = "Design parameter optimization using Femtet."
|
|
5
5
|
authors = ["kazuma.naito <kazuma.naito@murata.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|