Skip to content

Commit 91cd28d

Browse files
committed
remove unnessary try...except
1 parent e42b77c commit 91cd28d

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

deepmd/env.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,14 @@
5454
LRU_CACHE_SIZE = _default_lru_cache_size
5555

5656
if platform.system() != "Windows":
57-
try:
58-
import resource
59-
60-
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
61-
safe_buffer = 128
62-
if soft_limit > safe_buffer + _default_lru_cache_size:
63-
LRU_CACHE_SIZE = soft_limit - safe_buffer
64-
else:
65-
LRU_CACHE_SIZE = soft_limit // 2
66-
except ImportError:
67-
LRU_CACHE_SIZE = _default_lru_cache_size
57+
import resource
58+
59+
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
60+
safe_buffer = 128
61+
if soft_limit > safe_buffer + _default_lru_cache_size:
62+
LRU_CACHE_SIZE = soft_limit - safe_buffer
63+
else:
64+
LRU_CACHE_SIZE = soft_limit // 2
6865

6966

7067
def set_env_if_empty(key: str, value: str, verbose: bool = True) -> None:

deepmd/utils/data.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,7 @@ def get_single_frame(self, index: int) -> dict:
410410
}
411411
for future in as_completed(future_to_key):
412412
key = future_to_key[future]
413-
try:
414-
frame_data["find_" + key], frame_data[key] = future.result()
415-
except Exception:
416-
log.exception("Key %r generated an exception", key)
417-
raise
413+
frame_data["find_" + key], frame_data[key] = future.result()
418414

419415
# 3. Compute reduced items from already loaded data
420416
for key in reduced_keys:

0 commit comments

Comments
 (0)