File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
onlinejudge_verify/languages Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Python Version: 3.x
2
+ import concurrent .futures
2
3
import functools
3
4
import pathlib
5
+ import platform
4
6
import sys
5
7
import textwrap
6
8
from logging import getLogger
@@ -53,7 +55,16 @@ def _python_list_depending_files(path: pathlib.Path, basedir: pathlib.Path) -> L
53
55
importlab .fs .Path ([importlab .fs .OSFileSystem (str (basedir .resolve ()))]),
54
56
(sys .version_info .major , sys .version_info .minor ),
55
57
)
56
- res_graph = importlab .graph .ImportGraph .create (env , [str (path )])
58
+ try :
59
+ executor = concurrent .futures .ThreadPoolExecutor ()
60
+ future = executor .submit (importlab .graph .ImportGraph .create , env , [str (path )])
61
+ if platform .uname ().system == 'Windows' :
62
+ timeout = 5.0 # 1.0 sec causes timeout on CI using Windows
63
+ else :
64
+ timeout = 1.0
65
+ res_graph = future .result (timeout = timeout )
66
+ except concurrent .futures .TimeoutError as e :
67
+ raise RuntimeError (f"Failed to analyze the dependency graph (timeout): { path } " ) from e
57
68
try :
58
69
node_deps_pairs = res_graph .deps_list () # type: List[Tuple[str, List[str]]]
59
70
except Exception as e :
You can’t perform that action at this time.
0 commit comments