from typing import Unpack
from q2_sdk.core.install_steps.base import (
InstallStep,
InstallStepAttribute,
InstallStepArguments,
)
from q2_sdk.hq.db.gt_flavor import GtFlavor as GtFlavorDbObj
from q2_sdk.core import configuration
[docs]
class GtFlavor(InstallStep):
"""Installs a GT Flavor in the database"""
def __init__(
self,
flavor_name,
description,
base_gt_name,
**kwargs: Unpack[InstallStepArguments],
):
super().__init__(**kwargs)
self.flavor_name = InstallStepAttribute(flavor_name)
self.description = InstallStepAttribute(description)
self.base_gt_name = InstallStepAttribute(base_gt_name)
[docs]
async def install(self):
if configuration.settings.DEPLOY_ENV == "DEV":
await super().install()
await GtFlavorDbObj(self.logger, hq_credentials=self.hq_credentials).create(
self.flavor_name.value, self.description.value, self.base_gt_name.value
)
else:
self.logger.info("GTFlavors are only installed from the Caliper SDK in dev")