15
15
import ray ._private .services as services
16
16
from ray .autoscaler ._private .util import prepare_config , validate_config
17
17
from ray .autoscaler ._private import commands
18
- from ray .autoscaler ._private . docker import DOCKER_MOUNT_PREFIX
18
+ from ray .autoscaler .sdk import get_docker_host_mount_location
19
19
from ray .autoscaler ._private .load_metrics import LoadMetrics
20
20
from ray .autoscaler ._private .autoscaler import StandardAutoscaler
21
21
from ray .autoscaler ._private .providers import (_NODE_PROVIDERS ,
@@ -502,14 +502,18 @@ def testGetOrCreateHeadNode(self):
502
502
runner .assert_has_call ("1.2.3.4" , "start_ray_head" )
503
503
self .assertEqual (self .provider .mock_nodes [0 ].node_type , None )
504
504
runner .assert_has_call ("1.2.3.4" , pattern = "docker run" )
505
+
506
+ docker_mount_prefix = get_docker_host_mount_location (
507
+ SMALL_CLUSTER ["cluster_name" ])
505
508
runner .assert_not_has_call (
506
- "1.2.3.4" , pattern = "-v /tmp/ray_tmp_mount/~/ray_bootstrap_config" )
507
- runner .assert_has_call (
508
509
"1.2.3.4" ,
509
- pattern = "docker cp /tmp/ray_tmp_mount/~/ray_bootstrap_key.pem " )
510
+ pattern = f"-v { docker_mount_prefix } /~/ray_bootstrap_config " )
510
511
runner .assert_has_call (
511
512
"1.2.3.4" ,
512
- pattern = "docker cp /tmp/ray_tmp_mount/~/ray_bootstrap_config.yaml" )
513
+ pattern = f"docker cp { docker_mount_prefix } /~/ray_bootstrap_key.pem" )
514
+ pattern_to_assert = \
515
+ f"docker cp { docker_mount_prefix } /~/ray_bootstrap_config.yaml"
516
+ runner .assert_has_call ("1.2.3.4" , pattern = pattern_to_assert )
513
517
514
518
@unittest .skipIf (sys .platform == "win32" , "Failing on Windows." )
515
519
def testRsyncCommandWithDocker (self ):
@@ -1473,12 +1477,13 @@ def testContinuousFileMounts(self):
1473
1477
self .waitForNodes (
1474
1478
2 , tag_filters = {TAG_RAY_NODE_STATUS : STATUS_UP_TO_DATE })
1475
1479
autoscaler .update ()
1476
-
1480
+ docker_mount_prefix = get_docker_host_mount_location (
1481
+ config ["cluster_name" ])
1477
1482
for i in [0 , 1 ]:
1478
1483
runner .assert_has_call (f"172.0.0.{ i } " , "setup_cmd" )
1479
1484
runner .assert_has_call (
1480
1485
f"172.0.0.{ i } " ,
f"{ file_mount_dir } / [email protected] .{ i } :"
1481
- f"{ DOCKER_MOUNT_PREFIX } /home/test-folder/" )
1486
+ f"{ docker_mount_prefix } /home/test-folder/" )
1482
1487
1483
1488
runner .clear_history ()
1484
1489
@@ -1498,7 +1503,7 @@ def testContinuousFileMounts(self):
1498
1503
runner .assert_has_call (
1499
1504
f"172.0.0.{ i } " , f"172.0.0.{ i } " ,
1500
1505
f"{ file_mount_dir } / [email protected] .{ i } :"
1501
- f"{ DOCKER_MOUNT_PREFIX } /home/test-folder/" )
1506
+ f"{ docker_mount_prefix } /home/test-folder/" )
1502
1507
1503
1508
def testFileMountsNonContinuous (self ):
1504
1509
file_mount_dir = tempfile .mkdtemp ()
@@ -1525,13 +1530,15 @@ def testFileMountsNonContinuous(self):
1525
1530
self .waitForNodes (
1526
1531
2 , tag_filters = {TAG_RAY_NODE_STATUS : STATUS_UP_TO_DATE })
1527
1532
autoscaler .update ()
1533
+ docker_mount_prefix = get_docker_host_mount_location (
1534
+ config ["cluster_name" ])
1528
1535
1529
1536
for i in [0 , 1 ]:
1530
1537
runner .assert_has_call (f"172.0.0.{ i } " , "setup_cmd" )
1531
1538
runner .assert_has_call (
1532
1539
f"172.0.0.{ i } " , f"172.0.0.{ i } " ,
1533
1540
f"{ file_mount_dir } / [email protected] .{ i } :"
1534
- f"{ DOCKER_MOUNT_PREFIX } /home/test-folder/" )
1541
+ f"{ docker_mount_prefix } /home/test-folder/" )
1535
1542
1536
1543
runner .clear_history ()
1537
1544
@@ -1548,7 +1555,7 @@ def testFileMountsNonContinuous(self):
1548
1555
runner .assert_not_has_call (f"172.0.0.{ i } " , "setup_cmd" )
1549
1556
runner .assert_not_has_call (
1550
1557
f"172.0.0.{ i } " ,
f"{ file_mount_dir } / [email protected] .{ i } :"
1551
- f"{ DOCKER_MOUNT_PREFIX } /home/test-folder/" )
1558
+ f"{ docker_mount_prefix } /home/test-folder/" )
1552
1559
1553
1560
# Simulate a second `ray up` call
1554
1561
from ray .autoscaler ._private import util
@@ -1574,7 +1581,7 @@ def testFileMountsNonContinuous(self):
1574
1581
runner .assert_has_call (
1575
1582
f"172.0.0.{ i } " , f"172.0.0.{ i } " ,
1576
1583
f"{ file_mount_dir } / [email protected] .{ i } :"
1577
- f"{ DOCKER_MOUNT_PREFIX } /home/test-folder/" )
1584
+ f"{ docker_mount_prefix } /home/test-folder/" )
1578
1585
1579
1586
1580
1587
if __name__ == "__main__" :
0 commit comments