redis-shake工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
715 B

import os
from pathlib import Path
import jury
import toml
from .constant import PATH_REDIS_SHAKE, PATH_EMPTY_CONFIG_FILE
def get_empty_config():
with open(PATH_EMPTY_CONFIG_FILE, "r") as f:
return toml.load(f)
class RedisShake:
def __init__(self):
self.server = None
self.redis = None
self.dir = f"{jury.get_case_dir()}/redis_shake"
if not os.path.exists(self.dir):
Path(self.dir).mkdir(parents=True, exist_ok=True)
def run(self, toml_config):
with open(f"{self.dir}/redis-shake.toml", "w") as f:
toml.dump(toml_config, f)
self.server = jury.Launcher(args=[PATH_REDIS_SHAKE, "redis-shake.toml"], work_dir=self.dir)