remote-run-everything 2.0.5__tar.gz → 2.0.7__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.5/remote_run_everything.egg-info → remote_run_everything-2.0.7}/PKG-INFO +1 -1
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/pyproject.toml +4 -1
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/__init__.py +1 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/by_http.py +8 -2
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/by_http_tool.py +10 -8
- remote_run_everything-2.0.7/remote_run_everything/deploy/by_sftp.py +75 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7/remote_run_everything.egg-info}/PKG-INFO +1 -1
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything.egg-info/SOURCES.txt +1 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/LICENSE +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/MANIFEST.in +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/README.md +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/__init__.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/backup.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/crud_sqlalchemy.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/crude_duck.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/kv_store.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/__init__.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/record_mod.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/__init__.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql_mysql.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql_pg.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql_tool.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/__init__.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/common.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/common1.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/decorators.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/sqlacodegen_go_struct.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/vsconf/conf_txt.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/vsconf/core.py +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything.egg-info/dependency_links.txt +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything.egg-info/top_level.txt +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/setup.cfg +0 -0
- {remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/test/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "remote_run_everything"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.7"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="Wang Qi", email="wangmarkqi@gmail.com" },
|
|
6
6
|
]
|
|
@@ -18,3 +18,6 @@ license-files = ["LICEN[CS]E*"]
|
|
|
18
18
|
Homepage = 'https://github.com/wangmarkqi/remote_run_everything'
|
|
19
19
|
Issues = "https://github.com/wangmarkqi/remote_run_everything/issues"
|
|
20
20
|
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["setuptools>=40.8.0", "wheel","sqlalchemy","arrow","duckdb","requests","paramiko"]
|
|
23
|
+
build-backend = "setuptools.build_meta"
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/by_http.py
RENAMED
|
@@ -29,9 +29,12 @@ class ByHttp:
|
|
|
29
29
|
sql = f"select * from down where path='{path}' and time='{t}' "
|
|
30
30
|
res = con.sql(sql).fetchone()
|
|
31
31
|
if res is not None: continue
|
|
32
|
+
ok=self.t.pull(self.host, path, self.local, self.remote)
|
|
33
|
+
if ok!="ok":
|
|
34
|
+
print ("err==",ok,dic)
|
|
35
|
+
continue
|
|
32
36
|
print("down", dic)
|
|
33
37
|
con.execute(f"delete from down where path='{path}' ")
|
|
34
|
-
self.t.pull(self.host, path, self.local, self.remote)
|
|
35
38
|
add_l.append(dic)
|
|
36
39
|
con.commit()
|
|
37
40
|
c.insert_many(eg, mod, add_l)
|
|
@@ -53,10 +56,13 @@ class ByHttp:
|
|
|
53
56
|
sql = f"select * from up where path='{path}' and time='{t}' and host='{self.host}' "
|
|
54
57
|
res = con.sql(sql).fetchone()
|
|
55
58
|
if res is not None: continue
|
|
59
|
+
ok=self.t.push(self.host, path, self.local, self.remote)
|
|
60
|
+
if ok!="ok":
|
|
61
|
+
print ("err==",ok,dic)
|
|
62
|
+
continue
|
|
56
63
|
print("up==", dic)
|
|
57
64
|
sql = f"delete from up where path='{path}' and host='{self.host}'"
|
|
58
65
|
con.execute(sql).commit()
|
|
59
|
-
self.t.push(self.host, path, self.local, self.remote)
|
|
60
66
|
dic['host'] = self.host
|
|
61
67
|
add_l.append(dic)
|
|
62
68
|
con.commit()
|
|
@@ -6,23 +6,26 @@ import os, glob, arrow, requests
|
|
|
6
6
|
class ByHttpTool:
|
|
7
7
|
def push(self, host, f, local, remote):
|
|
8
8
|
# b64 = Common().readb64(f)
|
|
9
|
-
|
|
9
|
+
# push_url = f"{host}/wb64"
|
|
10
10
|
# pay = {"b64": b64, "path": path}
|
|
11
11
|
# res = requests.post(push_url, json=pay).json()
|
|
12
12
|
rpath = self.loc2remote(f, local, remote)
|
|
13
13
|
lpath = f
|
|
14
|
-
self.upload_file(host, rpath, lpath)
|
|
15
|
-
|
|
14
|
+
return self.upload_file(host, rpath, lpath)
|
|
15
|
+
|
|
16
16
|
|
|
17
17
|
def pull(self, host, f, local, remote):
|
|
18
18
|
rpath = f
|
|
19
19
|
lpath = self.remote2loc(f, local, remote)
|
|
20
|
-
|
|
20
|
+
try:
|
|
21
|
+
self.download_file(host, rpath, lpath)
|
|
22
|
+
return "ok"
|
|
23
|
+
except Exception as e:
|
|
24
|
+
return str(e)
|
|
21
25
|
# res = requests.post(f"{host}/rb64", json={"path": f}).json()
|
|
22
26
|
# b64 = res['data']
|
|
23
27
|
# path = self.remote2loc(f, local, remote)
|
|
24
28
|
# Common().writeb64(path, b64)
|
|
25
|
-
return
|
|
26
29
|
|
|
27
30
|
def all_remote_path(self, host, root, disallow_keys=None):
|
|
28
31
|
url = f"{host}/iterdir"
|
|
@@ -83,6 +86,5 @@ class ByHttpTool:
|
|
|
83
86
|
def upload_file(self, host, rpath, lpath):
|
|
84
87
|
url = f"{host}/upfile"
|
|
85
88
|
files = {'files': open(lpath, 'rb')}
|
|
86
|
-
r = requests.post(url, files=files, data={'path': rpath})
|
|
87
|
-
|
|
88
|
-
return "fail"
|
|
89
|
+
r = requests.post(url, files=files, data={'path': rpath}).json()
|
|
90
|
+
return r['status']
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import os.path
|
|
2
|
+
from remote_run_everything.db.crud_sqlalchemy import Crud
|
|
3
|
+
from remote_run_everything.deploy.record_mod import Up, Down
|
|
4
|
+
from remote_run_everything.db.crude_duck import CrudeDuck
|
|
5
|
+
from remote_run_everything.deploy.by_http_tool import ByHttpTool
|
|
6
|
+
import paramiko
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
class BySftp:
|
|
10
|
+
def __init__(self, host,port,user,pwd, local, remote, dbpath):
|
|
11
|
+
self.host=host
|
|
12
|
+
self.cli=self.sftp_cli(host,port,user,pwd)
|
|
13
|
+
self.local = local
|
|
14
|
+
self.remote = remote
|
|
15
|
+
self.dbpath = dbpath
|
|
16
|
+
self.t = ByHttpTool()
|
|
17
|
+
def sftp_cli(self,host,port,user,pwd):
|
|
18
|
+
ssh = paramiko.SSHClient()
|
|
19
|
+
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
20
|
+
transport = paramiko.Transport(host, port)
|
|
21
|
+
transport.connect(None, user, pwd)
|
|
22
|
+
cli= paramiko.SFTPClient.from_transport(transport)
|
|
23
|
+
return cli
|
|
24
|
+
|
|
25
|
+
def up(self, disallow_keys=None):
|
|
26
|
+
c = Crud()
|
|
27
|
+
eg = c.sqlite_engine(self.dbpath)
|
|
28
|
+
c.create_table(eg, Up)
|
|
29
|
+
con = CrudeDuck().install_sql_ext(self.dbpath)
|
|
30
|
+
mod = Up
|
|
31
|
+
loc_files = self.t.all_local_path(self.local, disallow_keys)
|
|
32
|
+
add_l = []
|
|
33
|
+
for dic in loc_files:
|
|
34
|
+
path = dic['path']
|
|
35
|
+
t = dic['time']
|
|
36
|
+
sql = f"select * from up where path='{path}' and time='{t}' and host='{self.host}' "
|
|
37
|
+
res = con.sql(sql).fetchone()
|
|
38
|
+
if res is not None: continue
|
|
39
|
+
|
|
40
|
+
rpath = self.t.loc2remote(path, self.local, self.remote)
|
|
41
|
+
rpath=rpath.replace("\\","/")
|
|
42
|
+
lpath=path.replace("\\","/")
|
|
43
|
+
res=self.upload_file(rpath, lpath)
|
|
44
|
+
print("up==", path,res)
|
|
45
|
+
if res=="ok":
|
|
46
|
+
sql = f"delete from up where path='{path}' and host='{self.host}'"
|
|
47
|
+
con.execute(sql).commit()
|
|
48
|
+
dic['host'] = self.host
|
|
49
|
+
add_l.append(dic)
|
|
50
|
+
con.commit()
|
|
51
|
+
c.insert_many(eg, mod, add_l)
|
|
52
|
+
|
|
53
|
+
def mkdirs(self,fpath):
|
|
54
|
+
dpath = os.path.dirname(fpath)
|
|
55
|
+
l=dpath.split('/')
|
|
56
|
+
if len(l)==0:return
|
|
57
|
+
if l[0]=="":l[0]="/"
|
|
58
|
+
for i in range(len(l)+1):
|
|
59
|
+
if i<=1:continue
|
|
60
|
+
ll=l[:i]
|
|
61
|
+
path=os.path.join(*ll)
|
|
62
|
+
try:
|
|
63
|
+
# default mod 777
|
|
64
|
+
path=path.replace('\\','/')
|
|
65
|
+
self.cli.mkdir(path)
|
|
66
|
+
except Exception as e:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
def upload_file(self, rpath, lpath):
|
|
70
|
+
self.mkdirs(rpath)
|
|
71
|
+
try:
|
|
72
|
+
self.cli.put(lpath, rpath)
|
|
73
|
+
return "ok"
|
|
74
|
+
except:
|
|
75
|
+
return "fail"
|
|
@@ -15,6 +15,7 @@ remote_run_everything/db/kv_store.py
|
|
|
15
15
|
remote_run_everything/deploy/__init__.py
|
|
16
16
|
remote_run_everything/deploy/by_http.py
|
|
17
17
|
remote_run_everything/deploy/by_http_tool.py
|
|
18
|
+
remote_run_everything/deploy/by_sftp.py
|
|
18
19
|
remote_run_everything/deploy/record_mod.py
|
|
19
20
|
remote_run_everything/nosql/__init__.py
|
|
20
21
|
remote_run_everything/nosql/no_sql.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/backup.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/crude_duck.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/db/kv_store.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/deploy/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/nosql/no_sql_pg.py
RENAMED
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/__init__.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/common.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/tools/common1.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/vsconf/conf_txt.py
RENAMED
|
File without changes
|
{remote_run_everything-2.0.5 → remote_run_everything-2.0.7}/remote_run_everything/vsconf/core.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|