Ejemplo n.º 1
0
 def register():
     if get_base_config("use_registry", False):
         zk = ServiceUtils.get_zk()
         zk.start()
         model_transfer_url = 'http://{}:{}{}'.format(
             get_lan_ip(), HTTP_PORT, FATE_FLOW_MODEL_TRANSFER_ENDPOINT)
         fate_flow_model_transfer_service = '{}/{}'.format(
             FATE_SERVICES_REGISTERED_PATH.get("fateflow", ""),
             parse.quote(model_transfer_url, safe=' '))
         try:
             zk.create(fate_flow_model_transfer_service,
                       makepath=True,
                       ephemeral=True)
             stat_logger.info("register path {} to {}".format(
                 fate_flow_model_transfer_service,
                 ";".join(get_base_config("zookeeper", {}).get("hosts"))))
         except Exception as e:
             stat_logger.exception(e)
Ejemplo n.º 2
0
 def get_zk():
     zk_config = get_base_config("zookeeper", {})
     if zk_config.get("use_acl", False):
         default_acl = make_digest_acl(zk_config.get("user", ""),
                                       zk_config.get("password", ""),
                                       all=True)
         zk = KazooClient(hosts=zk_config.get("hosts", []),
                          default_acl=[default_acl],
                          auth_data=[("digest", "{}:{}".format(
                              zk_config.get("user", ""),
                              zk_config.get("password", "")))])
     else:
         zk = KazooClient(hosts=zk_config.get("hosts", []))
     return zk
Ejemplo n.º 3
0
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
# -*- coding: utf-8 -*-
import os

from arch.api import Backend
from arch.api.utils import file_utils, log_utils
from fate_flow.entity.runtime_config import RuntimeConfig
from arch.api.utils.conf_utils import get_base_config
import __main__


WORK_MODE = get_base_config('work_mode', 0)
BACKEND = Backend.EGGROLL
USE_LOCAL_DATABASE = True

# upload data
USE_LOCAL_DATA = True

# Local authentication switch
USE_AUTHENTICATION = False
PRIVILEGE_COMMAND_WHITELIST = []

# Node check switch
CHECK_NODES_IDENTITY = False

# Registry
SERVICES_SUPPORT_REGISTRY = ["servings", "fateflow"]
Ejemplo n.º 4
0
 def get(service_name, default=None):
     if get_base_config(
             "use_registry",
             False) and service_name in SERVICES_SUPPORT_REGISTRY:
         return ServiceUtils.get_from_registry(service_name)
     return ServiceUtils.get_from_file(service_name, default)
Ejemplo n.º 5
0
 def __init__(self):
     config = conf_utils.get_base_config("redis", {}).copy()
     self.pool = redis.ConnectionPool(host=config['host'], port=config['port'], password=config['password'], \
          max_connections=config['max_connections'], db=config['db'])
     LOGGER.info('init redis connection pool.')