Ejemplo n.º 1
0
def reset_database():

    logger.info('Service: reset_database()')
    session = Database.get_session()

    MatchController(session).drop()
    SeasonController(session).drop()
    ChampionshipController(session).drop()
Ejemplo n.º 2
0
def _create_matches(season):

    session = Database.open_new_session()

    logger.info('extract_matches(): ' + str(season))
    MatchController(session).create_matches(season)
    season = SeasonController(session).update_summary_fields(season)
    MatchController(session).update_rounds(season)
Ejemplo n.º 3
0
def request_matches(replace=False):
    logger.info('request_matches() ')
    session = Database.get_session()

    seasons = SeasonController(session).list()
    args = [(s, replace) for s in seasons]

    pool = mp.Pool(mp.cpu_count())
    pool.map(_request_matches, args)
Ejemplo n.º 4
0
def _create_matches(season):

    logger.info('create_matches(): ' + str(season))
    session = Database.open_new_session()

    MatchController(session).create_matches(season)
    SeasonController(session).update_summary_fields(season)
    MatchController(session).process_results(season)
    MatchController(session).update_rounds(season)
Ejemplo n.º 5
0
def reset_database():

    logger.info('reset_database() ')

    session = Database.get_session()
    ChampionshipController(session).drop()
    SeasonController(session).drop()
    MatchController(session).drop()
    PerformanceController(session).drop()
Ejemplo n.º 6
0
def request_matches(replace=False):

    logger.info('Service: request_matches()')
    session = Database.get_session()

    seasons = list(SeasonController(session).list())
    args = [(seasons[i], replace) for i, item_a in enumerate(seasons)]

    p = mp.Pool(mp.cpu_count())
    p.map(_request_matches, args)
Ejemplo n.º 7
0
def create_odds(replace=False):

    session = Database.get_session()

    if replace:
        OddsController(session).unset_odds()

    seasons = SeasonController(session).list()

    pool = mp.Pool(mp.cpu_count())
    pool.map(_create_odds, seasons)
Ejemplo n.º 8
0
def create_odds(replace=False):
    logger.info('Service: extract_odds()')

    session = Database.SESSION
    seasons = list(SeasonController(session).list())

    if replace:
        OddsController(session).reset()

    p = mp.Pool(mp.cpu_count())
    p.map(_create_odds, seasons)
Ejemplo n.º 9
0
def create_matches(replace=False):
    logger.info('create_matches() ')
    session = Database.get_session()
    MatchController(session).initialize()

    if replace:
        MatchController(session).drop()

    seasons = SeasonController(session).list()

    pool = mp.Pool(mp.cpu_count())
    pool.map(_create_matches, seasons)
Ejemplo n.º 10
0
def create_markov_chains(replace=False):

    session = Database.get_session()

    if replace:
        MarkovChainController(session).drop()

    MarkovChainController(session).initialize()
    seasons = SeasonController(session).list()

    pool = mp.Pool(mp.cpu_count())
    pool.map(_create_markov_chains, seasons)
Ejemplo n.º 11
0
def create_performances(replace=False):

    session = Database.get_session()

    if replace:
        PerformanceController(session).drop()

    PerformanceController(session).initialize()
    seasons = SeasonController(session).list()

    pool = mp.Pool(mp.cpu_count())
    pool.map(_create_performances, seasons)
Ejemplo n.º 12
0
def create_matches(replace=False):

    logger.info('Service: create_matches()')
    session = Database.SESSION

    if replace:
        MatchController(session).drop()

    MatchController(session).initialize()
    seasons = list(SeasonController(session).list())

    p = mp.Pool(mp.cpu_count())
    p.map(_create_matches, seasons)
Ejemplo n.º 13
0
def _request_season(args):
    logger.info('_request_season() ' + str(args))
    session = Database.open_new_session()

    SeasonController(session).crawler(*args)
Ejemplo n.º 14
0
def create_seasons(initial_year, final_year):
    """ Create seasons """
    logger.info('create_seasons() ')
    session = Database.get_session()
    SeasonController(session).initialize(initial_year, final_year)
Ejemplo n.º 15
0
def _request_matches(args):

    session = Database.open_new_session()
    SeasonController(session).crawler_matches(*args)
Ejemplo n.º 16
0
def create_seasons(initial_year, final_year):

    logger.info('Service: create_seasons()')
    session = Database.get_session()
    SeasonController(session).initialize(initial_year, final_year)