tfduck-bsd 0.17.9__tar.gz → 0.18.0__tar.gz

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.

Potentially problematic release.


This version of tfduck-bsd might be problematic. Click here for more details.

Files changed (47) hide show
  1. {tfduck-bsd-0.17.9/tfduck_bsd.egg-info → tfduck-bsd-0.18.0}/PKG-INFO +1 -1
  2. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/setup.py +1 -1
  3. tfduck-bsd-0.18.0/tfduck/__init__.py +1 -0
  4. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/tga.py +67 -11
  5. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/train_sql_ltv.py +1 -1
  6. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/train_sql_retain.py +1 -1
  7. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0/tfduck_bsd.egg-info}/PKG-INFO +1 -1
  8. tfduck-bsd-0.17.9/tfduck/__init__.py +0 -1
  9. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/LICENSE +0 -0
  10. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/README.md +0 -0
  11. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/bin/tfduck +0 -0
  12. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/setup.cfg +0 -0
  13. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/__init__.py +0 -0
  14. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/config/__init__.py +0 -0
  15. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/config/bdpmanager.py +0 -0
  16. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/config/table_config.py +0 -0
  17. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/example.py +0 -0
  18. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/opends/__init__.py +0 -0
  19. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/opends/opends.py +0 -0
  20. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/bdp_sdk_py/opends/sdk.py +0 -0
  21. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/common/__init__.py +0 -0
  22. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/common/defines.py +0 -0
  23. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/common/defines_clean.py +0 -0
  24. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/common/extendEncoder.py +0 -0
  25. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/main.py +0 -0
  26. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/oss/__init__.py +0 -0
  27. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/oss/oss.py +0 -0
  28. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/pyspark_k8s/__init__.py +0 -0
  29. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/pyspark_k8s/k8s_manage.py +0 -0
  30. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/pyspark_k8s/spark_manage.py +0 -0
  31. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/s3/__init__.py +0 -0
  32. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/s3/s3oper.py +0 -0
  33. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/sagemaker/__init__.py +0 -0
  34. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/sagemaker/saoper.py +0 -0
  35. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/__init__.py +0 -0
  36. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/base_tga.py +0 -0
  37. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/predict_sql_ltv.py +0 -0
  38. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/predict_sql_retain.py +0 -0
  39. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/predict_sql_yh.py +0 -0
  40. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/tga_test.py +0 -0
  41. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/tga/train_sql_yh.py +0 -0
  42. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/thinkdata/__init__.py +0 -0
  43. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck/thinkdata/query.py +0 -0
  44. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck_bsd.egg-info/SOURCES.txt +0 -0
  45. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck_bsd.egg-info/dependency_links.txt +0 -0
  46. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck_bsd.egg-info/requires.txt +0 -0
  47. {tfduck-bsd-0.17.9 → tfduck-bsd-0.18.0}/tfduck_bsd.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tfduck-bsd
3
- Version: 0.17.9
3
+ Version: 0.18.0
4
4
  Summary: A small example package
5
5
  Home-page: UNKNOWN
6
6
  Author: yuanxiao
@@ -8,7 +8,7 @@ with open("README.md", "r") as fh:
8
8
 
9
9
  setuptools.setup(
10
10
  name="tfduck-bsd",
11
- version="0.17.9",
11
+ version="0.18.0",
12
12
  author="yuanxiao",
13
13
  author_email="yuan6785@163.com",
14
14
  description="A small example package",
@@ -0,0 +1 @@
1
+ __version__="0.18.0"
@@ -72,19 +72,19 @@ class ThinkDataQuery(BaseTga):
72
72
  mode=mode, header=header)
73
73
  return True
74
74
 
75
- def get_data_csv_i(self, ctx, unique_path, sql, block_size=100000, print_size=100000, read_timeout=600, upcount=None):
75
+ def get_data_csv_i(self, ctx, unique_path, sql, block_size=100000, print_size=100000, read_timeout=600, upcount=None, conn_timeout=30, tga_data_timeout=600):
76
76
  """
77
77
  @des:从thinkdata的openapi获取数据----流式,为了节省内存---配合下面的getquerycsv
78
78
  """
79
79
  session = requests.session()
80
- post_data = {'token': self.token, 'sql': sql}
80
+ post_data = {'token': self.token, 'sql': sql, 'timeoutSeconds': tga_data_timeout}
81
81
  #
82
82
  unique_path = self.gen_local_unique_file()
83
83
  #
84
84
  BMOBJ.log_error("in query")
85
85
  #
86
86
  r = session.post(self.query_uri, data=post_data, stream=True,
87
- verify=False, timeout=(30, read_timeout))
87
+ verify=False, timeout=(conn_timeout, read_timeout))
88
88
  datas = []
