Skip to content

Commit

Permalink
Add optional scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-fsn committed Jun 20, 2024
1 parent a4fbdac commit 88fab0a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sc_runner/resources/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def resources_gcp(
instance_opts["metadata"]["ssh-keys"] = f"ubuntu:{public_key}"
else:
instance_opts["metadata"] = {"ssh-keys": f"ubuntu:{public_key}"}
gcp.compute.Instance(
instance,
instance_opts |= dict(
machine_type=instance,
zone=zone,
boot_disk=gcp.compute.InstanceBootDiskArgs(
Expand All @@ -51,7 +50,11 @@ def resources_gcp(
access_configs=[gcp.compute.InstanceNetworkInterfaceAccessConfigArgs()]
)
],
scheduling=gcp.compute.InstanceSchedulingArgs(**scheduling_opts),
)
if scheduling_opts:
instance_opts["scheduling"] = gcp.compute.InstanceSchedulingArgs(**scheduling_opts)
gcp.compute.Instance(
instance,
**instance_opts,
opts=pulumi.ResourceOptions(provider=provider),
)

0 comments on commit 88fab0a

Please sign in to comment.