Пример #1
0
def get_logger(logger_name=None):
    if logger_name:
        if logger_name.find('.') >= 0:
            return logging.getLogger(logger_name)
        else:
            return logging.getLogger(f'{consts.PROJECT_NAME}.{logger_name}')
    else:
        return _logger
Пример #2
0
def _request(url, req_func, request_data=None):
    from hypernets.utils import logging as hyn_logging
    hyn_logging.set_level(hyn_logging.DEBUG)
    logger = hyn_logging.getLogger(__name__)

    logger.debug(f"request data :\n{request_data}\nto {url}")
    resp = req_func(url, request_data)
    txt_resp = resp.text
    logger.debug(f"response text: \n{txt_resp}")
    json_resp = json.loads(txt_resp)
    code = json_resp['code']
    if code == 0:
        return json_resp['data']
    else:
        raise RuntimeError(txt_resp)
Пример #3
0
"""
import copy
import inspect
import time

import numpy as np
from joblib import Parallel, delayed
from sklearn import model_selection as sksel
from sklearn.metrics import roc_auc_score, matthews_corrcoef, make_scorer

from hypernets.core import randint
from hypernets.utils import logging, const
from .cfg import TabularCfg as cfg

logger = logging.getLogger(__name__)

roc_auc_scorer = make_scorer(roc_auc_score,
                             greater_is_better=True,
                             needs_threshold=True)
matthews_corrcoef_scorer = make_scorer(matthews_corrcoef)


class FeatureSelectionCallback:
    def on_round_start(
        self,
        round_no,
        features,
    ):
        pass
Пример #4
0
# -*- encoding: utf-8 -*-
import json
import os
import time

import tornado
from tornado.ioloop import PeriodicCallback

from hypernets.hyperctl.batch import ShellJob, Batch
from hypernets.hyperctl.callbacks import BatchCallback
from hypernets.hyperctl.executor import NoResourceException, ShellExecutor, ExecutorManager
from hypernets.utils import logging as hyn_logging

logger = hyn_logging.getLogger(__name__)


class JobScheduler:
    """a FIFO scheduler"""
    def __init__(self,
                 batch,
                 exit_on_finish,
                 interval,
                 executor_manager: ExecutorManager,
                 callbacks=None):
        self.batch = batch
        self.exit_on_finish = exit_on_finish
        self.executor_manager = executor_manager
        self.callbacks = callbacks if callbacks is not None else []

        self._io_loop_instance = None
Пример #5
0
# -*- coding:utf-8 -*-
"""DeepTables logging module."""

from hypernets.utils import logging
from deeptables.utils import consts

_logger = logging.getLogger(consts.PROJECT_NAME)


def get_logger(logger_name=None):
    if logger_name:
        if logger_name.find('.') >= 0:
            return logging.getLogger(logger_name)
        else:
            return logging.getLogger(f'{consts.PROJECT_NAME}.{logger_name}')
    else:
        return _logger