@@ -137,10 +137,11 @@ def StartAnalysisVm(
137137 boot_disk_size : int = 10 ,
138138 boot_disk_type : str = 'pd-standard' ,
139139 cpu_cores : int = 4 ,
140+ machine_type : Optional [str ] = None ,
140141 attach_disks : Optional [List [str ]] = None ,
141142 image_project : str = 'ubuntu-os-cloud' ,
142143 image_family : str = 'ubuntu-2204-lts' ,
143- packages : Optional [List [str ]] = None
144+ packages : Optional [List [str ]] = None ,
144145) -> Tuple ['compute.GoogleComputeInstance' , bool ]:
145146 """Start a virtual machine for analysis purposes.
146147
@@ -149,18 +150,18 @@ def StartAnalysisVm(
149150 vm_name: The name of the virtual machine.
150151 zone: Zone for the virtual machine.
151152 boot_disk_size: The size of the analysis VM boot disk (in GB).
152- boot_disk_type: URL of the disk type resource describing
153- which disk type to use to create the disk. Use pd-standard for a
154- standard disk and pd-ssd for a SSD disk.
153+ boot_disk_type: URL of the disk type resource describing which disk type to
154+ use to create the disk. Use pd-standard for a standard disk and pd-ssd for
155+ a SSD disk.
155156 cpu_cores: The number of CPU cores to create the machine with.
156- attach_disks: List of disk names to attach. Default
157- behaviour is to search in zonal disks then regional disks, when using
158- regional disks CreateInstanceFromArguments from GoogleCloudCompute is
159- recommended to avoid name colisions with zonal disks.
160- image_project: Name of the project where the analysis VM
161- image is hosted .
162- image_family : Name of the image to use to create the
163- analysis VM.
157+ machine_type: Machine type for the virtual machine. If specified, cpu_cores
158+ will be ignored.
159+ attach_disks: List of disk names to attach. Default behaviour is to search
160+ in zonal disks then regional disks, when using regional disks
161+ CreateInstanceFromArguments from GoogleCloudCompute is recommended to
162+ avoid name colisions with zonal disks .
163+ image_project : Name of the project where the analysis VM image is hosted.
164+ image_family: Name of the image to use to create the analysis VM.
164165 packages: List of extra packages to install in the VM.
165166
166167 Returns:
@@ -178,10 +179,17 @@ def StartAnalysisVm(
178179 disk = proj .compute .GetRegionDisk (disk_name )
179180 data_disks .append (disk )
180181 analysis_vm , created = proj .compute .GetOrCreateAnalysisVm (
181- vm_name , boot_disk_size , disk_type = boot_disk_type , cpu_cores = cpu_cores ,
182- image_project = image_project , image_family = image_family ,
182+ vm_name ,
183+ boot_disk_size ,
184+ disk_type = boot_disk_type ,
185+ cpu_cores = cpu_cores ,
186+ machine_type = machine_type ,
187+ image_project = image_project ,
188+ image_family = image_family ,
183189 packages = packages ,
184- data_disks = data_disks , zone = zone )
190+ data_disks = data_disks ,
191+ zone = zone ,
192+ )
185193 logger .info ('VM started.' )
186194 return analysis_vm , created
187195
0 commit comments