Пример #1
0
def start_job_service() -> None:
    """
    Start Feast Job Service
    """

    log_fmt = "%(asctime)s %(levelname)s %(message)s"
    logging.basicConfig(level=logging.INFO, format=log_fmt)

    client = feast.Client()

    if client._config.getboolean(opt.JOB_SERVICE_ENABLE_CONTROL_LOOP):
        # Start the control loop thread only if it's enabled from configs
        thread = threading.Thread(target=start_control_loop, daemon=True)
        thread.start()

    server = grpc.server(ThreadPoolExecutor(),
                         interceptors=(LoggingInterceptor(), ))
    JobService_pb2_grpc.add_JobServiceServicer_to_server(
        JobServiceServicer(client), server)
    HealthService_pb2_grpc.add_HealthServicer_to_server(
        HealthServicer(), server)
    server.add_insecure_port("[::]:6568")
    server.start()
    logging.info("Feast Job Service is listening on port :6568")
    server.wait_for_termination()
Пример #2
0
    def __init__(
        self,
        datastore: str,
        credential_path: str,
        table_name: str,
        ds: str,
        epochs: int,
        batch_size: int,
        chunk_size: int,
        exclude_features: List[str],
        table_sample_percent: float,
        test_split_percent: float,
        skip_small_batches: bool,
        faucet_core_url: str,
        faucet_batch_serving_url: str,
        faucet_project: str,
    ):
        # Intialize clients & set table properties
        self.client = self._get_client(credential_path)
        self.table_name = table_name
        self.exclude_features = exclude_features
        if faucet_core_url is not None:
            assert faucet_batch_serving_url is not None
            assert faucet_project is not None
            self.feast_client = feast.Client(
                core_url=faucet_core_url, serving_url=faucet_batch_serving_url)
            self.feast_client.set_project(faucet_project)

        # Figure out sampling + train & test
        self.max_row_filter = table_sample_percent / 100
        self.train_set_filter = self.max_row_filter * (
            1 - test_split_percent / 100)

        # Generate queries for the training & test set
        self.train_query, self.eval_query = self._build_train_and_eval_queries(
            ds)

        # Create query jobs to create temp tables (non-blocking)
        self.train_query_job = self._create_tmp_table(train=True)
        self.eval_query_job = self._create_tmp_table(train=False)

        # Minibatch settings
        self.batch_size = batch_size
        self.skip_small_batches = skip_small_batches

        # Chunk settings
        self.chunk_size = chunk_size
        assert (
            chunk_size % batch_size == 0
        ), f"Chunk size: {chunk_size} must be multiple of batch size: {batch_size}."

        # Epoch settings
        self.epochs = epochs
        self.current_epoch_num = 0

        # Preprocessing specifications & preprocessor net
        self.preproc_specifications = None
        self.preprocessor_net = None
Пример #3
0
def start_control_loop() -> None:
    """Starts control loop that continuously ensures that correct jobs are being run.

    Currently this affects only the stream ingestion jobs. Please refer to
    ensure_stream_ingestion_jobs for full documentation on how the check works.

    """
    logging.info(
        "Feast Job Service is starting a control loop in a background thread, "
        "which will ensure that stream ingestion jobs are successfully running."
    )
    try:
        client = feast.Client()
        while True:
            ensure_stream_ingestion_jobs(client, all_projects=True)
            time.sleep(1)
    except Exception:
        traceback.print_exc()
    finally:
        # Send interrupt signal to the main thread to kill the server if control loop fails
        os.kill(os.getpid(), signal.SIGINT)
Пример #4
0
    def __init__(self):
        print("Connecting to feast", feast_options)
        for k, v in feast_options.items():
            os.environ[k] = v

        self.feast_client = feast.Client()
Пример #5
0
 def __init__(self):
     self.client = feast.Client()