remote-run-everything 2.0.2__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.
- remote_run_everything/__init__.py +16 -0
- remote_run_everything/db/__init__.py +0 -0
- remote_run_everything/db/backup.py +38 -0
- remote_run_everything/db/crud_sqlalchemy.py +97 -0
- remote_run_everything/db/crude_duck.py +122 -0
- remote_run_everything/db/kv_store.py +109 -0
- remote_run_everything/deploy/__init__.py +0 -0
- remote_run_everything/deploy/by_http.py +82 -0
- remote_run_everything/deploy/by_http_server.py +56 -0
- remote_run_everything/deploy/by_http_tool.py +64 -0
- remote_run_everything/deploy/record_mod.py +26 -0
- remote_run_everything/nosql/__init__.py +0 -0
- remote_run_everything/nosql/no_sql.py +73 -0
- remote_run_everything/nosql/no_sql_mysql.py +67 -0
- remote_run_everything/nosql/no_sql_pg.py +69 -0
- remote_run_everything/nosql/no_sql_tool.py +81 -0
- remote_run_everything/tools/__init__.py +0 -0
- remote_run_everything/tools/common.py +56 -0
- remote_run_everything/tools/common1.py +100 -0
- remote_run_everything/tools/decorators.py +81 -0
- remote_run_everything/tools/sqlacodegen_go_struct.py +109 -0
- remote_run_everything/vsconf/conf_txt.py +106 -0
- remote_run_everything/vsconf/core.py +29 -0
- remote_run_everything-2.0.2.dist-info/METADATA +109 -0
- remote_run_everything-2.0.2.dist-info/RECORD +28 -0
- remote_run_everything-2.0.2.dist-info/WHEEL +5 -0
- remote_run_everything-2.0.2.dist-info/licenses/LICENSE +19 -0
- remote_run_everything-2.0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
def tasks_rs():
|
|
2
|
+
return '''
|
|
3
|
+
{
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"label": "cargo run",
|
|
8
|
+
"type": "shell",
|
|
9
|
+
"command": "~/.cargo/bin/cargo", // note: full path to the cargo
|
|
10
|
+
"args": [
|
|
11
|
+
// "run",
|
|
12
|
+
"test",
|
|
13
|
+
"--",
|
|
14
|
+
"--nocapture",
|
|
15
|
+
// "-D",
|
|
16
|
+
// "warnings",
|
|
17
|
+
// "--release",
|
|
18
|
+
// "--",
|
|
19
|
+
// "arg1"
|
|
20
|
+
],
|
|
21
|
+
"group": {
|
|
22
|
+
"kind": "build",
|
|
23
|
+
"isDefault": true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
'''
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def launch_rs():
|
|
32
|
+
return '''
|
|
33
|
+
{
|
|
34
|
+
"version": "0.2.0",
|
|
35
|
+
"configurations": [
|
|
36
|
+
{
|
|
37
|
+
"name": "deb", // 调试配置名称(显示在下拉菜单)
|
|
38
|
+
"type": "cppdbg", // 调试器类型(C/C++ 扩展提供)
|
|
39
|
+
"request": "launch", // 启动新进程调试(区别于 attach)
|
|
40
|
+
"program": "${workspaceFolder}/target/debug", // 调试目标路径
|
|
41
|
+
"args": [], // 程序启动参数
|
|
42
|
+
"preLaunchTask": "cargo run"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
'''
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def git():
|
|
50
|
+
return '''
|
|
51
|
+
# 首先忽略所有的文件
|
|
52
|
+
*
|
|
53
|
+
# 但是不忽略目录
|
|
54
|
+
!*/
|
|
55
|
+
# 忽略一些指定的目录名
|
|
56
|
+
**/node_modules/
|
|
57
|
+
**/target/
|
|
58
|
+
**/dist/
|
|
59
|
+
# 不忽略下面指定的文件类型
|
|
60
|
+
!*.vue
|
|
61
|
+
!*.js
|
|
62
|
+
!*.html
|
|
63
|
+
!*.css
|
|
64
|
+
!*.py
|
|
65
|
+
!*.rs
|
|
66
|
+
!*.go
|
|
67
|
+
!*.c
|
|
68
|
+
!*.cpp
|
|
69
|
+
'''
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def idea_vim():
|
|
73
|
+
return '''
|
|
74
|
+
inoremap jj <Esc>
|
|
75
|
+
xnoremap p pgvy
|
|
76
|
+
'''
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def conda_rc():
|
|
80
|
+
return '''
|
|
81
|
+
channels:
|
|
82
|
+
- defaults
|
|
83
|
+
show_channel_urls: true
|
|
84
|
+
default_channels:
|
|
85
|
+
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
|
|
86
|
+
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
|
|
87
|
+
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
|
|
88
|
+
custom_channels:
|
|
89
|
+
conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
90
|
+
msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
91
|
+
bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
92
|
+
menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
93
|
+
pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
94
|
+
simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
|
95
|
+
'''
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def pip_rc():
|
|
99
|
+
return '''
|
|
100
|
+
[global]
|
|
101
|
+
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
102
|
+
timeout = 6000
|
|
103
|
+
[install]
|
|
104
|
+
trusted-host=pypi.tuna.tsinghua.edu.cn
|
|
105
|
+
disable-pip-version-check = true
|
|
106
|
+
'''
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import os, shutil
|
|
2
|
+
from remote_run_everything.vsconf.conf_txt import *
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class VsConf:
|
|
6
|
+
def wf(self, path, s):
|
|
7
|
+
base = os.path.dirname(path)
|
|
8
|
+
if not os.path.exists(base):
|
|
9
|
+
os.makedirs(base, exist_ok=True)
|
|
10
|
+
with open(path, 'wb') as f:
|
|
11
|
+
f.write(s.encode())
|
|
12
|
+
|
|
13
|
+
def vs_rust(self):
|
|
14
|
+
self.wf(f"./.vscode/tasks.json", tasks_rs())
|
|
15
|
+
self.wf(f"./.vscode/launch.json", launch_rs())
|
|
16
|
+
|
|
17
|
+
def git_ignore(self):
|
|
18
|
+
self.wf(f"./.gitignore", git())
|
|
19
|
+
def vim_rc(self):
|
|
20
|
+
self.wf("~/.ideavimrc",idea_vim())
|
|
21
|
+
self.wf("~/.vimrc",idea_vim())
|
|
22
|
+
def conda_rc(self):
|
|
23
|
+
self.wf("~/.condarc",conda_rc())
|
|
24
|
+
if os.name=="nt":
|
|
25
|
+
self.wf("~/pip/pip.ini",pip_rc())
|
|
26
|
+
else:
|
|
27
|
+
self.wf("~/.pip/pip.conf",pip_rc())
|
|
28
|
+
|
|
29
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: remote_run_everything
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: Deploy Tools
|
|
5
|
+
Author-email: Wang Qi <wangmarkqi@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/wangmarkqi/remote_run_everything
|
|
8
|
+
Project-URL: Issues, https://github.com/wangmarkqi/remote_run_everything/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# remote_run_everthing 各类实用代码集合封装
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
```shell
|
|
20
|
+
pip install -U --index-url https://test.pypi.org/simple/ remote_run_everything
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 运维功能
|
|
24
|
+
```python
|
|
25
|
+
# 服务端代码
|
|
26
|
+
from remote_run_everything import cherrypy_in_daemon,ByHttpServer
|
|
27
|
+
cherrypy_in_daemon(ByHttpServer,8888,"/deploy")
|
|
28
|
+
|
|
29
|
+
# 上推代码
|
|
30
|
+
from remote_run_everything import ByHttp
|
|
31
|
+
def test_up():
|
|
32
|
+
host = "http://x.x.x.x:8888/deploy"
|
|
33
|
+
local = "D://project/demand/shop"
|
|
34
|
+
remote = "/data/mypy/shop"
|
|
35
|
+
db = "D://wq/temp/shop.db"
|
|
36
|
+
bh = ByHttp(host, local, remote, db)
|
|
37
|
+
bh.up(['node_modules', ".pyc", ".idea"])
|
|
38
|
+
|
|
39
|
+
# 下拉代码
|
|
40
|
+
def test_down():
|
|
41
|
+
host = "http://x.x.x.x:8888/deploy"
|
|
42
|
+
local = "D://project/demand/shop"
|
|
43
|
+
remote = "/data/mypy/shop"
|
|
44
|
+
db = "D://wq/temp/shop.db"
|
|
45
|
+
bh = ByHttp(host, local, remote, db)
|
|
46
|
+
bh.down(['node_modules', ".pyc", ".idea"])
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 缓存功能
|
|
50
|
+
```python
|
|
51
|
+
from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey
|
|
52
|
+
@cache_by_name("asdf", 1)
|
|
53
|
+
def test1():
|
|
54
|
+
print("运行了函数!!!!!!!!!!!!!!!!")
|
|
55
|
+
return {"a": "adaf"}
|
|
56
|
+
@cache_by_1starg("asdf", 1)
|
|
57
|
+
def test2(arg1):
|
|
58
|
+
print("运行了函数!!!!!!!!!!!!!!!!")
|
|
59
|
+
return {"a": "adaf"}
|
|
60
|
+
@cache_by_rkey(1)
|
|
61
|
+
def test2(rkey="xx"):
|
|
62
|
+
print("运行了函数!!!!!!!!!!!!!!!!")
|
|
63
|
+
return {"a": "adaf"}
|
|
64
|
+
```
|
|
65
|
+
## KV数据库
|
|
66
|
+
```python
|
|
67
|
+
from remote_run_everything import KvStore
|
|
68
|
+
kv = KvStore('test.db')
|
|
69
|
+
print(len(kv))
|
|
70
|
+
kv['hello1'] = 'you1'
|
|
71
|
+
del kv['hello1']
|
|
72
|
+
print(len(kv))
|
|
73
|
+
print('hello1' in kv)
|
|
74
|
+
kv['hello3'] = 'newvalue'
|
|
75
|
+
print(kv.keys())
|
|
76
|
+
print(kv.values())
|
|
77
|
+
print(kv.items())
|
|
78
|
+
for k in kv:
|
|
79
|
+
print(k, kv[k])
|
|
80
|
+
```
|
|
81
|
+
## Mongodb like 数据库
|
|
82
|
+
```python
|
|
83
|
+
from remote_run_everything import Nosql,NosqlPg,NosqlMysql
|
|
84
|
+
db = Nosql()
|
|
85
|
+
t = "test"
|
|
86
|
+
col = db['test']
|
|
87
|
+
dic = {"a": 2, "b": 456, 'c': "adf", "d": "2020-02-02"}
|
|
88
|
+
col.insert_one(dic)
|
|
89
|
+
dic = {"a": 56, "b": 456, 'c': "adf", "d": "2020-07-02"}
|
|
90
|
+
col.insert_one(dic)
|
|
91
|
+
q = {"a": 2,"b":{"$gt":1}}
|
|
92
|
+
print(col.find(q))
|
|
93
|
+
db.drop_db()
|
|
94
|
+
```
|
|
95
|
+
## 进程管理
|
|
96
|
+
```python
|
|
97
|
+
class ProcessManage:
|
|
98
|
+
# nosql is instance of Nosql or Nosqlmysql or Nqsqlpg
|
|
99
|
+
def __init__(self, nosql):
|
|
100
|
+
self.db = nosql
|
|
101
|
+
self.col = self.db['pid']
|
|
102
|
+
|
|
103
|
+
# 只需要在程序中引入这个函数,启动后会把pid存入数据库,然后有了pid,结合psutil,什么都有了
|
|
104
|
+
def save_pid(self, name, cmd):
|
|
105
|
+
dic = {"name": name, "cmd": cmd, "pid": os.getpid()}
|
|
106
|
+
print("save pid", dic)
|
|
107
|
+
self.col.insert_one(dic)
|
|
108
|
+
|
|
109
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
remote_run_everything/__init__.py,sha256=QZgJLX-Wjt31-7gK1IREJ68ipzznnKs8Qiwd0F3jBMQ,850
|
|
2
|
+
remote_run_everything/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
remote_run_everything/db/backup.py,sha256=_mDUNQo1q6Gc75-diwadrooZsdV89KGG9mIcS4rmcBQ,1152
|
|
4
|
+
remote_run_everything/db/crud_sqlalchemy.py,sha256=c6zxrIRbNT1Lsunpu6zisy7mrsRCs93Gm3hxDTHGCtg,3608
|
|
5
|
+
remote_run_everything/db/crude_duck.py,sha256=qo3KSUTTVkSmVMfyK4UmMkJS4fQdj_xN57zwDpwzxEE,4290
|
|
6
|
+
remote_run_everything/db/kv_store.py,sha256=Df2Lp2l5ip0YQuTdVnlQbkZT_Sz01j9D5bJ8PYaSFRY,3357
|
|
7
|
+
remote_run_everything/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
remote_run_everything/deploy/by_http.py,sha256=bDbngxTTkGnMAvUw7yJ9aQAdMbvDUJlLnbBGhTAO8U8,3343
|
|
9
|
+
remote_run_everything/deploy/by_http_server.py,sha256=_CVOQvUMnZKIJ8eVYXcnAPNBBR9lwSE_Kk6cu41sxuE,1726
|
|
10
|
+
remote_run_everything/deploy/by_http_tool.py,sha256=x2GUi7x4MIhTcaxIsk-nXDQBgUdSO_rSN5z81bnEAoA,2178
|
|
11
|
+
remote_run_everything/deploy/record_mod.py,sha256=29L-RTnvANpjbWRND7GGz5sdCzbz1Ba9QxdS858bdAY,725
|
|
12
|
+
remote_run_everything/nosql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
remote_run_everything/nosql/no_sql.py,sha256=1-dT6LhrayQqLqZ4ES2tmWfXYCEXOnqwNzKgyXWYRG4,2343
|
|
14
|
+
remote_run_everything/nosql/no_sql_mysql.py,sha256=agpXc5UcevN_uojexD9pNG6xAR099tW0pJeWv-Fu2GE,2195
|
|
15
|
+
remote_run_everything/nosql/no_sql_pg.py,sha256=XCrEnHKp5RVHPOyPOMICY2PnvNMkkIIDijTVKjk-ENc,2209
|
|
16
|
+
remote_run_everything/nosql/no_sql_tool.py,sha256=xRu7vsDgr3JQNSo6CLNTtNNxlg4fl-Q7_vw4y9lklWI,2590
|
|
17
|
+
remote_run_everything/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
remote_run_everything/tools/common.py,sha256=UozWsdBwf7mGnvv5hLiaIfalhDaSaMjDOBjky8mo2w8,1747
|
|
19
|
+
remote_run_everything/tools/common1.py,sha256=XEpQBp0zhRs2jM9t7z7b_WFV1j00O3s9T9UlYes5r3c,3502
|
|
20
|
+
remote_run_everything/tools/decorators.py,sha256=SIacNAs7afgkU0D09J-s-YscCVnxSG8Qj9vSL4VzCHw,1988
|
|
21
|
+
remote_run_everything/tools/sqlacodegen_go_struct.py,sha256=NFXRDPOWU7sP9V3ZAtfPQvLl-jJ7SL3qcrYrIrrLKOI,3119
|
|
22
|
+
remote_run_everything/vsconf/conf_txt.py,sha256=nhFuKLlts-sCIBmfr0IKv1pP-qPUvQQrsRRg21q5Gd4,2418
|
|
23
|
+
remote_run_everything/vsconf/core.py,sha256=HmSEzXjGPY7R64rwfAV024YxMHwmBkLin6lGace4U0M,833
|
|
24
|
+
remote_run_everything-2.0.2.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
25
|
+
remote_run_everything-2.0.2.dist-info/METADATA,sha256=WXMWPBWwrXC_fY8YGPbtkZGUcWtPLQ34eZvBKj0GNqk,3121
|
|
26
|
+
remote_run_everything-2.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
remote_run_everything-2.0.2.dist-info/top_level.txt,sha256=1TUcAqPgSwiVBqUHz-1pZFXvRpr9cudEYlmfw_mztRY,22
|
|
28
|
+
remote_run_everything-2.0.2.dist-info/RECORD,,
|
|
@@ -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 @@
|
|
|
1
|
+
remote_run_everything
|