89
89
  i = 0 # 循环引用计数
90
90
  icount = 0 # 数据的数量
@@ -150,7 +150,7 @@ class ThinkDataQuery(BaseTga):
150
150
  pass
151
151
  return unique_path
152
152
 
153
- def get_data_csv(self, ctx, sql, block_size=100000, print_size=100000, read_timeout=600, upcount=None, retry_count=2):
153
+ def get_data_csv(self, ctx, sql, block_size=100000, print_size=100000, read_timeout=600, upcount=None, retry_count=2, conn_timeout=30, tga_data_timeout=600):
154
154
  """
155
155
  @des:从thinkdata的openapi获取数据----流式,为了节省内存---配合下面的getquerycsv
156
156
  """
@@ -160,7 +160,7 @@ class ThinkDataQuery(BaseTga):
160
160
  for i in range(retry_count):
161
161
  try:
162
162
  result = self.get_data_csv_i(
163
- ctx, unique_path, sql, block_size, print_size, read_timeout, upcount)
163
+ ctx, unique_path, sql, block_size, print_size, read_timeout, upcount, conn_timeout, tga_data_timeout)
164
164
  return result
165
165
  except Exception as e:
166
166
  gol_e = e
@@ -174,15 +174,15 @@ class ThinkDataQuery(BaseTga):
174
174
  if gol_e is not None:
175
175
  raise gol_e
176
176
 
177
- def get_data_raw_pyhive(self, ctx, sql, block_size=100000, fetch_size=10000, retry_count=2, read_timeout=300, upcount=None, print_size=100000):
177
+ def get_data_raw_pyhive(self, ctx, sql, block_size=100000, fetch_size=10000, retry_count=2, read_timeout=300, upcount=None, print_size=100000, conn_timeout=30, tga_data_timeout=600):
178
178
  """
179
179
  @des: 接口装饰器--修改为get_data_csv,防止全面修改代码
180
180
  """
181
- result = self.get_data_csv(ctx, sql, block_size, print_size, read_timeout, upcount, retry_count)
181
+ result = self.get_data_csv(ctx, sql, block_size, print_size, read_timeout, upcount, retry_count, conn_timeout, tga_data_timeout)
182
182
  return result
183
183
 
184
184
 
185
- def get_data_raw_pyhive_bck(self, ctx, sql, block_size=100000, fetch_size=10000, retry_count=2, read_timeout=300, upcount=None, print_size=100000):
185
+ def get_data_raw_pyhive_bck(self, ctx, sql, block_size=100000, fetch_size=10000, retry_count=2, read_timeout=300, upcount=None, print_size=100000, conn_timeout=30, tga_data_timeout=600):
186
186
  '''
187
187
  @des:presto直连方式读取-----重试的方式----当get_data_csv接口出问题,则启用这个接口
188
188
  tobj = ThinkDataQuery("http://queryhost:port/querySql", "查询token",
@@ -196,7 +196,7 @@ class ThinkDataQuery(BaseTga):
196
196
  for i in range(retry_count):
197
197
  try:
198
198
  result = self.get_data_raw_pyhive_i(
199
- ctx, unique_path, sql, block_size, fetch_size, read_timeout, upcount, print_size)
199
+ ctx, unique_path, sql, block_size, fetch_size, read_timeout, upcount, print_size, conn_timeout)
200
200
  return result
201
201
  except Exception as e:
202
202
  gol_e = e
@@ -210,7 +210,7 @@ class ThinkDataQuery(BaseTga):
210
210
  if gol_e is not None:
211
211
  raise gol_e
212
212
 
213
- def get_data_raw_pyhive_i(self, ctx, unique_path, sql, block_size=100000, fetch_size=10000, read_timeout=300, upcount=None, print_size=100000):
213
+ def get_data_raw_pyhive_i(self, ctx, unique_path, sql, block_size=100000, fetch_size=10000, read_timeout=300, upcount=None, print_size=100000, conn_timeout=30):
214
214
  '''
215
215
  @des: 内部调用
