示例#1
0
文件: api.py 项目: tlennon140/cortex
    def __init__(
        self,
        provider: str,
        storage: Union[LocalStorage, S3, GCS],
        api_spec: Dict[str, Any],
        model_dir: str,
        cache_dir: str = ".",
    ):
        self.provider = provider
        self.storage = storage
        self.api_spec = api_spec
        self.cache_dir = cache_dir

        self.id = api_spec["id"]
        self.predictor_id = api_spec["predictor_id"]
        self.deployment_id = api_spec["deployment_id"]

        self.key = api_spec["key"]
        self.metadata_root = api_spec["metadata_root"]
        self.name = api_spec["name"]
        self.predictor = Predictor(provider, api_spec, model_dir)

        self.monitoring = None
        if self.api_spec.get("monitoring") is not None:
            self.monitoring = Monitoring(**self.api_spec["monitoring"])

        if provider != "local":
            host_ip = os.environ["HOST_IP"]
            datadog.initialize(statsd_host=host_ip, statsd_port="8125")
            self.statsd = datadog.statsd

        if provider == "local":
            self.metrics_file_lock = threading.Lock()
示例#2
0
    def __init__(
        self,
        provider: str,
        storage: Union[S3, GCS],
        api_spec: Dict[str, Any],
        model_dir: str,
        cache_dir: str = ".",
    ):
        self.provider = provider
        self.storage = storage
        self.api_spec = api_spec
        self.cache_dir = cache_dir

        self.id = api_spec["id"]
        self.predictor_id = api_spec["predictor_id"]
        self.deployment_id = api_spec["deployment_id"]

        self.key = api_spec["key"]
        self.metadata_root = api_spec["metadata_root"]
        self.name = api_spec["name"]
        self.predictor = Predictor(provider, api_spec, model_dir)

        host_ip = os.environ["HOST_IP"]
        datadog.initialize(statsd_host=host_ip, statsd_port=9125)
        self.__statsd = datadog.statsd
示例#3
0
    def __init__(
        self,
        api_spec: Dict[str, Any],
        model_dir: str,
        cache_dir: str = ".",
    ):
        self.api_spec = api_spec
        self.cache_dir = cache_dir

        self.id = api_spec["id"]
        self.predictor_id = api_spec["predictor_id"]
        self.deployment_id = api_spec["deployment_id"]

        self.name = api_spec["name"]
        self.predictor = Predictor(api_spec, model_dir)

        host_ip = os.environ["HOST_IP"]
        datadog.initialize(statsd_host=host_ip, statsd_port=9125)
        self.__statsd = datadog.statsd