File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 11import pytest
2+ import ray
3+ from ray .cluster_utils import Cluster
24
35from pydvl .utils .config import ParallelConfig
46
57
6- @pytest .fixture (scope = "session" , params = ["sequential" , "ray" ])
8+ @pytest .fixture (scope = "session" , params = ["sequential" , "ray-local" , "ray-external " ])
79def parallel_config (request ):
8- return ParallelConfig (backend = request .param )
10+ if request .param == "sequential" :
11+ yield ParallelConfig (backend = request .param )
12+ elif request .param == "ray-local" :
13+ yield ParallelConfig (backend = "ray" )
14+ ray .shutdown ()
15+ elif request .param == "ray-external" :
16+ # Starts a head-node for the cluster.
17+ cluster = Cluster (
18+ initialize_head = True ,
19+ head_node_args = {
20+ "num_cpus" : 4 ,
21+ },
22+ )
23+ yield ParallelConfig (backend = "ray" , address = cluster .address )
24+ ray .shutdown ()
25+ cluster .shutdown ()
You can’t perform that action at this time.
0 commit comments