<commit_before>-module(ramjet).

-export([start/0, start_slave/0, apply_on_all_nodes/3, config/1]).

start() ->
    application:start(bear),
    application:start(folsom),
    application:start(ponos),
    application:set_env(ramjet, report, true),
    application:start(ramjet),
    connect_slaves(),
    start_sessions().

start_slave() ->
    application:start(bear),
    application:start(folsom),
    application:start(ponos),
    application:set_env(ramjet, report, false),
    application:start(ramjet),
    io:format("slave ready.\n", []).

connect_slaves() ->
    [connect_slave(N) || N <- config(slave_nodes)].

connect_slave(NodeName) ->
    io:format("Connecting to ~p.\n", [NodeName]),
    pong = net_adm:ping(NodeName).

start_sessions() ->
    io:format("~p: starting sessions\n", [?MODULE]),
    LoadGeneratorCount = config(load_generator_count),
    Names              = [generator_name(ID) || ID <- lists:seq(1, LoadGeneratorCount)],
    StartSession       = fun() ->
        ramjet_session_sup:start_child(config(tasks), config(handler))
    end,
    LoadSpec           = apply(ponos_load_specs, config(load_fun), config(load_fun_args)),
    Options            = [{duration, config(load_duration)}, {auto_init, false}],
    Args               = [
        [ {name, Name}, {task, StartSession}, {load_spec,LoadSpec}, {options, Options}]
        || Name <- Names
    ],
    [apply_on_all_nodes(ponos, add_load_generators, [[Arg]]) || Arg <- Args],
    apply_on_all_nodes(ponos, init_load_generators, [Names]).<commit_msg>verifying application starts<commit_after>-module(ramjet).

-export([start/0, start_slave/0, apply_on_all_nodes/3, config/1]).

start() ->
    ok = application:start(bear),
    ok = application:start(folsom),
    ok = application:start(ponos),
    ok = application:set_env(ramjet, report, true),
    ok = application:start(ramjet),
    connect_slaves(),
    start_sessions().

start_slave() ->
    ok = application:start(bear),
    ok = application:start(folsom),
    ok = application:start(ponos),
    ok = application:set_env(ramjet, report, false),
    ok = application:start(ramjet),
    io:format("slave ready.\n", []).

connect_slaves() ->
    [connect_slave(N) || N <- config(slave_nodes)].

connect_slave(NodeName) ->
    io:format("Connecting to ~p.\n", [NodeName]),
    pong = net_adm:ping(NodeName).

start_sessions() ->
    io:format("~p: starting sessions\n", [?MODULE]),
    LoadGeneratorCount = config(load_generator_count),
    Names              = [generator_name(ID) || ID <- lists:seq(1, LoadGeneratorCount)],
    StartSession       = fun() ->
        ramjet_session_sup:start_child(config(tasks), config(handler))
    end,
    LoadSpec           = apply(ponos_load_specs, config(load_fun), config(load_fun_args)),
    Options            = [{duration, config(load_duration)}, {auto_init, false}],
    Args               = [
        [ {name, Name}, {task, StartSession}, {load_spec,LoadSpec}, {options, Options}]
        || Name <- Names
    ],
    [apply_on_all_nodes(ponos, add_load_generators, [[Arg]]) || Arg <- Args],
    apply_on_all_nodes(ponos, init_load_generators, [Names]).
{'fraction_non_alphanumeric': 0.15864925135393437, 'fraction_numerical': 0.0031857279388340237, 'mean_word_length': 3.6795827123695974, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2076391', 'n_tokens_mistral': 1028, 'n_tokens_neox': 1029, 'n_words': 171}