2222 generate_unique_instance_name ,
2323 generate_unique_volume_name ,
2424 get_gateway_user_data ,
25- get_job_instance_name ,
2625 get_user_data ,
2726 merge_tags ,
2827)
3938 InstanceConfiguration ,
4039 InstanceOffer ,
4140 InstanceOfferWithAvailability ,
42- SSHKey ,
4341)
4442from dstack ._internal .core .models .placement import PlacementGroup , PlacementGroupProvisioningData
4543from dstack ._internal .core .models .resources import Memory , Range
46- from dstack ._internal .core .models .runs import Job , JobProvisioningData , Requirements , Run
44+ from dstack ._internal .core .models .runs import JobProvisioningData , Requirements
4745from dstack ._internal .core .models .volumes import (
4846 Volume ,
4947 VolumeAttachmentData ,
@@ -69,14 +67,14 @@ class AWSVolumeBackendData(CoreModel):
6967
7068
7169class AWSCompute (
72- Compute ,
7370 ComputeWithCreateInstanceSupport ,
7471 ComputeWithMultinodeSupport ,
7572 ComputeWithReservationSupport ,
7673 ComputeWithPlacementGroupSupport ,
7774 ComputeWithGatewaySupport ,
7875 ComputeWithPrivateGatewaySupport ,
7976 ComputeWithVolumeSupport ,
77+ Compute ,
8078):
8179 def __init__ (self , config : AWSConfig ):
8280 super ().__init__ ()
@@ -285,44 +283,6 @@ def create_instance(
285283 continue
286284 raise NoCapacityError ()
287285
288- def run_job (
289- self ,
290- run : Run ,
291- job : Job ,
292- instance_offer : InstanceOfferWithAvailability ,
293- project_ssh_public_key : str ,
294- project_ssh_private_key : str ,
295- volumes : List [Volume ],
296- ) -> JobProvisioningData :
297- # TODO: run_job is the same for vm-based backends, refactor
298- instance_config = InstanceConfiguration (
299- project_name = run .project_name ,
300- instance_name = get_job_instance_name (run , job ), # TODO: generate name
301- ssh_keys = [
302- SSHKey (public = project_ssh_public_key .strip ()),
303- ],
304- user = run .user ,
305- volumes = volumes ,
306- reservation = run .run_spec .configuration .reservation ,
307- )
308- instance_offer = instance_offer .copy ()
309- if len (volumes ) > 0 :
310- volume = volumes [0 ]
311- if (
312- volume .provisioning_data is not None
313- and volume .provisioning_data .availability_zone is not None
314- ):
315- if instance_offer .availability_zones is None :
316- instance_offer .availability_zones = [
317- volume .provisioning_data .availability_zone
318- ]
319- instance_offer .availability_zones = [
320- z
321- for z in instance_offer .availability_zones
322- if z == volume .provisioning_data .availability_zone
323- ]
324- return self .create_instance (instance_offer , instance_config )
325-
326286 def create_placement_group (
327287 self ,
328288 placement_group : PlacementGroup ,
0 commit comments