remote-run-everything 2.0.8__tar.gz → 2.0.9__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.
- {remote_run_everything-2.0.8/remote_run_everything.egg-info → remote_run_everything-2.0.9}/PKG-INFO +1 -15
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/README.md +0 -14
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/pyproject.toml +1 -1
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/__init__.py +1 -0
- remote_run_everything-2.0.9/remote_run_everything/deploy/process_manage.py +46 -0
- remote_run_everything-2.0.8/remote_run_everything/tools/common1.py → remote_run_everything-2.0.9/remote_run_everything/tools/common.py +20 -20
- remote_run_everything-2.0.9/remote_run_everything/tools/common1.py +25 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9/remote_run_everything.egg-info}/PKG-INFO +1 -15
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything.egg-info/SOURCES.txt +1 -0
- remote_run_everything-2.0.8/remote_run_everything/tools/common.py +0 -56
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/LICENSE +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/MANIFEST.in +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/binocular/ba_front.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/binocular/back_tool.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/binocular/cam_tool.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/binocular/front_tool.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/binocular/relative_pos.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/__init__.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/backup.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/crud_sqlalchemy.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/crude_duck.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/kv_store.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/__init__.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/by_http.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/by_http_tool.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/by_sftp.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/record_mod.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/__init__.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql_mysql.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql_pg.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql_tool.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/tools/__init__.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/tools/decorators.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/tools/sqlacodegen_go_struct.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/vsconf/conf_txt.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/vsconf/core.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything.egg-info/dependency_links.txt +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything.egg-info/top_level.txt +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/setup.cfg +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/test/test.py +0 -0
- {remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/test/test_binocular.py +0 -0
{remote_run_everything-2.0.8/remote_run_everything.egg-info → remote_run_everything-2.0.9}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remote_run_everything
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.9
|
|
4
4
|
Summary: Deploy Tools
|
|
5
5
|
Author-email: Wang Qi <wangmarkqi@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -99,22 +99,8 @@ q = {"a": 2,"b":{"$gt":1}}
|
|
|
99
99
|
print(col.find(q))
|
|
100
100
|
db.drop_db()
|
|
101
101
|
```
|
|
102
|
-
## 进程管理
|
|
103
|
-
```python
|
|
104
|
-
import os
|
|
105
|
-
class ProcessManage:
|
|
106
|
-
# nosql is instance of Nosql or Nosqlmysql or Nqsqlpg
|
|
107
|
-
def __init__(self, nosql):
|
|
108
|
-
self.db = nosql
|
|
109
|
-
self.col = self.db['pid']
|
|
110
102
|
|
|
111
|
-
# 只需要在程序中引入这个函数,启动后会把pid存入数据库,然后有了pid,结合psutil,什么都有了
|
|
112
|
-
def save_pid(self, name, cmd):
|
|
113
|
-
dic = {"name": name, "cmd": cmd, "pid": os.getpid()}
|
|
114
|
-
print("save pid", dic)
|
|
115
|
-
self.col.insert_one(dic)
|
|
116
103
|
|
|
117
|
-
```
|
|
118
104
|
## 缓存装饰器
|
|
119
105
|
```python
|
|
120
106
|
from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey,cache_by_nth_arg
|
|
@@ -84,22 +84,8 @@ q = {"a": 2,"b":{"$gt":1}}
|
|
|
84
84
|
print(col.find(q))
|
|
85
85
|
db.drop_db()
|
|
86
86
|
```
|
|
87
|
-
## 进程管理
|
|
88
|
-
```python
|
|
89
|
-
import os
|
|
90
|
-
class ProcessManage:
|
|
91
|
-
# nosql is instance of Nosql or Nosqlmysql or Nqsqlpg
|
|
92
|
-
def __init__(self, nosql):
|
|
93
|
-
self.db = nosql
|
|
94
|
-
self.col = self.db['pid']
|
|
95
87
|
|
|
96
|
-
# 只需要在程序中引入这个函数,启动后会把pid存入数据库,然后有了pid,结合psutil,什么都有了
|
|
97
|
-
def save_pid(self, name, cmd):
|
|
98
|
-
dic = {"name": name, "cmd": cmd, "pid": os.getpid()}
|
|
99
|
-
print("save pid", dic)
|
|
100
|
-
self.col.insert_one(dic)
|
|
101
88
|
|
|
102
|
-
```
|
|
103
89
|
## 缓存装饰器
|
|
104
90
|
```python
|
|
105
91
|
from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey,cache_by_nth_arg
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/__init__.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from remote_run_everything.deploy.by_http import ByHttp
|
|
2
2
|
from remote_run_everything.deploy.by_sftp import BySftp
|
|
3
|
+
from remote_run_everything.deploy.process_manage import ProcessManage
|
|
3
4
|
|
|
4
5
|
from remote_run_everything.db.crude_duck import CrudeDuck
|
|
5
6
|
from remote_run_everything.db.crud_sqlalchemy import Crud
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import os, signal
|
|
2
|
+
import subprocess, sys
|
|
3
|
+
class ProcessManage:
|
|
4
|
+
def is_process_running(self,pid):
|
|
5
|
+
import psutil
|
|
6
|
+
try:
|
|
7
|
+
process = psutil.Process(pid)
|
|
8
|
+
# Check if process is still running
|
|
9
|
+
return process.is_running()
|
|
10
|
+
except psutil.NoSuchProcess:
|
|
11
|
+
return False
|
|
12
|
+
except psutil.AccessDenied:
|
|
13
|
+
# Process exists but we don't have permission to access it
|
|
14
|
+
print(f"Access denied to process {pid}")
|
|
15
|
+
return True
|
|
16
|
+
def read_pid_file(self,pidfile):
|
|
17
|
+
if os.path.exists(pidfile):
|
|
18
|
+
with open(pidfile, "rb") as f:
|
|
19
|
+
pid = f.read().decode()
|
|
20
|
+
return pid
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
# 只需要在程序中引入这个函数,启动后会把 os.getpid()存入,然后有了pid,结合psutil,什么都有了
|
|
24
|
+
def write_pid_file(self,pidfile,pid):
|
|
25
|
+
with open(pidfile, "wb") as f:
|
|
26
|
+
s = str(pid).encode()
|
|
27
|
+
f.write(s)
|
|
28
|
+
|
|
29
|
+
def kill_by_pid(self,pid):
|
|
30
|
+
try:
|
|
31
|
+
os.kill(int(pid), signal.SIGTERM)
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print("kill err==", e)
|
|
34
|
+
|
|
35
|
+
def popen_with_pid(self, workdir, app):
|
|
36
|
+
os.chdir(workdir)
|
|
37
|
+
process = subprocess.Popen(app, creationflags=subprocess.CREATE_NEW_CONSOLE)
|
|
38
|
+
pid= process.pid
|
|
39
|
+
print("new pid====",pid)
|
|
40
|
+
return pid
|
|
41
|
+
# sys.exit()
|
|
42
|
+
|
|
43
|
+
def restart_windows(self):
|
|
44
|
+
os.system("shutdown -t 0 -r -f")
|
|
45
|
+
|
|
46
|
+
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import socket, os, tomllib
|
|
2
|
+
from remote_run_everything.tools.common1 import Common1
|
|
1
3
|
import pandas as pd
|
|
2
4
|
import jinja2, os,base64,struct, glob, arrow, uuid, hashlib
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
class Common(Common1):
|
|
7
|
+
@property
|
|
8
|
+
def local_ip(self):
|
|
9
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
10
|
+
s.connect(("8.8.8.8", 80))
|
|
11
|
+
ip = s.getsockname()[0]
|
|
12
|
+
s.close()
|
|
13
|
+
return ip
|
|
14
|
+
|
|
15
|
+
def read_conf(self, path=None):
|
|
16
|
+
if path is None:
|
|
17
|
+
d = "D://mypy/conf" if os.name == 'nt' else "/data/mypy/conf"
|
|
18
|
+
n = "win" if os.name == "nt" else self.local_ip
|
|
19
|
+
path = f"{d}/{n}.toml"
|
|
20
|
+
with open(path, "rb") as f:
|
|
21
|
+
data = tomllib.load(f)
|
|
22
|
+
return data
|
|
6
23
|
|
|
7
24
|
def table_search(self, data, search):
|
|
8
25
|
res = []
|
|
@@ -83,19 +100,6 @@ class Common1:
|
|
|
83
100
|
zeros = "".join(l)
|
|
84
101
|
return f"{zeros}{d}"
|
|
85
102
|
|
|
86
|
-
def clear_by_days(self, root, n):
|
|
87
|
-
files = glob.glob(f"{root}/*/*.*", recursive=True)
|
|
88
|
-
now = arrow.now()
|
|
89
|
-
for f in files:
|
|
90
|
-
info = os.stat(f).st_mtime
|
|
91
|
-
dif = now - arrow.get(info)
|
|
92
|
-
if dif.days > n:
|
|
93
|
-
os.remove(f)
|
|
94
|
-
|
|
95
|
-
def str2uuid(self, s):
|
|
96
|
-
hex_string = hashlib.md5(s.encode("UTF-8")).hexdigest()
|
|
97
|
-
return str(uuid.UUID(hex=hex_string))
|
|
98
|
-
|
|
99
103
|
def ascii2hex(self,l):
|
|
100
104
|
tu = [i.replace("0x", "") for i in l]
|
|
101
105
|
tu = [self.prefix_zero(2, i) for i in tu]
|
|
@@ -114,10 +118,6 @@ class Common1:
|
|
|
114
118
|
return struct.unpack('>f', bytes.fromhex(s))[0]
|
|
115
119
|
return struct.unpack('<f', bytes.fromhex(s))[0]
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
121
|
if __name__ == '__main__':
|
|
122
|
-
g =
|
|
122
|
+
g = Common()
|
|
123
123
|
a = g.prefix_zero(5, 111)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import jinja2, os,base64,struct, glob, arrow, uuid, hashlib
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Common1:
|
|
5
|
+
|
|
6
|
+
def clear_by_days(self, root, n):
|
|
7
|
+
files = glob.glob(f"{root}/*/*.*", recursive=True)
|
|
8
|
+
now = arrow.now()
|
|
9
|
+
for f in files:
|
|
10
|
+
info = os.stat(f).st_mtime
|
|
11
|
+
dif = now - arrow.get(info)
|
|
12
|
+
if dif.days > n:
|
|
13
|
+
os.remove(f)
|
|
14
|
+
|
|
15
|
+
def str2uuid(self, s):
|
|
16
|
+
hex_string = hashlib.md5(s.encode("UTF-8")).hexdigest()
|
|
17
|
+
return str(uuid.UUID(hex=hex_string))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if __name__ == '__main__':
|
|
25
|
+
g = Common1()
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9/remote_run_everything.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remote_run_everything
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.9
|
|
4
4
|
Summary: Deploy Tools
|
|
5
5
|
Author-email: Wang Qi <wangmarkqi@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -99,22 +99,8 @@ q = {"a": 2,"b":{"$gt":1}}
|
|
|
99
99
|
print(col.find(q))
|
|
100
100
|
db.drop_db()
|
|
101
101
|
```
|
|
102
|
-
## 进程管理
|
|
103
|
-
```python
|
|
104
|
-
import os
|
|
105
|
-
class ProcessManage:
|
|
106
|
-
# nosql is instance of Nosql or Nosqlmysql or Nqsqlpg
|
|
107
|
-
def __init__(self, nosql):
|
|
108
|
-
self.db = nosql
|
|
109
|
-
self.col = self.db['pid']
|
|
110
102
|
|
|
111
|
-
# 只需要在程序中引入这个函数,启动后会把pid存入数据库,然后有了pid,结合psutil,什么都有了
|
|
112
|
-
def save_pid(self, name, cmd):
|
|
113
|
-
dic = {"name": name, "cmd": cmd, "pid": os.getpid()}
|
|
114
|
-
print("save pid", dic)
|
|
115
|
-
self.col.insert_one(dic)
|
|
116
103
|
|
|
117
|
-
```
|
|
118
104
|
## 缓存装饰器
|
|
119
105
|
```python
|
|
120
106
|
from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey,cache_by_nth_arg
|
|
@@ -21,6 +21,7 @@ remote_run_everything/deploy/__init__.py
|
|
|
21
21
|
remote_run_everything/deploy/by_http.py
|
|
22
22
|
remote_run_everything/deploy/by_http_tool.py
|
|
23
23
|
remote_run_everything/deploy/by_sftp.py
|
|
24
|
+
remote_run_everything/deploy/process_manage.py
|
|
24
25
|
remote_run_everything/deploy/record_mod.py
|
|
25
26
|
remote_run_everything/nosql/__init__.py
|
|
26
27
|
remote_run_everything/nosql/no_sql.py
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import jinja2, requests, os
|
|
2
|
-
import pandas as pd
|
|
3
|
-
import socket, os, tomllib
|
|
4
|
-
import base64
|
|
5
|
-
import os, signal
|
|
6
|
-
import subprocess, sys
|
|
7
|
-
from remote_run_everything.tools.common1 import Common1
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Common(Common1):
|
|
11
|
-
@property
|
|
12
|
-
def local_ip(self):
|
|
13
|
-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
14
|
-
s.connect(("8.8.8.8", 80))
|
|
15
|
-
ip = s.getsockname()[0]
|
|
16
|
-
s.close()
|
|
17
|
-
return ip
|
|
18
|
-
|
|
19
|
-
def read_conf(self, path=None):
|
|
20
|
-
if path is None:
|
|
21
|
-
d = "D://mypy/conf" if os.name == 'nt' else "/data/mypy/conf"
|
|
22
|
-
n = "win" if os.name == "nt" else self.local_ip
|
|
23
|
-
path = f"{d}/{n}.toml"
|
|
24
|
-
with open(path, "rb") as f:
|
|
25
|
-
data = tomllib.load(f)
|
|
26
|
-
return data
|
|
27
|
-
|
|
28
|
-
def kill_by_pidfile(self, pidfile):
|
|
29
|
-
if os.path.exists(pidfile):
|
|
30
|
-
with open(pidfile, "rb") as f:
|
|
31
|
-
pid = f.read().decode()
|
|
32
|
-
print("exist pid===", pid)
|
|
33
|
-
try:
|
|
34
|
-
os.kill(int(pid), signal.SIGTERM)
|
|
35
|
-
except Exception as e:
|
|
36
|
-
print("kill err==", e)
|
|
37
|
-
|
|
38
|
-
def start_with_pidfile(self, workdir, pidfile, app):
|
|
39
|
-
os.chdir(workdir)
|
|
40
|
-
process = subprocess.Popen(app, creationflags=subprocess.CREATE_NEW_CONSOLE)
|
|
41
|
-
print("new pid====", process.pid)
|
|
42
|
-
with open(pidfile, "wb") as f:
|
|
43
|
-
s = str(process.pid).encode()
|
|
44
|
-
f.write(s)
|
|
45
|
-
sys.exit()
|
|
46
|
-
|
|
47
|
-
def supervise(self, pidfile, app, workdir=None):
|
|
48
|
-
if workdir is None:
|
|
49
|
-
workdir = os.path.dirname(pidfile)
|
|
50
|
-
self.kill_by_pidfile(pidfile)
|
|
51
|
-
self.start_with_pidfile(workdir, pidfile, app)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if __name__ == '__main__':
|
|
55
|
-
g = Common()
|
|
56
|
-
a = g.prefix_zero(5, 111)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/backup.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/crude_duck.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/db/kv_store.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/by_http.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/deploy/by_sftp.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/nosql/no_sql_pg.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/tools/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/vsconf/conf_txt.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.8 → remote_run_everything-2.0.9}/remote_run_everything/vsconf/core.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|