shancx 1.9.33.162__tar.gz → 1.9.33.165__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 (94) hide show
  1. {shancx-1.9.33.162 → shancx-1.9.33.165}/PKG-INFO +1 -1
  2. {shancx-1.9.33.162 → shancx-1.9.33.165}/setup.py +1 -1
  3. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/NN/__init__.py +30 -32
  4. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/__init__.py +35 -3
  5. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/wait.py +4 -3
  6. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx.egg-info/PKG-INFO +1 -1
  7. {shancx-1.9.33.162 → shancx-1.9.33.165}/README.md +0 -0
  8. {shancx-1.9.33.162 → shancx-1.9.33.165}/setup.cfg +0 -0
  9. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/3D/__init__.py +0 -0
  10. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Class.py +0 -0
  11. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/CudaPrefetcher1.py +0 -0
  12. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Fake_image.py +0 -0
  13. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Hsml.py +0 -0
  14. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/L2Loss.py +0 -0
  15. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/MetricTracker.py +0 -0
  16. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Normalize.py +0 -0
  17. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/OptimizerWScheduler.py +0 -0
  18. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Rmageresize.py +0 -0
  19. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Savemodel.py +0 -0
  20. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/SmoothL1_losses.py +0 -0
  21. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/Tqdm.py +0 -0
  22. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/__init__.py +0 -0
  23. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/checknan.py +0 -0
  24. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/dsalgor.py +0 -0
  25. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/iouJU.py +0 -0
  26. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/mask.py +0 -0
  27. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/psnr.py +0 -0
  28. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/ssim.py +0 -0
  29. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/structural_similarity.py +0 -0
  30. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Algo/tool.py +0 -0
  31. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Calmetrics/__init__.py +0 -0
  32. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Calmetrics/calmetrics.py +0 -0
  33. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Calmetrics/calmetricsmatrixLib.py +0 -0
  34. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Calmetrics/rmseR2score.py +0 -0
  35. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Clip/__init__.py +0 -0
  36. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Command.py +0 -0
  37. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Df/DataFrame.py +0 -0
  38. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Df/__init__.py +0 -0
  39. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Df/tool.py +0 -0
  40. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Diffm/Psamples.py +0 -0
  41. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Diffm/__init__.py +0 -0
  42. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Diffm/test.py +0 -0
  43. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Doc/__init__.py +0 -0
  44. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/E/__init__.py +0 -0
  45. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Fillmiss/__init__.py +0 -0
  46. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Fillmiss/imgidwJU.py +0 -0
  47. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Fillmiss/imgidwLatLonJU.py +0 -0
  48. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Gpu/__init__.py +0 -0
  49. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/H9/__init__.py +0 -0
  50. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/H9/ahi_read_hsd.py +0 -0
  51. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/H9/ahisearchtable.py +0 -0
  52. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/H9/geometry.py +0 -0
  53. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Hug/__init__.py +0 -0
  54. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Inst.py +0 -0
  55. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Lib.py +0 -0
  56. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Mos/__init__.py +0 -0
  57. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Path.py +0 -0
  58. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/GlobMap.py +0 -0
  59. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/Gray2RGB.py +0 -0
  60. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/__init__.py +0 -0
  61. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/border.py +0 -0
  62. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/draw_day_CR_PNG.py +0 -0
  63. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/exam.py +0 -0
  64. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/radarNmc.py +0 -0
  65. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Plot/single_china_map.py +0 -0
  66. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Point.py +0 -0
  67. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/QC.py +0 -0
  68. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/RdPzl/__init__.py +0 -0
  69. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Read.py +0 -0
  70. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/SN/__init__.py +0 -0
  71. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Time/GetTime.py +0 -0
  72. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Time/__init__.py +0 -0
  73. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Time/timeCycle.py +0 -0
  74. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Time/tool.py +0 -0
  75. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Train/__init__.py +0 -0
  76. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Train/makelist.py +0 -0
  77. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Train/multiGpu.py +0 -0
  78. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Train/prepare.py +0 -0
  79. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/Train/renet50.py +0 -0
  80. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/ZR.py +0 -0
  81. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/args.py +0 -0
  82. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/bak.py +0 -0
  83. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/cmp.py +0 -0
  84. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/df2database.py +0 -0
  85. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/getResponse.py +0 -0
  86. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/info.py +0 -0
  87. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/netdfJU.py +0 -0
  88. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/sendM.py +0 -0
  89. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/tensBoard/__init__.py +0 -0
  90. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx/tool.py +0 -0
  91. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx.egg-info/SOURCES.txt +0 -0
  92. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx.egg-info/dependency_links.txt +0 -0
  93. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx.egg-info/requires.txt +0 -0
  94. {shancx-1.9.33.162 → shancx-1.9.33.165}/shancx.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shancx
