mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
Refact: sandbox quickstart.md & add tutorial for code exec component (#14786)
### What problem does this PR solve? Refact: sandbox quickstart.md && add tutorial for code exec component ### Type of change - [x] Refactoring <img width="700" alt="img_v3_0211j_dcff835b-e3bb-4c77-9bc5-3b31a983229g" src="https://github.com/user-attachments/assets/7842fc0f-639a-458f-b164-bc81a99ce4a5" /> --------- Co-authored-by: writinwaters <93570324+writinwaters@users.noreply.github.com>
This commit is contained in:
@@ -41,6 +41,15 @@ ALLOWED_ARTIFACT_EXTENSIONS = {
|
||||
".svg",
|
||||
}
|
||||
|
||||
LOCAL_PYTHON_THREAD_ENV_VARS = (
|
||||
"OPENBLAS_NUM_THREADS",
|
||||
"OMP_NUM_THREADS",
|
||||
"MKL_NUM_THREADS",
|
||||
"NUMEXPR_NUM_THREADS",
|
||||
"BLIS_NUM_THREADS",
|
||||
"VECLIB_MAXIMUM_THREADS",
|
||||
)
|
||||
|
||||
|
||||
def _env_enabled(name: str) -> bool:
|
||||
return os.environ.get(name, "").strip().lower() in {"1", "true", "yes", "on"}
|
||||
@@ -226,13 +235,18 @@ class LocalProvider(SandboxProvider):
|
||||
return os.environ.get(env_name, default)
|
||||
|
||||
def _build_child_env(self, instance_dir: Path) -> dict[str, str]:
|
||||
return {
|
||||
env = {
|
||||
"HOME": str(instance_dir),
|
||||
"MPLBACKEND": "Agg",
|
||||
"PATH": os.environ.get("PATH", ""),
|
||||
"PYTHONUNBUFFERED": "1",
|
||||
"TMPDIR": str(instance_dir),
|
||||
}
|
||||
for name in LOCAL_PYTHON_THREAD_ENV_VARS:
|
||||
value = os.environ.get(name)
|
||||
if value is not None:
|
||||
env[name] = value
|
||||
return env
|
||||
|
||||
def _limit_child_process(self) -> None:
|
||||
import resource
|
||||
|
||||
Reference in New Issue
Block a user