PyFemtet 0.3.1__tar.gz → 0.3.2__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.
Files changed (25) hide show
  1. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/PKG-INFO +1 -1
  2. pyfemtet-0.3.2/pyfemtet/__init__.py +1 -0
  3. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/dispatch_extensions.py +15 -8
  4. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyproject.toml +1 -1
  5. pyfemtet-0.3.1/pyfemtet/__init__.py +0 -1
  6. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/LICENSE +0 -0
  7. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/README.md +0 -0
  8. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
  9. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
  10. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +0 -0
  11. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
  12. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +0 -0
  13. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
  14. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/her_ex40_parametric.py +0 -0
  15. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +0 -0
  16. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
  17. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +0 -0
  18. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/_old/_SW_Femtet.py +0 -0
  19. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/core.py +0 -0
  20. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/_FemtetWithNX/update_model.py +0 -0
  21. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/__init__.py +0 -0
  22. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/_optimizer.py +0 -0
  23. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/base.py +0 -0
  24. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/interface.py +0 -0
  25. {pyfemtet-0.3.1 → pyfemtet-0.3.2}/pyfemtet/opt/monitor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyfemtet
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  Home-page: https://github.com/pyfemtet/pyfemtet
6
6
  License: BSD-3-Clause
@@ -0,0 +1 @@
1
+ __version__ = "0.3.2"
@@ -23,7 +23,7 @@ logger = logging.getLogger('dispatch_log')
23
23
  handler = logging.StreamHandler()
24
24
  handler.setFormatter(logging.Formatter('[%(process)d] %(message)s'))
25
25
  logger.addHandler(handler)
26
- # logger.setLevel(logging.INFO)
26
+ logger.setLevel(logging.INFO)
27
27
 
28
28
 
29
29
  DISPATCH_TIMEOUT = 60
@@ -285,13 +285,12 @@ def _block_other_femtets(
285
285
  start = time()
286
286
  while True:
287
287
  if connection_flags[-1]:
288
- break
288
+ logger.debug(f'{_log_prefix()}Main process seems to connect target Femtet. Exit immediately.')
289
+ return 1
289
290
  if time()-start > timeout_main_wait_for_us:
290
291
  logger.error(f'{_log_prefix()}Timed out while waiting for the main process.')
291
292
  return -1
292
293
  sleep(1)
293
- logger.debug(f'{_log_prefix()}Main process seems to connect target Femtet. Exit immediately.')
294
- return 1
295
294
 
296
295
 
297
296
  def dispatch_specific_femtet(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
@@ -323,7 +322,7 @@ def dispatch_specific_femtet(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, in
323
322
  return dispatch_specific_femtet_core(pid, timeout) # for logger, out of except.
324
323
 
325
324
 
326
- def dispatch_specific_femtet_core(pid, timeout=10) -> Tuple[IFemtet, int]:
325
+ def dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
327
326
  """Connect Femtet whose process id is specified.
328
327
 
329
328
  Warnings:
@@ -394,6 +393,7 @@ def dispatch_specific_femtet_core(pid, timeout=10) -> Tuple[IFemtet, int]:
394
393
 
395
394
  # 子プロセスの準備
396
395
  # with Manager() as manager:
396
+ start = time()
397
397
  from multiprocessing.managers import SyncManager
398
398
  m = SyncManager(ctx=_NestableSpawnContext())
399
399
  m.start()
@@ -423,11 +423,18 @@ def dispatch_specific_femtet_core(pid, timeout=10) -> Tuple[IFemtet, int]:
423
423
  processes.append(p)
424
424
 
425
425
  # 子プロセスの Dispatch 完了を待つ
426
- start = time()
427
426
  while True:
428
427
  if all(connection_flags[:-1]):
429
428
  break
430
- if time()-start > 10:
429
+ if time()-start > timeout:
430
+ # 子プロセスを終了する
431
+ for p in processes:
432
+ p.terminate()
433
+ p.join()
434
+ try:
435
+ lock_inter_subproc.release()
436
+ except RuntimeError:
437
+ pass
431
438
  raise FemtetConnectionTimeoutError(f'Connect trial with specific Femtet (pid = {pid}) is timed out in {timeout} sec')
432
439
  sleep(1)
433
440
 
@@ -458,5 +465,5 @@ def dispatch_specific_femtet_core(pid, timeout=10) -> Tuple[IFemtet, int]:
458
465
 
459
466
 
460
467
  if __name__ == '__main__':
461
- _Femtet, _my_pid = launch_and_dispatch_femtet()
468
+ _Femtet, _my_pid = launch_and_dispatch_femtet(5)
462
469
  # _Femtet, _my_pid = dispatch_specific_femtet(pid=26124)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyfemtet"
3
- version = "0.3.1" # ignored by versioning plugin
3
+ version = "0.3.2" # 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.1"
File without changes
File without changes
File without changes
File without changes