tencent-wedata-feature-engineering-dev 0.1.46__py3-none-any.whl → 0.1.48__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tencent-wedata-feature-engineering-dev
3
- Version: 0.1.46
3
+ Version: 0.1.48
4
4
  Summary: Wedata Feature Engineering Library Development
5
5
  Home-page:
6
6
  Author: meahqian
@@ -1,18 +1,20 @@
1
1
  wedata/__init__.py,sha256=GYxqkkgH0oH4QtNiOCZHuGkc0sSH1LgEqmhSX6sB4So,200
2
2
  wedata/feature_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- wedata/feature_store/client.py,sha256=rXQfSC14vvxPed9P0PoboDTwhD47aPwmGndY825Sl6k,19484
3
+ wedata/feature_store/client.py,sha256=B6fy-PGJZsEHGPE8tDmrTolyioJ_-Po2DK3p_HCW7Sw,19552
4
4
  wedata/feature_store/mlflow_model.py,sha256=OCUuccOoO0NXWSzIPoGeL03Ha1Q3aQTJW2RlJrTCmzc,554
5
5
  wedata/feature_store/cloud_sdk_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- wedata/feature_store/cloud_sdk_client/client.py,sha256=NtzV0EmLTzMLYqWhnUyOx3bmxoIIgxw8REid-Gy96Pc,4234
6
+ wedata/feature_store/cloud_sdk_client/client.py,sha256=B7nCQ_MvbLP4ieT7rsa32FHws2fOG4VQZT5lmQ3Cvzk,4914
7
7
  wedata/feature_store/cloud_sdk_client/models.py,sha256=7_QUq0kZcrcclRMsIYFoqBrlzVwaHoVY-yU5SHIrJWM,19789
8
- wedata/feature_store/cloud_sdk_client/utils.py,sha256=6ESwVhlrftnp0h9ojTzbB-m-0hktLI1PLcyk6zpNgrs,857
8
+ wedata/feature_store/cloud_sdk_client/utils.py,sha256=xwvXJpk2RXbJtgOaXCZQbGRrlzcTRzv27yQFxKp_X84,970
9
9
  wedata/feature_store/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ wedata/feature_store/common/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ wedata/feature_store/common/log/logger.py,sha256=c45DlIbIuwRP2na3ZXsncpHV5KUltqfyKzIgG9GG3g4,1151
10
12
  wedata/feature_store/common/protos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
13
  wedata/feature_store/common/protos/feature_store_pb2.py,sha256=oMIUGGeGNP84g_nFqOQwTXjV1GiU2ehSOy7CyFu2__g,4207
12
14
  wedata/feature_store/common/store_config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
15
  wedata/feature_store/common/store_config/redis.py,sha256=9R5npM2s1u0o9IakmpbRsFdJC0vNar_uvA62OLWuXBs,1145
14
16
  wedata/feature_store/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- wedata/feature_store/constants/constants.py,sha256=KxDS2NKE_Y3pEm4WmZuROiX7OUHvz6xFKwVKTePQW9Q,1959
17
+ wedata/feature_store/constants/constants.py,sha256=M0UKZSnpM7x5RYDvfesyF422zg82JJe4JsHUuUDiUF4,1959
16
18
  wedata/feature_store/constants/engine_types.py,sha256=42mI-kNDDtoA4_I3iqDe4FkF2M2l_Bt4Q1V6WUB-_k0,921
17
19
  wedata/feature_store/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
20
  wedata/feature_store/entities/column_info.py,sha256=-AR6EKHwgoqIkRHFyguxVEtnYt6fvusWHkEjF4kvS0A,5141
@@ -32,11 +34,11 @@ wedata/feature_store/entities/training_set.py,sha256=ylt1h6Z_xU8hKYvnvd80CeewTGS
32
34
  wedata/feature_store/feast_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
35
  wedata/feature_store/feast_client/feast_client.py,sha256=mCv-OiKehfgcOJhJV0wXMRs5d7e2zEBYmVmDguk0rxU,20728
34
36
  wedata/feature_store/feature_table_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- wedata/feature_store/feature_table_client/feature_table_client.py,sha256=qKkzQVIa9_rPpkTaLWh6VQ2DPBlyb7UzM-JFTsAHbZ8,42559
37
+ wedata/feature_store/feature_table_client/feature_table_client.py,sha256=qyr-jS-nIyphFVZXcUXV_HSfAu-8c19f0b8iG5rYsl8,42669
36
38
  wedata/feature_store/spark_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
