@@ -71,7 +71,7 @@ def test_submit_dryrun(self) -> None:
7171 app = _test_app ()
7272 with patch ("torchx.schedulers.docker_scheduler.make_unique" ) as make_unique_ctx :
7373 make_unique_ctx .return_value = "app_name_42"
74- info = self .scheduler ._submit_dryrun (app , cfg = {})
74+ info = self .scheduler .submit_dryrun (app , cfg = {})
7575
7676 want = DockerJob (
7777 "app_name_42" ,
@@ -109,6 +109,7 @@ def test_submit_dryrun(self) -> None:
109109 },
110110 "mem_limit" : "3000m" ,
111111 "shm_size" : "3000m" ,
112+ "privileged" : False ,
112113 "name" : "app_name_42-trainer-0" ,
113114 "hostname" : "app_name_42-trainer-0" ,
114115 "nano_cpus" : int (2e9 ),
@@ -137,7 +138,7 @@ def test_volume_mounts(self) -> None:
137138 specs .VolumeMount (src = "name" , dst_path = "/tmp" , read_only = True ),
138139 ]
139140
140- info = self .scheduler ._submit_dryrun (app , cfg = {})
141+ info = self .scheduler .submit_dryrun (app , cfg = {})
141142 want = [
142143 Mount (
143144 target = "/tmp" ,
@@ -154,15 +155,15 @@ def test_device_mounts(self) -> None:
154155 specs .DeviceMount (src_path = "foo" , dst_path = "bar" ),
155156 ]
156157
157- info = self .scheduler ._submit_dryrun (app , cfg = {})
158+ info = self .scheduler .submit_dryrun (app , cfg = {})
158159 self .assertEqual (info .request .containers [0 ].kwargs ["devices" ], ["foo:bar:rwm" ])
159160
160161 def test_resource_devices (self ) -> None :
161162 app = _test_app ()
162163 app .roles [0 ].mounts = []
163164 app .roles [0 ].resource .devices = {"vpc.amazonaws.com/efa" : 1 }
164165
165- info = self .scheduler ._submit_dryrun (app , cfg = {})
166+ info = self .scheduler .submit_dryrun (app , cfg = {})
166167 self .assertEqual (
167168 info .request .containers [0 ].kwargs ["devices" ],
168169 ["/dev/infiniband/uverbs0:/dev/infiniband/uverbs0:rwm" ],
@@ -174,7 +175,7 @@ def test_copy_env(self) -> None:
174175 cfg = DockerOpts ({"copy_env" : ["FOO_*" , "BAR_*" ]})
175176 with patch ("torchx.schedulers.docker_scheduler.make_unique" ) as make_unique_ctx :
176177 make_unique_ctx .return_value = "app_name_42"
177- info = self .scheduler ._submit_dryrun (app , cfg )
178+ info = self .scheduler .submit_dryrun (app , cfg )
178179 self .assertEqual (
179180 info .request .containers [0 ].kwargs ["environment" ],
180181 {
@@ -190,7 +191,7 @@ def test_env(self) -> None:
190191 cfg = DockerOpts ({"env" : {"FOO_1" : "BAR_1" }})
191192 with patch ("torchx.schedulers.docker_scheduler.make_unique" ) as make_unique_ctx :
192193 make_unique_ctx .return_value = "app_name_42"
193- info = self .scheduler ._submit_dryrun (app , cfg )
194+ info = self .scheduler .submit_dryrun (app , cfg )
194195 self .assertEqual (
195196 info .request .containers [0 ].kwargs ["environment" ],
196197 {
@@ -200,13 +201,21 @@ def test_env(self) -> None:
200201 },
201202 )
202203
204+ def test_privileged (self ) -> None :
205+ app = _test_app ()
206+ cfg = DockerOpts ({"privileged" : True })
207+ with patch ("torchx.schedulers.docker_scheduler.make_unique" ) as make_unique_ctx :
208+ make_unique_ctx .return_value = "app_name_42"
209+ info = self .scheduler .submit_dryrun (app , cfg )
210+ self .assertTrue (info .request .containers [0 ].kwargs ["privileged" ])
211+
203212 def test_long_hostname (self ) -> None :
204213 app = _test_app ()
205214 for role in app .roles :
206215 role .name = "ethology_explore_magic_calliope_divisive_whirl_dealt_lotus_oncology_facet_deerskin_blum_elective_spill_trammel_trainer"
207216 with patch ("torchx.schedulers.docker_scheduler.make_unique" ) as make_unique_ctx :
208217 make_unique_ctx .return_value = "ethology_explore_magic_calliope_divisive_whirl_dealt_lotus_oncology_facet_deerskin_blum_elective_spill_trammel_12345"
209- info = self .scheduler ._submit_dryrun (app , DockerOpts ())
218+ info = self .scheduler .submit_dryrun (app , DockerOpts ())
210219 for container in info .request .containers :
211220 assert "name" in container .kwargs
212221 name = container .kwargs ["name" ]
0 commit comments