tfduck-bsd 0.1.5__tar.gz → 0.19.8__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.
- tfduck_bsd-0.19.8/LICENSE +19 -0
- tfduck_bsd-0.19.8/PKG-INFO +31 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/setup.py +15 -3
- tfduck_bsd-0.19.8/tfduck/__init__.py +1 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/opends/opends.py +48 -43
- tfduck_bsd-0.19.8/tfduck/common/defines.py +500 -0
- tfduck_bsd-0.19.8/tfduck/common/defines_clean.py +573 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/common/extendEncoder.py +2 -2
- tfduck_bsd-0.19.8/tfduck/main.py +411 -0
- tfduck_bsd-0.19.8/tfduck/oss/oss.py +441 -0
- tfduck_bsd-0.19.8/tfduck/pyspark_k8s/k8s_manage.py +121 -0
- tfduck_bsd-0.19.8/tfduck/pyspark_k8s/spark_manage.py +442 -0
- tfduck_bsd-0.19.8/tfduck/s3/__init__.py +0 -0
- tfduck_bsd-0.19.8/tfduck/s3/s3oper.py +579 -0
- tfduck_bsd-0.19.8/tfduck/sagemaker/__init__.py +0 -0
- tfduck_bsd-0.19.8/tfduck/sagemaker/saoper.py +256 -0
- tfduck_bsd-0.19.8/tfduck/serverless_k8s/__init__.py +0 -0
- tfduck_bsd-0.19.8/tfduck/serverless_k8s/k8s_manage.py +231 -0
- tfduck_bsd-0.19.8/tfduck/serverless_k8s/k8s_task.py +351 -0
- tfduck_bsd-0.19.8/tfduck/tga/__init__.py +0 -0
- tfduck_bsd-0.19.8/tfduck/tga/base_tga.py +55 -0
- tfduck_bsd-0.19.8/tfduck/tga/predict_sql_ltv.py +92 -0
- tfduck_bsd-0.19.8/tfduck/tga/predict_sql_retain.py +486 -0
- tfduck_bsd-0.19.8/tfduck/tga/predict_sql_yh.py +92 -0
- tfduck_bsd-0.19.8/tfduck/tga/tga.py +663 -0
- tfduck_bsd-0.19.8/tfduck/tga/tga_test.py +91 -0
- tfduck_bsd-0.19.8/tfduck/tga/tga_trino.py +586 -0
- tfduck_bsd-0.19.8/tfduck/tga/train_sql_ltv.py +613 -0
- tfduck_bsd-0.19.8/tfduck/tga/train_sql_retain.py +578 -0
- tfduck_bsd-0.19.8/tfduck/tga/train_sql_yh.py +575 -0
- tfduck_bsd-0.19.8/tfduck/thinkdata/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/thinkdata/query.py +6 -3
- tfduck_bsd-0.19.8/tfduck_bsd.egg-info/PKG-INFO +31 -0
- tfduck_bsd-0.19.8/tfduck_bsd.egg-info/SOURCES.txt +48 -0
- tfduck_bsd-0.19.8/tfduck_bsd.egg-info/requires.txt +9 -0
- tfduck-bsd-0.1.5/PKG-INFO +0 -28
- tfduck-bsd-0.1.5/tfduck/__init__.py +0 -1
- tfduck-bsd-0.1.5/tfduck/common/defines.py +0 -220
- tfduck-bsd-0.1.5/tfduck/main.py +0 -202
- tfduck-bsd-0.1.5/tfduck/oss/oss.py +0 -104
- tfduck-bsd-0.1.5/tfduck_bsd.egg-info/PKG-INFO +0 -28
- tfduck-bsd-0.1.5/tfduck_bsd.egg-info/SOURCES.txt +0 -25
- tfduck-bsd-0.1.5/tfduck_bsd.egg-info/requires.txt +0 -3
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/README.md +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/bin/tfduck +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/setup.cfg +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/config/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/config/bdpmanager.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/config/table_config.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/example.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/opends/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/bdp_sdk_py/opends/sdk.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/common/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck/oss/__init__.py +0 -0
- {tfduck-bsd-0.1.5/tfduck/thinkdata → tfduck_bsd-0.19.8/tfduck/pyspark_k8s}/__init__.py +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck_bsd.egg-info/dependency_links.txt +0 -0
- {tfduck-bsd-0.1.5 → tfduck_bsd-0.19.8}/tfduck_bsd.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tfduck_bsd
|
|
3
|
+
Version: 0.19.8
|
|
4
|
+
Summary: A small example package
|
|
5
|
+
Home-page: UNKNOWN
|
|
6
|
+
Author: yuanxiao
|
|
7
|
+
Author-email: yuan6785@163.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.5
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
|
|
17
|
+
# Example Package
|
|
18
|
+
|
|
19
|
+
This is a simple example package. You can use
|
|
20
|
+
[Github-flavored Markdown](https://guides.github.com/features/mastering-markdown/)
|
|
21
|
+
> 测试命令行工具
|
|
22
|
+
```
|
|
23
|
+
tfd a1 a2
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> 测试脚本内容
|
|
27
|
+
```
|
|
28
|
+
>>> from tfduck_pkg.helloworld import HelloWorld
|
|
29
|
+
>>> HelloWorld().test()
|
|
30
|
+
```
|
|
31
|
+
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
未加密的tfduck/setup.py的代码
|
|
3
|
+
"""
|
|
1
4
|
import setuptools
|
|
2
5
|
|
|
3
6
|
with open("README.md", "r") as fh:
|
|
4
7
|
long_description = fh.read()
|
|
5
8
|
|
|
6
9
|
setuptools.setup(
|
|
7
|
-
name="
|
|
8
|
-
version="0.
|
|
10
|
+
name="tfduck_bsd",
|
|
11
|
+
version="0.19.8",
|
|
9
12
|
author="yuanxiao",
|
|
10
13
|
author_email="yuan6785@163.com",
|
|
11
14
|
description="A small example package",
|
|
@@ -15,9 +18,18 @@ setuptools.setup(
|
|
|
15
18
|
packages=setuptools.find_packages(),
|
|
16
19
|
# 需要安装的依赖
|
|
17
20
|
install_requires=[
|
|
21
|
+
'arrow>=0.15.5',
|
|
18
22
|
'requests>=2.20.0',
|
|
19
23
|
'django==2.2.12',
|
|
20
|
-
'oss2==2.5.0
|
|
24
|
+
'oss2==2.15.0', # 原来是2.5.0
|
|
25
|
+
'ThinkingDataSdk==1.8.0', #1.1.14, 1.6.2 1.8.0支持字典和数组
|
|
26
|
+
'kubernetes==12.0.1',
|
|
27
|
+
'sagemaker==2.183.0', # 2.24.1# modify by yx 2023-02-27, 2023-09-18 到 2.183.0 [最后支持3.7的版本], 上一个版本2.135.0
|
|
28
|
+
'boto3==1.28.49', # 1.24.27 1.18.36 # modify by yx 2023-02-27, 2023-09-18 到 1.28.49, 上一个版本1.26.79
|
|
29
|
+
'trino==0.327.0'
|
|
30
|
+
# 下面的包不能放到这里安装,依赖太多,需要尽量简单
|
|
31
|
+
# 'importlib_metadata==1.6.1',
|
|
32
|
+
# 'duckdb==0.3.4'
|
|
21
33
|
],
|
|
22
34
|
python_requires=">=3.5",
|
|
23
35
|
classifiers=[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__="0.19.8"
|
|
@@ -9,27 +9,32 @@ import requests
|
|
|
9
9
|
import requests.adapters
|
|
10
10
|
import six
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
from tfduck.common.defines import BMOBJ
|
|
13
|
+
|
|
14
|
+
# class BM(object):
|
|
15
|
+
# def log_error(self, *args, **kwargs):
|
|
16
|
+
# try:
|
|
17
|
+
# if args:
|
|
18
|
+
# print(args)
|
|
19
|
+
# if kwargs:
|
|
20
|
+
# print(kwargs)
|
|
21
|
+
# except:
|
|
22
|
+
# pass
|
|
23
|
+
# BMOBJ = BM()
|
|
24
|
+
|
|
25
|
+
# opends_api_url_prefix = 'https://open.bdp.cn'
|
|
26
|
+
opends_api_url_prefix = 'http://172.22.129.1:8361' # 李波搭建的bdp传输后台 外网http://47.89.187.14:8361 内网:http://172.22.129.1:8361
|
|
24
27
|
# yx_socks5_proxy = {"http": "socks5://127.0.0.1:1080",
|
|
25
|
-
# "https": "socks5://127.0.0.1:1080"}
|
|
26
|
-
yx_socks5_proxy = {
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
# "https": "socks5://127.0.0.1:1080"}
|
|
29
|
+
yx_socks5_proxy = {
|
|
30
|
+
"http": "http://bdp-proxy:okbdp@161.117.59.90:80", # "http://47.101.168.174:8899",
|
|
31
|
+
"https": "http://bdp-proxy:okbdp@161.117.59.90:80", # "http://47.101.168.174:8899"
|
|
32
|
+
}
|
|
33
|
+
# 走[国内代理]的好处,因为[BDP服务器]在北京,[BDP服务器]本身有超时机制,传输数据超时就触发连接中断错误,导致各种connection abort,ssl oef,enconet等错误
|
|
34
|
+
# 数据从[美东]->[国内代理],因为[国内代理]自己设置的,不存在[美东]->[国内代理]有数据超时的问题
|
|
35
|
+
# 如果是[国内代理]-->[BDP服务器],因为国内传输很快,所以就不会触发BDP的超时机制
|
|
36
|
+
use_socks5_proxy = False
|
|
37
|
+
need_redirect = False
|
|
33
38
|
VERSION = "1.0.3"
|
|
34
39
|
|
|
35
40
|
|
|
@@ -54,13 +59,6 @@ class OpenDS:
|
|
|
54
59
|
param = {}
|
|
55
60
|
param['_t'] = time.time()
|
|
56
61
|
param['access_token'] = self.token
|
|
57
|
-
|
|
58
|
-
headers = {
|
|
59
|
-
'Content-type': 'text/html;charset=utf-8',
|
|
60
|
-
'Content-Encoding': 'gzip',
|
|
61
|
-
"User-Agent": "bdp-sdk-python, {version}".format(version=VERSION)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
62
|
try_count = 0
|
|
65
63
|
result = {}
|
|
66
64
|
while True:
|
|
@@ -70,33 +68,40 @@ class OpenDS:
|
|
|
70
68
|
# BMOBJ.log_error("requests default retry count: %s" %
|
|
71
69
|
# requests.adapters.DEFAULT_RETRIES)
|
|
72
70
|
if payload:
|
|
71
|
+
headers = {
|
|
72
|
+
'Content-type': 'text/html;charset=utf-8',
|
|
73
|
+
# 'Content-Encoding': 'gzip',
|
|
74
|
+
"User-Agent": "bdp-sdk-python, {version}".format(version=VERSION)
|
|
75
|
+
}
|
|
73
76
|
payload_str = u'%s' % json.dumps(payload)
|
|
74
77
|
# gzip
|
|
75
78
|
# s = io.StringIO() #only python2
|
|
76
79
|
# g = gzip.GzipFile(fileobj=s, mode='w')
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if 0:
|
|
81
|
+
s = six.BytesIO() # python 3
|
|
82
|
+
payload_str = payload_str.encode("utf8")
|
|
83
|
+
g = gzip.GzipFile(fileobj=s, mode='w')
|
|
84
|
+
g.write(payload_str)
|
|
85
|
+
g.close()
|
|
86
|
+
else:
|
|
87
|
+
payload_str = payload_str.encode("utf8") # 不用gzip的方式
|
|
82
88
|
if use_socks5_proxy:
|
|
83
89
|
res = requests.post(
|
|
84
|
-
_url, data=
|
|
90
|
+
_url, data=payload_str, headers=headers, verify=False, timeout=(60, 3600), proxies=yx_socks5_proxy).text # 连接超时60秒,读取超时3600秒
|
|
85
91
|
else:
|
|
86
92
|
res = requests.post(
|
|
87
|
-
_url, data=
|
|
88
|
-
# if 0: # 解压出来看看对不对
|
|
89
|
-
# test_value = s.getvalue()
|
|
90
|
-
# data = gzip.GzipFile('', 'rb', 9, six.BytesIO(test_value))
|
|
91
|
-
# page = data.read()
|
|
92
|
-
# jdata = json.loads(page.decode("utf8"))
|
|
93
|
-
# print(33333 ,len(jdata))
|
|
93
|
+
_url, data=payload_str, headers=headers, verify=False, timeout=(60, 3600)).text # 连接超时60秒,读取超时3600秒
|
|
94
94
|
else:
|
|
95
|
+
headers = {
|
|
96
|
+
'Content-type': 'text/html;charset=utf-8',
|
|
97
|
+
# 'Content-Encoding': 'gzip',
|
|
98
|
+
"User-Agent": "bdp-sdk-python, {version}".format(version=VERSION)
|
|
99
|
+
}
|
|
95
100
|
if use_socks5_proxy:
|
|
96
|
-
res = requests.
|
|
101
|
+
res = requests.get(
|
|
97
102
|
_url, headers=headers, verify=False, timeout=(60, 3600), proxies=yx_socks5_proxy).text # 连接超时60秒,读取超时3600秒
|
|
98
103
|
else:
|
|
99
|
-
res = requests.
|
|
104
|
+
res = requests.get(
|
|
100
105
|
_url, headers=headers, verify=False, timeout=(60, 3600)).text # 连接超时60秒,读取超时3600秒
|
|
101
106
|
result = json.loads(res)
|
|
102
107
|
|
|
@@ -114,7 +119,7 @@ class OpenDS:
|
|
|
114
119
|
# HttpServer默认设置了超时时间为2分钟,当一个请求的处理时间超过2分钟,HttpServer会自动将该请求的socket关闭掉,于是客户端便收到了 ECONNRESET 的错误信息了
|
|
115
120
|
# 修改每次上传的最大条数可以减少这个ECONNRESET的出现问题
|
|
116
121
|
# 例如: (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')",),))
|
|
117
|
-
# except IOError as e3: # 有时候是其他IO错误
|
|
122
|
+
# except IOError as e3: # 有时候是其他IO错误
|
|
118
123
|
# try_count += 1
|
|
119
124
|
# BMOBJ.log_error(
|
|
120
125
|
# 'can not connect to server, retry ... | reason: %s' % str(e3))
|