Spaces:
Sleeping
Sleeping
push cfg_db
Browse files
execution_engine/.ipynb_checkpoints/start_engine-checkpoint.sh
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
echo $NUM_WORKERS
|
3 |
+
|
4 |
+
gunicorn \
|
5 |
+
-w ${NUM_WORKERS} \
|
6 |
+
--bind 0.0.0.0:${GUNICORN_PORT} \
|
7 |
+
--timeout 0 \
|
8 |
+
--log-level ${LOG_LEVEL} \
|
9 |
+
"wsgi:app"
|
10 |
+
|
11 |
+
# #!/usr/bin/env bash
|
12 |
+
# set -euo pipefail
|
13 |
+
|
14 |
+
# PORT_TO_USE="${PORT:-7860}"
|
15 |
+
# HOST="0.0.0.0"
|
16 |
+
# WORKERS="${NUM_WORKERS:-2}"
|
17 |
+
# LOG="${LOG_LEVEL:-info}"
|
18 |
+
|
19 |
+
|
20 |
+
# exec gunicorn "wsgi:app" \
|
21 |
+
# --bind "${HOST}:${PORT_TO_USE}" \
|
22 |
+
# --workers "${WORKERS}" \
|
23 |
+
# --timeout 180 \
|
24 |
+
# --graceful-timeout 30 \
|
25 |
+
# --keep-alive 65 \
|
26 |
+
# --log-level "${LOG}" \
|
27 |
+
# --access-logfile - \
|
28 |
+
# --error-logfile -
|
execution_engine/.ipynb_checkpoints/wsgi-checkpoint.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from app import app
|
2 |
+
|
3 |
+
if __name__ == "__main__":
|
4 |
+
app.run()
|
5 |
+
|
6 |
+
# wsgi.py
|
7 |
+
# from flask import Flask, jsonify, request
|
8 |
+
# from flask_cors import CORS
|
9 |
+
|
10 |
+
# app = Flask(__name__)
|
11 |
+
# CORS(app)
|
12 |
+
|
13 |
+
# @app.get("/health")
|
14 |
+
# def health():
|
15 |
+
# return "ok", 200
|
16 |
+
|
17 |
+
# @app.get("/")
|
18 |
+
# def index():
|
19 |
+
# routes = sorted(str(r) for r in app.url_map.iter_rules())
|
20 |
+
# return jsonify(
|
21 |
+
# status="ok",
|
22 |
+
# message="SAFIM execution engine is running",
|
23 |
+
# routes=routes,
|
24 |
+
# examples={
|
25 |
+
# "health": "GET /health",
|
26 |
+
# "runtimes": "GET /runtimes # если у вас есть этот эндпоинт",
|
27 |
+
# "execute_code": {
|
28 |
+
# "method": "POST",
|
29 |
+
# "path": "/execute_code # или ваш реальный путь",
|
30 |
+
# "json": {"language": "python", "code": "print(1)"},
|
31 |
+
# },
|
32 |
+
# },
|
33 |
+
# ), 200
|
execution_engine/start_engine.sh
CHANGED
@@ -1,27 +1,28 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
#!/usr/bin/env bash
|
11 |
-
set -euo pipefail
|
12 |
|
13 |
-
PORT_TO_USE="${PORT:-7860}"
|
14 |
-
HOST="0.0.0.0"
|
15 |
-
WORKERS="${NUM_WORKERS:-2}"
|
16 |
-
LOG="${LOG_LEVEL:-info}"
|
17 |
|
18 |
|
19 |
-
exec gunicorn "wsgi:app" \
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
echo $NUM_WORKERS
|
3 |
|
4 |
+
gunicorn \
|
5 |
+
-w ${NUM_WORKERS} \
|
6 |
+
--bind 0.0.0.0:${GUNICORN_PORT} \
|
7 |
+
--timeout 0 \
|
8 |
+
--log-level ${LOG_LEVEL} \
|
9 |
+
"wsgi:app"
|
10 |
|
11 |
+
# #!/usr/bin/env bash
|
12 |
+
# set -euo pipefail
|
13 |
|
14 |
+
# PORT_TO_USE="${PORT:-7860}"
|
15 |
+
# HOST="0.0.0.0"
|
16 |
+
# WORKERS="${NUM_WORKERS:-2}"
|
17 |
+
# LOG="${LOG_LEVEL:-info}"
|
18 |
|
19 |
|
20 |
+
# exec gunicorn "wsgi:app" \
|
21 |
+
# --bind "${HOST}:${PORT_TO_USE}" \
|
22 |
+
# --workers "${WORKERS}" \
|
23 |
+
# --timeout 180 \
|
24 |
+
# --graceful-timeout 30 \
|
25 |
+
# --keep-alive 65 \
|
26 |
+
# --log-level "${LOG}" \
|
27 |
+
# --access-logfile - \
|
28 |
+
# --error-logfile -
|
execution_engine/wsgi.py
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
# wsgi.py
|
7 |
-
from flask import Flask, jsonify, request
|
8 |
-
from flask_cors import CORS
|
9 |
|
10 |
-
app = Flask(__name__)
|
11 |
-
CORS(app)
|
12 |
|
13 |
-
@app.get("/health")
|
14 |
-
def health():
|
15 |
-
|
16 |
|
17 |
-
@app.get("/")
|
18 |
-
def index():
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
1 |
+
from app import app
|
2 |
|
3 |
+
if __name__ == "__main__":
|
4 |
+
app.run()
|
5 |
|
6 |
# wsgi.py
|
7 |
+
# from flask import Flask, jsonify, request
|
8 |
+
# from flask_cors import CORS
|
9 |
|
10 |
+
# app = Flask(__name__)
|
11 |
+
# CORS(app)
|
12 |
|
13 |
+
# @app.get("/health")
|
14 |
+
# def health():
|
15 |
+
# return "ok", 200
|
16 |
|
17 |
+
# @app.get("/")
|
18 |
+
# def index():
|
19 |
+
# routes = sorted(str(r) for r in app.url_map.iter_rules())
|
20 |
+
# return jsonify(
|
21 |
+
# status="ok",
|
22 |
+
# message="SAFIM execution engine is running",
|
23 |
+
# routes=routes,
|
24 |
+
# examples={
|
25 |
+
# "health": "GET /health",
|
26 |
+
# "runtimes": "GET /runtimes # если у вас есть этот эндпоинт",
|
27 |
+
# "execute_code": {
|
28 |
+
# "method": "POST",
|
29 |
+
# "path": "/execute_code # или ваш реальный путь",
|
30 |
+
# "json": {"language": "python", "code": "print(1)"},
|
31 |
+
# },
|
32 |
+
# },
|
33 |
+
# ), 200
|