39
  wedata/feature_store/spark_client/spark_client.py,sha256=aTenEqfZoJYMrph98qjNHZ-H4dgNKnMaH14st8bCVRQ,11797
38
40
  wedata/feature_store/training_set_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- wedata/feature_store/training_set_client/training_set_client.py,sha256=wwxTMGPm9QZXjGFv9XI2hA5N1pHntxhAJ6Grcfg6C2g,23572
41
+ wedata/feature_store/training_set_client/training_set_client.py,sha256=Ja_W1SKWKueW6wmwDx-623mfpwKQICm6A-ec_jgOFt4,23707
40
42
  wedata/feature_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
43
  wedata/feature_store/utils/common_utils.py,sha256=vkpoXxZTd6S-2MgdyTQZ6P_ckdqNSK50ECuVBG2BwfI,12314
42
44
  wedata/feature_store/utils/env_utils.py,sha256=kMCl6gyqDxjN5IZ7-wZMR0R4YY-Evh_7NHxugSYPWQc,2736
@@ -58,7 +60,7 @@ wedata/tempo/ml.py,sha256=WtGa2szn6PditvZsTZoxo7wFDe4k1SRoMZ-jgNGIjvE,4323
58
60
  wedata/tempo/resample.py,sha256=h81RVVmCl4ect-YKE-KZZHPDi1rGI3sh-YIb-Btz0ck,9698
59
61
  wedata/tempo/tsdf.py,sha256=S4lZfxhSRFiezYoYS6gvGsl1mZA3zp-MWEKFHYZpDg0,70968
60
62
  wedata/tempo/utils.py,sha256=I9I6l2DMwUoY213L04Yc1UR_zTWgSkj1BVo4ZwzQd4Y,7977
61
- tencent_wedata_feature_engineering_dev-0.1.46.dist-info/METADATA,sha256=s5EcvoA3Dz40G15pMbjaFZ_gvPEulSYjDzPiB6bRYlg,582
62
- tencent_wedata_feature_engineering_dev-0.1.46.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
63
- tencent_wedata_feature_engineering_dev-0.1.46.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
64
- tencent_wedata_feature_engineering_dev-0.1.46.dist-info/RECORD,,
63
+ tencent_wedata_feature_engineering_dev-0.1.48.dist-info/METADATA,sha256=-A-1H2urk9u4M9sEoQYri1xCeVtH3lFhUrsajCGb9tU,582
64
+ tencent_wedata_feature_engineering_dev-0.1.48.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
65
+ tencent_wedata_feature_engineering_dev-0.1.48.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
66
+ tencent_wedata_feature_engineering_dev-0.1.48.dist-info/RECORD,,
@@ -288,7 +288,7 @@ class FeatureStoreClient:
288
288
  )
289
289
 
290
290
  def score_batch(
291
- self, model_uri: str, df: DataFrame, result_type: str = "double"
291
+ self, model_uri: str, df: DataFrame, result_type: str = "double", timestamp_key: str = None
292
292
  ) -> DataFrame:
293
293
  """
294
294
  Evaluate the model on the provided :class:`DataFrame <pyspark.sql.DataFrame>`.
@@ -399,6 +399,7 @@ class FeatureStoreClient:
399
399
  df=df,
400
400
  result_type=result_type,
401
401
  client_name=FEATURE_STORE_CLIENT,
402
+ timestamp_key=timestamp_key,
402
403
  )
403
404
 
404
405
  def publish_table(self, table_name: str, data_source_name: str, cloud_secret_id: str, cloud_secret_key: str,
@@ -4,8 +4,9 @@ from tencentcloud.wedata.v20210820.wedata_client import WedataClient
4
4
  from tencentcloud.wedata.v20250806.wedata_client import WedataClient as WedataClientV2
5
5
  from tencentcloud.common import credential
6
6
  from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
7
- from wedata.feature_store.cloud_sdk_client.utils import get_client_profile, set_request_header
7
+ from wedata.feature_store.cloud_sdk_client.utils import get_client_profile, set_request_header, is_mock
8
8
  import wedata.feature_store.cloud_sdk_client.models as models
9
+ from wedata.feature_store.common.log.logger import get_logger
9
10
 
10
11
 
11
12
  class FeatureCloudSDK:
@@ -22,17 +23,21 @@ class FeatureCloudSDK:
22
23
  Returns:
23
24
  创建结果响应
24
25
  """
