@@ -1,4 +1,5 @@
import os
+import sys
import time
import uvicorn
import subprocess
@@ -62,6 +63,11 @@ def call_sh(path: str):
return os.popen(f"sh {path}").read()
# return subprocess.call(f"sh {path}")
+def run_shell(shell):
+ cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True,
+ stdout=sys.stdout, universal_newlines=True, shell=True, bufsize=1)
+ cmd.communicate()
+ return cmd.returncode
@app.post("/upload")
def upload(file: UploadFile = File(...), path: str = Form(...)):
@@ -1,20 +0,0 @@
-import requests
-
-cmd_str = """
-def run(kwargs):
- import numpy as np
- from sklearn import preprocessing
- x = kwargs['x']
- min_max_scaler = preprocessing.MinMaxScaler()
- x_minmax = min_max_scaler.fit_transform(np.array(x).reshape(-1, 2))
- return x_minmax
-"""
-s = [[1, 20, 30, 40, 5, 6, 7, 8, 9, 10], [1, 20, 30, 40, 5, 6, 7, 8, 9, 10]]
-kkk = {'x': s}
-print(requests.post("http://172.18.248.152:8000/exec", json={
- "function_str": cmd_str,
- "call_str": "run(kwargs)",
- "param_dict": {
- "kwargs": kkk
- }
-}).json())
-import subprocess
-import sys
-params = [
- {
- "name": "k8s",
-]
-def run_shell(shell):
- cmd = subprocess.Popen(shell, stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True,
- stdout=sys.stdout, universal_newlines=True, shell=True, bufsize=1)
- cmd.communicate()
- return cmd.returncode
-if __name__ == '__main__':
- pass
-run_shell("tail -f C:/Users/root/IdeaProjects/python-base/index.html")
@@ -1,7 +0,0 @@
-name: runshell
-subs:
- - name: k8s
- subs:
- - name: log
- shell: tail -f ${fileName;枚举;默认}
- - name