File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -11,22 +11,24 @@ def get_configured_num_workers(config):
1111 return n_workers
1212
1313
14+ def auto_or_int (val ):
15+ if val == "auto" :
16+ logical_cpus = get_logical_cpus ()
17+ return logical_cpus if logical_cpus is not None else 1
18+ return int (val )
19+
20+
1421def get_num_workers (item ):
1522 n_workers = get_configured_num_workers (item .config )
1623 # TODO: deprecate in favor of parallel_threads_limit
1724 marker_used = False
1825 marker = item .get_closest_marker ("parallel_threads" )
1926 if marker is not None :
2027 marker_used = True
21- val = marker .args [0 ]
22- if val == "auto" :
23- logical_cpus = get_logical_cpus ()
24- n_workers = logical_cpus if logical_cpus is not None else 1
25- else :
26- n_workers = int (val )
28+ n_workers = auto_or_int (marker .args [0 ])
2729 limit_marker = item .get_closest_marker ("parallel_threads_limit" )
2830 if limit_marker is not None :
29- val = int (limit_marker .args [0 ])
31+ val = auto_or_int (limit_marker .args [0 ])
3032 if val == 1 :
3133 marker_used = True
3234 if n_workers > val :
You can’t perform that action at this time.
0 commit comments