lablink_allocator_service.utils.tofu_utils¶
lablink_allocator_service.utils.tofu_utils
¶
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Functions:¶
get_instance_ids(tofu_dir)
¶
Get the instance IDs of the instances created by OpenTofu. Args: tofu_dir (str): The directory where the OpenTofu configuration is located. Raises: RuntimeError: Error running tofu output command. RuntimeError: Error decoding JSON output. ValueError: Expected output to be a list of instance IDs. Returns: list: A list of instance IDs of the instances.
Source code in packages/allocator/src/lablink_allocator_service/utils/tofu_utils.py
get_instance_names(tofu_dir)
¶
Get the names of the instances created by OpenTofu. Args: tofu_dir (str): The directory where the OpenTofu configuration is located. Raises: RuntimeError: Error running tofu output command. RuntimeError: Error decoding JSON output. ValueError: Expected output to be a list of instance names. Returns: list: A list of names assigned to the EC2 instances.
Source code in packages/allocator/src/lablink_allocator_service/utils/tofu_utils.py
get_instance_timings(tofu_dir)
¶
Get the launch times of the instances created by OpenTofu. Args: tofu_dir (str): The directory where the OpenTofu configuration is located. Raises: RuntimeError: Error running tofu output command. RuntimeError: Error decoding JSON output. ValueError: Expected output to be a dictionary of launch times. Returns: dict: A dictionary mapping instance names to their launch times.
Source code in packages/allocator/src/lablink_allocator_service/utils/tofu_utils.py
get_ssh_private_key(tofu_dir)
¶
Get the SSH private key used for connecting to the instances. Args: tofu_dir (str): The directory where the OpenTofu configuration is located. Raises: RuntimeError: Error running tofu output command. Returns: str: The path to the SSH private key file.