3
- Version: 1.9.33.162
3
+ Version: 1.9.33.165
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
  setup(
5
5
  name="shancx",
6
- version="1.9.33.162",
6
+ version="1.9.33.165",
7
7
  packages=find_packages(),
8
8
  description="A simple timer decorator",
9
9
  long_description=open("README.md").read(),
@@ -11,11 +11,11 @@ __author_email__ = 'shancx@126.com'
11
11
  # @Time : 2023/09/27 下午8:52
12
12
  # @Author : shanchangxi
13
13
  # @File : util_log.py
14
-
15
14
  import logging
16
15
  from logging.handlers import RotatingFileHandler
17
16
  import os
18
- def _loggers(logger_name="loggers", root="./logs", phase="project", level=logging.INFO, screen=True, max_bytes=10*1024*1024, backup_count=5, overwrite=False,handlersflag=False):
17
+ from shancx import crDir
18
+ def _loggers(logger_name="loggers", root="./logs", phase="project", level=logging.INFO, screen=True, max_bytes=10*1024*1024, backup_count=5, overwrite=False,handlersflag=True):
19
19
  '''set up logger with rotating file handler'''
20
20
  l = logging.getLogger(logger_name)
21
21
  if handlersflag:
@@ -24,9 +24,7 @@ def _loggers(logger_name="loggers", root="./logs", phase="project", level=loggin
24
24
  formatter = logging.Formatter(
25
25
  "%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s", datefmt='%Y-%m-%d %H:%M:%S')
26
26
  log_file = os.path.join(root, '{}.log'.format(phase))
27
- log_dir = os.path.dirname(log_file)
28
- if not os.path.exists(log_dir):
29
- os.makedirs(log_dir, exist_ok=True)
27
+ crDir(log_file)
30
28
  # Use RotatingFileHandler with 'w' mode to overwrite log file if needed
31
29
  mode = 'w' if overwrite else 'a'
32
30
  fh = RotatingFileHandler(log_file, mode=mode, maxBytes=max_bytes, backupCount=backup_count)
@@ -66,30 +64,30 @@ if __name__ == "__main__":
66
64
  logger.info("这是一条INFO日志")
67
65
  '''
68
66
 
69
- import os
70
- from datetime import datetime
71
- from shancx.NN import _loggers
72
- from shancx import lock_file
73
- from shancx.wait import check_lock
74
- from shancx import crDir
75
- logger =_loggers()
76
- def check_process_data(UTC, sat_cd,basepath ="/mnt/wtx_weather_forecast/scx/test/lock_files" ):
77
- try:
78
- UTCStr = UTC.strftime("%Y%m%d%H%M")
79
- file = f"/mnt/wtx_weather_forecast/scx/test/lock_files/{sat_cd}/{UTCStr[:4]}/{UTCStr[:8]}/File_{UTCStr}.lock"
80
- crDir(file)
81
- if not lock_file(file):
82
- if check_lock(file):
83
- logger.info("data is making or maked")
84
- return True ,file
85
- return False,file
86
- except Exception as e:
87
- logger.error(f"Error in check_and_process_data: {str(e)}")
88
- return False,file
89
- """
90
- flag1,file = check_process_data(UTC, "H9SEAS" )
91
- if flag1:
92
- sys.exit()
93
- if os.path.exists(output_path): #配合使用
94
- sys.exit()
95
- """
67
+ # import os
68
+ # from datetime import datetime
69
+ # from shancx.NN import _loggers
70
+ # from shancx import lock_file
71
+ # from shancx.wait import check_lock
72
+ # from shancx import crDir
73
+ # logger =_loggers()
74
+ # def check_process_data(UTC, sat_cd,basepath ="/mnt/wtx_weather_forecast/scx/test/lock_files" ):
75
+ # try:
76
+ # UTCStr = UTC.strftime("%Y%m%d%H%M")
77
+ # file = f"/mnt/wtx_weather_forecast/scx/test/lock_files/{sat_cd}/{UTCStr[:4]}/{UTCStr[:8]}/File_{UTCStr}.lock"
78
+ # crDir(file)
79
+ # if not lock_file(file):
80
+ # if check_lock(file):
81
+ # logger.info("data is making or maked")
82
+ # return True ,file
83
+ # return False,file
84
+ # except Exception as e:
85
+ # logger.error(f"Error in check_and_process_data: {str(e)}")
86
+ # return False,file
87
+ # """
88
+ # flag1,file = check_process_data(UTC, "H9SEAS" )
89
+ # if flag1:
90
+ # sys.exit()
91
+ # if os.path.exists(output_path): #配合使用
92
+ # sys.exit()
93
+ # """
@@ -346,12 +346,12 @@ from pathlib import Path
346
346
  def lock_file(lock_file_path):
347
347
  if os.path.exists(lock_file_path):
348
348
  print(f" {lock_file_path} is existded ")
349
- return True
349
+ return False
350
350
  try:
351
351
  os.makedirs(os.path.dirname(lock_file_path), exist_ok=True)
352
352
  with open(lock_file_path, 'w') as f:
353
353
  f.write(f"process_id:{os.getpid()},create_time:{datetime.datetime.now()}")
354
- return False
354
+ return True
355
355
  except Exception as e:
356
356
  print(f"创建锁文件失败 create lock failed : {e}")
357
357
  return False
@@ -364,7 +364,39 @@ if os.path.exists(lock_file):
364
364
  print(f"锁文件存在,已有程序在处理时次 {utc_time_str},跳过")
365
365
  return False
366
366
  """
367
-
367
+ import os
368
+ import time
369
+ def is_process_alive(pid):
370
+ try:
371
+ os.kill(pid, 0)
372
+ return True
373
+ except OSError:
374
+ return False
375
+ def check_lock(lock_file):
376
+ if not os.path.exists(lock_file):
377
+ return False
378
+ try:
379
+ with open(lock_file, 'r') as f:
380
+ content = f.read().strip()
381
+ if 'process_id:' in content and 'create_time:' in content:
382
+ pid_str = content.split('process_id:')[1].split(',')[0]
383
+ pid = int(pid_str)
384
+ if not is_process_alive(pid):
385
+ print(f"进程 {pid} 已消亡,清理锁文件")
386
+ os.remove(lock_file)
387
+ return False
388
+ else:
389
+ print(f"进程 {pid} 仍在运行,跳过执行")
390
+ return True
391
+ except Exception as e:
392
+ print(f"锁文件解析错误,清理: {e}")
393
+ os.remove(lock_file)
394
+ return False
395
+ return False
396
+ """
397
+ if check_lock(lock_file):
398
+ return False
399
+ """
368
400
  import multiprocessing
369
401
  import sys
370
402
  from typing import Optional, Literal
@@ -167,8 +167,7 @@ def is_process_alive(pid):
167
167
  return False
168
168
  def check_lock(lock_file):
169
169
  if not os.path.exists(lock_file):
170
- logger.info(f"{lock_file} not exists error A lock file needs to be created. ")
171
- return False
170
+ return False
172
171
  try:
173
172
  with open(lock_file, 'r') as f:
174
173
  content = f.read().strip()
@@ -176,12 +175,14 @@ def check_lock(lock_file):
176
175
  pid_str = content.split('process_id:')[1].split(',')[0]
177
176
  pid = int(pid_str)
178
177
  if not is_process_alive(pid):
178
+ print(f"进程 {pid} 已消亡,清理锁文件")
179
179
  os.remove(lock_file)
180
180
  return False
181
181
  else:
182
+ print(f"进程 {pid} 仍在运行,跳过执行")
182
183
  return True
183
184
  except Exception as e:
184
- print(f"lock anaylysis error,clean : {e}")
185
+ print(f"锁文件解析错误,清理: {e}")
185
186
  os.remove(lock_file)
186
187
  return False
187
188
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shancx
3
- Version: 1.9.33.162
3
+ Version: 1.9.33.165
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
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