Exemple #1
0
    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
Exemple #2
0
    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()
Exemple #3
0
 def decorator(bento_service_cls):
     bento_service_cls._env = BentoServiceEnv.fromDict(kwargs)
     return bento_service_cls