def _init_env(self, env=None): if env is None: # By default use BentoServiceEnv defined on class via @env decorator env = self.__class__._env if isinstance(env, dict): self._env = BentoServiceEnv.fromDict(env) else: self._env = env
def __init__(self, artifacts, env=None): # TODO: validate artifacts arg matches self.__class__._artifacts_spec definition if isinstance(artifacts, ArtifactCollection): self._artifacts = artifacts else: self._artifacts = ArtifactCollection() for artifact in artifacts: self._artifacts[artifact.name] = artifact if env is None: # By default use BentoServiceEnv defined on class via @env decorator env = self.__class__._env if isinstance(env, dict): self._env = BentoServiceEnv.fromDict(env) else: self._env = env self._config_service_apis() self.name = self.__class__.name()
def decorator(bento_service_cls): bento_service_cls._env = BentoServiceEnv.fromDict(kwargs) return bento_service_cls