26
+ logger = get_logger()
27
+ if is_mock():
28
+ logger.debug("Mock CreateOnlineFeatureTable API")
29
+ return models.CreateOnlineFeatureTableResponse()
25
30
  try:
26
31
  params = request._serialize()
27
32
  headers = set_request_header(request.headers)
28
- print(f"CreateOnlineFeatureTable params: {params}")
29
- print(f"CreateOnlineFeatureTable headers: {headers}")
33
+ logger.debug(f"CreateOnlineFeatureTable params: {params}")
34
+ logger.debug(f"CreateOnlineFeatureTable headers: {headers}")
30
35
  self._client._apiVersion = "2021-08-20"
31
36
  body = self._client.call("CreateOnlineFeatureTable", params, headers=headers)
32
37
  response = json.loads(body)
33
38
  model = models.CreateOnlineFeatureTableResponse()
34
39
  model._deserialize(response["Response"])
35
- print("CreateOnlineFeatureTable Response: ", response)
40
+ logger.debug(f"CreateOnlineFeatureTable Response: {response}")
36
41
  return model
37
42
  except Exception as e:
38
43
  if isinstance(e, TencentCloudSDKException):
@@ -49,17 +54,22 @@ class FeatureCloudSDK:
49
54
  Returns:
50
55
  查询结果响应
51
56
  """
57
+ logger = get_logger()
58
+ if is_mock():
59
+ logger.debug("Mock DescribeNormalSchedulerExecutorGroups API")
60
+ return models.DescribeNormalSchedulerExecutorGroupsResponse()
61
+
52
62
  try:
53
63
  params = request._serialize()
54
64
  headers = set_request_header(request.headers)
55
- print(f"DescribeNormalSchedulerExecutorGroups params: {params}")
56
- print(f"DescribeNormalSchedulerExecutorGroups headers: {headers}")
65
+ logger.debug(f"DescribeNormalSchedulerExecutorGroups params: {params}")
66
+ logger.debug(f"DescribeNormalSchedulerExecutorGroups headers: {headers}")
57
67
  self._client._apiVersion = "2021-08-20"
58
68
  body = self._client.call("DescribeNormalSchedulerExecutorGroups", params, headers=headers)
59
69
  response = json.loads(body)
60
70
  model = models.DescribeNormalSchedulerExecutorGroupsResponse()
61
71
  model._deserialize(response["Response"])
62
- print("DescribeNormalSchedulerExecutorGroups Response: ", response)
72
+ logger.debug(f"DescribeNormalSchedulerExecutorGroups Response: {response}")
63
73
  return model
64
74
  except Exception as e:
65
75
  if isinstance(e, TencentCloudSDKException):
@@ -75,20 +85,24 @@ class FeatureCloudSDK:
75
85
  Returns:
76
86
  刷新结果响应
77
87
  """
88
+ logger = get_logger()
89
+ if is_mock():
90
+ logger.debug("Mock RefreshFeatureTable API")
91
+ return models.RefreshFeatureTableResponse()
78
92
  try:
79
93
  params = request._serialize()
80
94
  headers = set_request_header(request.headers)
81
- print(f"RefreshFeatureTable params: {params}")
82
- print(f"RefreshFeatureTable headers: {headers}")
95
+ logger.debug(f"RefreshFeatureTable params: {params}")
96
+ logger.debug(f"RefreshFeatureTable headers: {headers}")
83
97
  self._client_v2._apiVersion = "2025-08-06"
84
98
  body = self._client_v2.call("RefreshFeatureTable", params, headers=headers)
85
99
  response = json.loads(body)
86
100
  model = models.RefreshFeatureTableResponse()
87
101
  model._deserialize(response["Response"])
88
- print("RefreshFeatureTable Response: ", response)
102
+ logger.debug(f"RefreshFeatureTable Response: {response}")
89
103
  return model
90
104
  except Exception as e:
91
105
  if isinstance(e, TencentCloudSDKException):
92
106
  raise
93
107
  else:
94
- raise TencentCloudSDKException(type(e).__name__, str(e))
108
+ raise TencentCloudSDKException(type(e).__name__, str(e))
@@ -30,3 +30,10 @@ def set_request_header(headers):
30
30
  headers["X-Qcloud-User-Id"] = os.environ.get("TEST_USER_ID")
31
31
  return headers
32
32
 
