コード例 #1
0
def test_get_list_alltypes(client: Client, alltypes_entity: Entity,
                           alltypes_featuretable: FeatureTable):
    # ApplyEntity
    client.apply_entity(alltypes_entity)

    # GetEntity Check
    assert client.get_entity(name="alltypes_id") == alltypes_entity

    # ListEntities Check
    alltypes_filtering_labels = {"cat": "alltypes"}
    actual_alltypes_entities = client.list_entities(
        labels=alltypes_filtering_labels)
    assert len(actual_alltypes_entities) == 1

    # ApplyFeatureTable
    client.apply_feature_table(alltypes_featuretable)

    # GetFeatureTable Check
    actual_get_feature_table = client.get_feature_table(name="alltypes")
    assert actual_get_feature_table == alltypes_featuretable

    # ListFeatureTables Check
    actual_list_feature_table = [
        ft for ft in client.list_feature_tables() if ft.name == "alltypes"
    ][0]
    assert actual_list_feature_table == alltypes_featuretable
コード例 #2
0
def test_get_list_basic(
    client: Client,
    customer_entity: Entity,
    driver_entity: Entity,
    basic_featuretable: FeatureTable,
):

    # ApplyEntity
    client.apply_entity(customer_entity)
    client.apply_entity(driver_entity)

    # GetEntity Check
    assert client.get_entity(name="customer_id") == customer_entity
    assert client.get_entity(name="driver_id") == driver_entity

    # ListEntities Check
    common_filtering_labels = {"common_key": "common_val"}
    matchmaking_filtering_labels = {"team": "matchmaking"}

    actual_common_entities = client.list_entities(
        labels=common_filtering_labels)
    actual_matchmaking_entities = client.list_entities(
        labels=matchmaking_filtering_labels)
    assert len(actual_common_entities) == 2
    assert len(actual_matchmaking_entities) == 1

    # ApplyFeatureTable
    client.apply_feature_table(basic_featuretable)

    # GetFeatureTable Check
    actual_get_feature_table = client.get_feature_table(
        name="basic_featuretable")
    assert actual_get_feature_table == basic_featuretable

    # ListFeatureTables Check
    actual_list_feature_table = [
        ft for ft in client.list_feature_tables()
        if ft.name == "basic_featuretable"
    ][0]
    assert actual_list_feature_table == basic_featuretable
コード例 #3
0
ファイル: cli.py プロジェクト: lucaspressi1/feast
def entity_describe(name: str, project: str):
    """
    Describe an entity
    """
    feast_client = Client()  # type: Client
    entity = feast_client.get_entity(name=name, project=project)

    if not entity:
        print(f'Entity with name "{name}" could not be found')
        return

    print(
        yaml.dump(yaml.safe_load(str(entity)),
                  default_flow_style=False,
                  sort_keys=False))
コード例 #4
0
def _feature_table_to_json(client: Client, feature_table):
    return {
        "features": [{
            "name": f.name,
            "type": ValueType(f.dtype).name
        } for f in feature_table.features],
        "project":
        "default",
        "name":
        feature_table.name,
        "entities": [{
            "name": n,
            "type": client.get_entity(n).value_type
        } for n in feature_table.entities],
    }