Exemplo n.º 1
0
class FlowConfig(object):
    conf = get_default_config()
    IP = conf.get("ip", None)
    if IP is None:
        raise ValueError(f"IP not configured. "
                         f"Please use command line tool pipeline config or modify setting file pipeline/config.yaml")
    PORT = conf.get("port", None)
    if PORT is None:
        raise ValueError(f"PORT not configured. "
                         f"Please use command line tool pipeline config or modify setting file pipeline/config.yaml")
Exemplo n.º 2
0
class FlowConfig(object):
    conf = get_default_config()
    IP = conf.get("ip", None)
    if IP is None:
        raise ValueError(
            f"IP not configured. "
            f"Please use command line tool pipeline init to set Flow server IP."
        )
    PORT = conf.get("port", None)
    if PORT is None:
        raise ValueError(
            f"PORT not configured. "
            f"Please use command line tool pipeline init to set Flow server port"
        )
Exemplo n.º 3
0
 def log_directory(cls):
     conf = get_default_config()
     # log_directory = os.environ.get("FATE_PIPELINE_LOG", "")
     log_directory = conf.get("log_directory")
     if log_directory:
         log_directory = Path(log_directory).resolve()
     else:
         log_directory = Path(__file__).parent.parent.joinpath("logs")
     try:
         log_directory.mkdir(parents=True, exist_ok=True)
     except Exception as e:
         raise RuntimeError(f"can't create log directory for pipeline: {log_directory}") from e
     if not Path(log_directory).resolve().is_dir():
         raise NotADirectoryError(f"provided log directory {log_directory} is not a directory.")
     return log_directory
Exemplo n.º 4
0
 def system_setting(cls):
     conf = get_default_config()
     system_setting = conf.get("system_setting", {})
     # system_role = system_setting.get("role", None)
     return system_setting
Exemplo n.º 5
0
from pathlib import Path

from pipeline.backend import get_default_config
from pipeline.constant import JobStatus

__all__ = [
    "JobStatus", "VERSION", "SERVER_VERSION", "TIME_QUERY_FREQS", "Role",
    "StatusCode", "LogPath", "LogFormat", "IODataType", "FlowConfig"
]

VERSION = 2
SERVER_VERSION = "v1"
TIME_QUERY_FREQS = 0.5

CONSOLE_DISPLAY_LOG = get_default_config().get("console_display_log", True)
if CONSOLE_DISPLAY_LOG is None:
    CONSOLE_DISPLAY_LOG = True


class Role(object):
    LOCAL = "local"
    GUEST = "guest"
    HOST = "host"
    ARBITER = "arbiter"

    @classmethod
    def support_roles(cls):
        roles = set()
        for role_key, role in cls.__dict__.items():
            if role_key.startswith("__") and isinstance(role_key, str):