33
+
34
+ def is_mock() -> bool:
35
+ """
36
+ 是否为模拟环境
37
+ """
38
+ return os.getenv("IS_MOCK_API") == "true"
39
+
File without changes
@@ -0,0 +1,40 @@
1
+ import logging
2
+ import sys
3
+
4
+
5
+ class LoggerSingleton:
6
+ _instance = None
7
+
8
+ def __new__(cls):
9
+ if cls._instance is None:
10
+ cls._instance = super().__new__(cls)
11
+ cls._instance._initialize_logger()
12
+ return cls._instance
13
+
14
+ def _initialize_logger(self):
15
+ self.logger = logging.getLogger("wedata-feature-engineering")
16
+ self.logger.setLevel(logging.INFO)
17
+
18
+ # 清除已有的handler,避免重复添加
19
+ if self.logger.handlers:
20
+ self.logger.handlers.clear()
21
+
22
+ # 创建formatter,包含时间、文件名和行号
23
+ formatter = logging.Formatter(
24
+ fmt='%(asctime)s - %(name)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s',
25
+ datefmt='%Y-%m-%d %H:%M:%S'
26
+ )
27
+
28
+ # 创建handler并输出到stdout
29
+ handler = logging.StreamHandler(sys.stdout)
30
+ handler.setFormatter(formatter)
31
+
32
+ self.logger.addHandler(handler)
33
+
34
+ def get_logger(self):
35
+ return self.logger
36
+
37
+
38
+ def get_logger():
39
+ """获取单例logger实例"""
40
+ return LoggerSingleton().get_logger()
@@ -43,7 +43,7 @@ ML_MODEL = "MLmodel"
43
43
  FEATURE_LOOKUP_CLIENT_PIP_PACKAGE = "tencent-wedata-feature-engineering-dev"
44
44
 
45
45
  # 特征查找版本号
46
- FEATURE_LOOKUP_CLIENT_MAJOR_VERSION = "0.1.46"
46
+ FEATURE_LOOKUP_CLIENT_MAJOR_VERSION = "0.1.48"
47
47
 
48
48
  # 特征存储内部数据目录
49
49
  FEATURE_STORE_INTERNAL_DATA_DIR = "_wedata_internal/"
@@ -926,13 +926,15 @@ class FeatureTableClient:
926
926
  full_table_name = common_utils.build_full_table_name(table_name, database_name)
927
927
  feast_client = FeastClient(self._spark, online_config)
928
928
  try:
929
- self._sync_table_info(table_name=table_name, database_name=database_name, action_name="delete_online", engine_name=env_utils.get_engine_name(), is_try=True)
929
+ self._sync_table_info(table_name=table_name, database_name=database_name, action_name="delete_online",
930
+ data_source_name="", engine_name=env_utils.get_engine_name(), is_try=True)
930
931
  except Exception as e:
931
932
  raise RuntimeError(f"drop online table failed. table_name: {full_table_name}. {str(e)}")
932
933
 
933
934
  feast_client.remove_online_table(full_table_name)
934
935
  try:
935
- self._sync_table_info(table_name=table_name, database_name=database_name, action_name="delete_online", engine_name=env_utils.get_engine_name(), is_try=False)
936
+ self._sync_table_info(table_name=table_name, database_name=database_name, action_name="delete_online",
937
+ data_source_name="", engine_name=env_utils.get_engine_name(), is_try=False)
936
938
  except Exception as e:
937
939
  raise RuntimeError(f"drop online table failed. table_name: {full_table_name}. {str(e)}")
938
940
  print(f"drop online table success. table_name: {full_table_name}")
@@ -360,6 +360,7 @@ class TrainingSetClient:
360
360
  env_manager: Optional[str] = None,
361
361
  local_uri: Optional[str] = None,
362
362
  params: Optional[dict[str, Any]] = None,
363
+ timestamp_key: str = None,
363
364
  **kwargs,
364
365
  ) -> DataFrame:
365
366
  # TODO:ML 待确定是否需要
@@ -423,8 +424,11 @@ class TrainingSetClient:
423
424
 
424
425
  # Validate that columns needed for joining feature tables exist and are not duplicates.
425
426
  feature_input_keys = []
427
+ print("====>timestamp_key:", timestamp_key)
426
428
  for fci in feature_spec.feature_column_infos:
429
+ print("====>fci:", fci.lookup_key)
427
430
  feature_input_keys.extend([k for k in fci.lookup_key])
431
+
428
432
  on_demand_input_names = uc_utils.get_unique_list_order(
429
433
  [
430
434
  input_name