<commit_before>%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92-*-
%% ex: ts=4 sw=4 et
%% @author <NAME> <<EMAIL>>
%% @author <NAME> <<EMAIL>>
%% @copyright 2012 Opscode, Inc.

-module(sqerl_app).

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

%% Short for "environment value", just provides some sugar for
%% grabbing config values
-define(EV(Key), application:get_env(sqerl, Key)).

start(_StartType, _StartArgs) ->

    {ok, DbType} = ?EV(db_type),

    %% Unsure where this gets used
    {ok, _MetricsModule} = ?EV(metrics_module),

    {ok, Host} = ?EV(host),
    {ok, Port} = ?EV(port),
    {ok, User} = ?EV(user),
    {ok, Password} = ?EV(pass),
    {ok, Database} = ?EV(db),
    {ok, PreparedStatements} = ?EV(prepared_statement_source),
    {ok, ColumnTransforms} = ?EV(column_transforms),

    {ok, MaxPoolSize} = ?EV(max_count),
    {ok, InitPoolSize} = ?EV(init_count),

    PoolerConfig = [[{name, "sqerl"},
                     {max_count, MaxPoolSize},
                     {init_count, InitPoolSize},
                     {start_mfa, {sqerl_client, start_link, [DbType,
                                                             [{host, Host},
                                                              {port, Port},
                                                              {user, User},
                                                              {pass, Password},
                                                              {db, Database},
                                                              {prepared_statement_source, PreparedStatements},
                                                              {column_transforms, ColumnTransforms}]]}}]],
    sqerl_sup:start_link(PoolerConfig).

stop(_State) ->
    ok.<commit_msg>Read idle_check from app.config<commit_after>%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92-*-
%% ex: ts=4 sw=4 et
%% @author <NAME> <<EMAIL>>
%% @author <NAME> <<EMAIL>>
%% @copyright 2012 Opscode, Inc.

-module(sqerl_app).

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

%% Short for "environment value", just provides some sugar for
%% grabbing config values
-define(EV(Key), application:get_env(sqerl, Key)).
-define(EVD(Key, Default), case application:get_env(sqerl, Key) of
                               undefined -> {ok, Default};
                               V -> V
                           end).

start(_StartType, _StartArgs) ->

    {ok, DbType} = ?EV(db_type),

    {ok, Host} = ?EV(host),
    {ok, Port} = ?EV(port),
    {ok, User} = ?EV(user),
    {ok, Password} = ?EV(pass),
    {ok, Database} = ?EV(db),
    {ok, PreparedStatements} = ?EV(prepared_statement_source),
    {ok, ColumnTransforms} = ?EV(column_transforms),

    {ok, MaxPoolSize} = ?EV(max_count),
    {ok, InitPoolSize} = ?EV(init_count),
    {ok, IdleCheck} = ?EVD(idle_check, 10000),

    PoolerConfig = [[{name, "sqerl"},
                     {max_count, MaxPoolSize},
                     {init_count, InitPoolSize},
                     {start_mfa, {sqerl_client, start_link, [DbType,
                                                             [{host, Host},
                                                              {port, Port},
                                                              {user, User},
                                                              {pass, Password},
                                                              {db, Database},
                                                              {idle_check, IdleCheck},
                                                              {prepared_statement_source, PreparedStatements},
                                                              {column_transforms, ColumnTransforms}]]}}]],
    sqerl_sup:start_link(PoolerConfig).

stop(_State) ->
    ok.
{'fraction_non_alphanumeric': 0.13367477592829705, 'fraction_numerical': 0.006914212548015365, 'mean_word_length': 1.4260869565217391, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5171256', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1025, 'n_words': 230}