# Path: app/configs.py
# APP_PATH = os.path.dirname(os.path.abspath(__file__))
# PROJECT_PATH = os.path.dirname(APP_PATH)
#     EC = EnjoliverConfig("%s/configs.yaml" % os.path.dirname(__file__))
# class EnjoliverConfig:
#     def config_override(self, key: str, default):
#     def __init__(self, yaml_full_path=os.getenv("ENJOLIVER_CONFIGS_YAML",
#                                                 "%s/configs.yaml" % APP_PATH), importer=""):


import argparse
import multiprocessing
import os
import signal
import sys
import time
from app import (
    configs,
    smartdb,
    ops,
    gunicorn_conf
)
                os.remove(os.path.join(directory, item))
        except FileNotFoundError:
            os.makedirs(directory)


def matchbox(ec):
    cmd = [
        "%s/runtime/matchbox/matchbox" % PROJECT_PATH,
        "-address",
        ec.matchbox_uri.replace("https://", "").replace("http://", ""),
        "-assets-path",
        "%s" % ec.matchbox_assets,
        "-data-path",
        "%s" % ec.matchbox_path,
        "-log-level",
        ec.matchbox_logging_level.lower(),
    ]
    print("exec[%s] -> %s\n" % (os.getpid(), " ".join(cmd)))
    with open(ec.matchbox_pid_file, "w") as f:
        f.write("%d" % os.getpid())
    os.execve(cmd[0], cmd, os.environ)


def plan(ec):
    cmd = [
        PYTHON,
        "%s/plans/k8s_2t.py" % APP_PATH,
    ]
    print("exec[%s] -> %s\n" % (os.getpid(), " ".join(cmd)))
    with open(ec.plan_pid_file, "w") as f:

# Path: app/configs.py
# APP_PATH = os.path.dirname(os.path.abspath(__file__))
# PROJECT_PATH = os.path.dirname(APP_PATH)
#     EC = EnjoliverConfig("%s/configs.yaml" % os.path.dirname(__file__))
# class EnjoliverConfig:
#     def config_override(self, key: str, default):
#     def __init__(self, yaml_full_path=os.getenv("ENJOLIVER_CONFIGS_YAML",
#                                                 "%s/configs.yaml" % APP_PATH), importer=""):


# Path: manage.py
import argparse
import multiprocessing
import os
import signal
import sys
import time
from app import (
    configs,
    smartdb,
    ops,
    gunicorn_conf
)

                os.remove(os.path.join(directory, item))
        except FileNotFoundError:
            os.makedirs(directory)


def matchbox(ec):
    cmd = [
        "%s/runtime/matchbox/matchbox" % PROJECT_PATH,
        "-address",
        ec.matchbox_uri.replace("https://", "").replace("http://", ""),
        "-assets-path",
        "%s" % ec.matchbox_assets,
        "-data-path",
        "%s" % ec.matchbox_path,
        "-log-level",
        ec.matchbox_logging_level.lower(),
    ]
    print("exec[%s] -> %s\n" % (os.getpid(), " ".join(cmd)))
    with open(ec.matchbox_pid_file, "w") as f:
        f.write("%d" % os.getpid())
    os.execve(cmd[0], cmd, os.environ)


def plan(ec):
    cmd = [
        PYTHON,
        "%s/plans/k8s_2t.py" % APP_PATH,
    ]
    print("exec[%s] -> %s\n" % (os.getpid(), " ".join(cmd)))
    with open(ec.plan_pid_file, "w") as f:

        f.write("%d" % os.getpid())