shancx 1.9.33.161__py3-none-any.whl → 1.9.33.163__py3-none-any.whl
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.
- shancx/__init__.py +5 -35
- shancx/wait.py +5 -4
- {shancx-1.9.33.161.dist-info → shancx-1.9.33.163.dist-info}/METADATA +1 -1
- {shancx-1.9.33.161.dist-info → shancx-1.9.33.163.dist-info}/RECORD +6 -6
- {shancx-1.9.33.161.dist-info → shancx-1.9.33.163.dist-info}/WHEEL +0 -0
- {shancx-1.9.33.161.dist-info → shancx-1.9.33.163.dist-info}/top_level.txt +0 -0
shancx/__init__.py
CHANGED
|
@@ -346,12 +346,14 @@ 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
|
-
|
|
349
|
+
loggers.info(f" {lock_file_path} is existded ")
|
|
350
|
+
return True
|
|
350
351
|
try:
|
|
351
352
|
os.makedirs(os.path.dirname(lock_file_path), exist_ok=True)
|
|
352
353
|
with open(lock_file_path, 'w') as f:
|
|
353
354
|
f.write(f"process_id:{os.getpid()},create_time:{datetime.datetime.now()}")
|
|
354
|
-
|
|
355
|
+
loggers.info(f"create lock file {lock_file_path}")
|
|
356
|
+
return False
|
|
355
357
|
except Exception as e:
|
|
356
358
|
print(f"创建锁文件失败 create lock failed : {e}")
|
|
357
359
|
return False
|
|
@@ -364,39 +366,7 @@ if os.path.exists(lock_file):
|
|
|
364
366
|
print(f"锁文件存在,已有程序在处理时次 {utc_time_str},跳过")
|
|
365
367
|
return False
|
|
366
368
|
"""
|
|
367
|
-
|
|
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
|
-
"""
|
|
369
|
+
|
|
400
370
|
import multiprocessing
|
|
401
371
|
import sys
|
|
402
372
|
from typing import Optional, Literal
|
shancx/wait.py
CHANGED
|
@@ -167,7 +167,8 @@ 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
|
-
|
|
170
|
+
logger.info(f"{lock_file} not exists error A lock file needs to be created. ")
|
|
171
|
+
return False
|
|
171
172
|
try:
|
|
172
173
|
with open(lock_file, 'r') as f:
|
|
173
174
|
content = f.read().strip()
|
|
@@ -175,14 +176,14 @@ def check_lock(lock_file):
|
|
|
175
176
|
pid_str = content.split('process_id:')[1].split(',')[0]
|
|
176
177
|
pid = int(pid_str)
|
|
177
178
|
if not is_process_alive(pid):
|
|
178
|
-
|
|
179
|
+
logger.info(f"not is_process_alive(pid)")
|
|
180
|
+
return False
|
|
179
181
|
os.remove(lock_file)
|
|
180
182
|
return False
|
|
181
183
|
else:
|
|
182
|
-
print(f"进程 {pid} 仍在运行,跳过执行")
|
|
183
184
|
return True
|
|
184
185
|
except Exception as e:
|
|
185
|
-
print(f"
|
|
186
|
+
print(f"lock anaylysis error,clean : {e}")
|
|
186
187
|
os.remove(lock_file)
|
|
187
188
|
return False
|
|
188
189
|
return False
|
|
@@ -6,7 +6,7 @@ shancx/Point.py,sha256=gyIomOVbNoz6SOcAhhTS26NHBeJ0TOwB-ljNsBWN1ZE,1909
|
|
|
6
6
|
shancx/QC.py,sha256=gVH1jAZ2tI-sDygozwfXQgLEJNJscFuzxexWXuXHWHw,2803
|
|
7
7
|
shancx/Read.py,sha256=xX4ciDoWhL9KAsN3cWvaFAOMlSVwR56AR3dSB-SBnLI,3139
|
|
8
8
|
shancx/ZR.py,sha256=5APchqVoI1G2MkrN9YJSWCwfLUygcSFIsUXSo9aq1Qg,341
|
|
9
|
-
shancx/__init__.py,sha256=
|
|
9
|
+
shancx/__init__.py,sha256=jxCbCTmGO1dkdvEBgJjGqC3k8iytopcm1g2eGC3QcAs,18816
|
|
10
10
|
shancx/args.py,sha256=Nr80vgQpT3m31_crKGf5DvofCxyERJFbqJ1sHb1BIqs,1042
|
|
11
11
|
shancx/bak.py,sha256=eKe2o1Yq7LCldoA-LXi14s_QNf1BkQsDsWJ7pDoscrw,25428
|
|
12
12
|
shancx/cmp.py,sha256=cIQv-QTl-22FJa6tmHyBu_IQmMq5LnsQGGFK5jc5hMA,893
|
|
@@ -16,7 +16,7 @@ shancx/info.py,sha256=0rk_L8Z5uj9RliaZrzT-CArH9ZObmdmcp-1RxAItL08,1122
|
|
|
16
16
|
shancx/netdfJU.py,sha256=96KR9NMLr2Kcs_OOMpX7QPujdWUj0GCEUIZ7_4_pBxw,7741
|
|
17
17
|
shancx/sendM.py,sha256=CEpeHavseWILlfevhfOMYxYUIWhh4fCNkXGRsEjMxBE,3352
|
|
18
18
|
shancx/tool.py,sha256=T1Uwsd5vcfKLEMGq7DmhPOmsnBNZgYq-QML8W2a6KTc,1027
|
|
19
|
-
shancx/wait.py,sha256=
|
|
19
|
+
shancx/wait.py,sha256=Vpx-4P4Vppjo6JjaWBKKQltPtcSg-FIXbo1oe7ExqzE,8609
|
|
20
20
|
shancx/3D/__init__.py,sha256=pDFvW1OOEW-ueXH50NJIYdWlySHZU6sr5htzHUSeROo,1000
|
|
21
21
|
shancx/Algo/Class.py,sha256=bxJ9JhIjoxl0hJfjO126YrnyHWDpxCEAZ7qcPs0Y0ic,377
|
|
22
22
|
shancx/Algo/CudaPrefetcher1.py,sha256=mUVlS3txsriET26ZMZ6DYOnyzWr8Tz6wThifzWrC7k8,3951
|
|
@@ -83,7 +83,7 @@ shancx/Train/multiGpu.py,sha256=D_oZeiSc7VWktpnVDwrFOC1CYZSt9rxOKY5lngE5vFg,820
|
|
|
83
83
|
shancx/Train/prepare.py,sha256=vL_8UOA66oZCBIwCICtihsGibivtNgaVJGulJxfNdn8,6793
|
|
84
84
|
shancx/Train/renet50.py,sha256=wEhYk1X96WE5zuqHqVxWLJa-A5jDNkz4z6edORNufnA,6428
|
|
85
85
|
shancx/tensBoard/__init__.py,sha256=ga2C5YyJITvvQA1ocpxna_KNFnNRJVwkTjLoIglLZUQ,993
|
|
86
|
-
shancx-1.9.33.
|
|
87
|
-
shancx-1.9.33.
|
|
88
|
-
shancx-1.9.33.
|
|
89
|
-
shancx-1.9.33.
|
|
86
|
+
shancx-1.9.33.163.dist-info/METADATA,sha256=0XB2IgkOomSLRVrhvCiupwS_OD68A3_-J1yVm4WnXHE,644
|
|
87
|
+
shancx-1.9.33.163.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
88
|
+
shancx-1.9.33.163.dist-info/top_level.txt,sha256=akfCS1vKWz3pNmEN_yN9ZiGp-60IQY5ET38mRx_i_-4,7
|
|
89
|
+
shancx-1.9.33.163.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|