<commit_before>%%%--------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2016 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%--------------------------------------------------------------------
%%% @doc This module allows for synchronous and asynchronous service action
%%% execution.
%%% @end
%%%--------------------------------------------------------------------
-module(service_executor).
-author("<NAME>").

-behaviour(gen_server).

-include("modules/errors.hrl").
-include_lib("ctool/include/logging.hrl").
-include("names.hrl").

%% API
-export([start_link/0, handle_results/1, receive_results/2]).

%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
    code_change/3]).

-type task_id() :: binary().
-type hosts_results() :: {GoodResults :: onepanel_rpc:results(),
    BadResults :: onepanel_rpc:results()}.
-type step_result() :: {Module :: module(), Function :: atom()} |
{Module :: module(), Function :: atom(), HostsResults :: hosts_results()}.
-type action_result() :: {task_finished, Service :: service:name(),
    Action :: service:action(), Result :: ok | #error{}}.
-type result() :: action_result() | step_result().
-type results() :: [result()].

-export_type([task_id/0, hosts_results/0, step_result/0, action_result/0,
    result/0, results/0]).

-record(task, {<commit_msg>VFS-4992 Fix type declaration for service_executor:results/0<commit_after>%%%--------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2016 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%--------------------------------------------------------------------
%%% @doc This module allows for synchronous and asynchronous service action
%%% execution.
%%% @end
%%%--------------------------------------------------------------------
-module(service_executor).
-author("<NAME>").

-behaviour(gen_server).

-include("modules/errors.hrl").
-include_lib("ctool/include/logging.hrl").
-include("names.hrl").

%% API
-export([start_link/0, handle_results/1, receive_results/2]).

%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
    code_change/3]).

-type task_id() :: binary().
-type hosts_results() :: {GoodResults :: onepanel_rpc:results(),
    BadResults :: onepanel_rpc:results()}.
-type step_result() :: {Module :: module(), Function :: atom()} |
{Module :: module(), Function :: atom(), HostsResults :: hosts_results()}.
-type action_result() :: {task_finished, {
    Service :: service:name(), Action :: service:action(), Result :: ok | #error{}
}}.
-type result() :: action_result() | step_result().
-type results() :: [result()].

-export_type([task_id/0, hosts_results/0, step_result/0, action_result/0,
    result/0, results/0]).

-record(task, {
{'fraction_non_alphanumeric': 0.3090663970340411, 'fraction_numerical': 0.014492753623188406, 'mean_word_length': 2.5845410628019323, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '107201', 'n_tokens_mistral': 883, 'n_tokens_neox': 858, 'n_words': 197}