216
216
  '''
@@ -235,7 +235,7 @@ class ThinkDataQuery(BaseTga):
235
235
  # 这里stream为true和false没有关系,fetchmany每次都会通过request_session传nexturl重新get获取数据
236
236
  # 参考pyhive/presto.py的_fetch_more,每次fetchmany其实是多次fetchone
237
237
  requests_kwargs={"timeout": (
238
- 30, read_timeout), "stream": True, "verify": False}
238
+ conn_timeout, read_timeout), "stream": True, "verify": False}
239
239
  )
240
240
  cursor = conn.cursor()
241
241
  cursor.execute(sql)
@@ -303,3 +303,59 @@ class ThinkDataQuery(BaseTga):
303
303
  except:
304
304
  pass
305
305
  return unique_path
306
+
307
+ """
308
+ 数据打入接口--start--
309
+ """
310
+
311
+ def set_tga_user_data(self, tga_app_no, sec_token, url, data, is_set_once=False):
312
+ """
313
+ @des: 用户数据打入tga
314
+ @params:
315
+ tga_app_no: tga项目的id,注意不是app_id
316
+ sec_token: 安全的二次部署服务器的token
317
+ url: 二次部署的服务器打入的url
318
+ data: 数据 [['tga用户的distinct_id,为空就传None', 'tga用户的account_id为空就传None', '打入的用户属性为一个dict' ], ...,]
319
+ 例如: [['eqw31231231', 'fads21321312312', {'a':1, 'b':2}], ...,]
320
+ """
321
+ pass
322
+
323
+ def set_tga_event_data_trac(self, tga_app_no, sec_token, url, data):
324
+ """
325
+ @des: 普通事件数据打入tga
326
+ @params:
327
+ tga_app_no: tga项目的id,注意不是app_id
328
+ sec_token: 安全的二次部署服务器的token
329
+ url: 二次部署的服务器打入的url
330
+ data: 数据 [['事件名称', 'tga用户的distinct_id,为空就传None', 'tga用户的account_id为空就传None', '打入的用户属性为一个dict' ], ...,]
331
+ 例如: [['new_session', 'eqw31231231', 'fads21321312312', {'a':1, 'b':2}], ...,]
332
+ """
333
+ pass
334
+
335
+ def set_tga_event_data_trac_update(self, tga_app_no, sec_token, url, data):
336
+ """
337
+ @des: 可更新事件数据打入tga, 重写部分数据
338
+ @params:
339
+ tga_app_no: tga项目的id,注意不是app_id
340
+ sec_token: 安全的二次部署服务器的token
341
+ url: 二次部署的服务器打入的url
342
+ data: 数据 [['事件名称', '事件唯一id', 'tga用户的distinct_id,为空就传None', 'tga用户的account_id为空就传None', , '打入的用户属性为一个dict' ], ...,]
343
+ 例如: [['new_session', 'event_id_123', 'eqw31231231', 'fads21321312312', {'a':1, 'b':2}], ...,]
344
+ """
345
+ pass
346
+
347
+ def set_tga_event_data_trac_overwrite(self, tga_app_no, sec_token, url, data):
348
+ """
349
+ @des: 可更新事件数据打入tga, 重写全部数据
350
+ @params:
351
+ tga_app_no: tga项目的id,注意不是app_id
352
+ sec_token: 安全的二次部署服务器的token
353
+ url: 二次部署的服务器打入的url
354
+ data: 数据 [['事件名称', '事件唯一id', 'tga用户的distinct_id,为空就传None', 'tga用户的account_id为空就传None', , '打入的用户属性为一个dict' ], ...,]
355
+ 例如: [['new_session', 'event_id_123', 'eqw31231231', 'fads21321312312', {'a':1, 'b':2}], ...,]
356
+ """
357
+ pass
358
+
359
+ """
360
+ 数据打入接口----end-----
361
+ """
@@ -335,7 +335,7 @@ class TrainFeatureSql(BaseTga):
335
335
  -- 直接用user_user_id作为排序值,排序的必须是唯一的,否则下面会对不上,会产生很多null的数据
336
336
  -- user_user_id as tt_stable_rand -- 这种方式最保险,但是不能乱序,这样采样的数据就不是随机分布在每天的
337
337
  -- bitwise_xor(user_user_id, 906867964886667264) as tt_stable_rand -- 这种方式可能会产生left null的情况,但是是少数,过滤掉就行,不影响结果,但支持乱序采样
338
- a3.user_distinct_id as tt_stable_rand -- 这种方式最保险,即是乱序也是唯一
338
+ a3.user_distinct_id as tt_stable_rand -- 这种方式最保险,即是乱序也是唯一, 就算limit分几部分取特征值,这几部分也是可以对应上的
339
339
 
340
340
  FROM
341
341
  (
@@ -107,7 +107,7 @@ class TrainFeatureSql(BaseTga):
107
107
  user_cols1='1=1',
108
108
  user_cols2='1=1',
109
109
  event_cols1='1=1',
110
- addon_attrs=[],
110
+ addon_attrs=[],
111
111
  **kwargs):
112
112
  """
113
113
  @des: 参数说明看上面的文档说明
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tfduck-bsd
3
- Version: 0.17.9
3
+ Version: 0.18.0
4
4
  Summary: A small example package
5
5
  Home-page: UNKNOWN
6
6
  Author: yuanxiao
@@ -1 +0,0 @@
1
- __version__="0.17.9"
File without changes
File without changes
File without changes
File without changes
File without changes