From af735b366ec961fe71e6ac54eaf68f28c1284e0e Mon Sep 17 00:00:00 2001 From: leondavi Date: Sat, 8 Jun 2024 18:25:46 +0300 Subject: [PATCH] [SOURCE] Fix pattern matching bug of Epochs --- src_erl/NerlnetApp/src/Client/clientStatem.erl | 1 + src_erl/NerlnetApp/src/Source/sourceStatem.erl | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src_erl/NerlnetApp/src/Client/clientStatem.erl b/src_erl/NerlnetApp/src/Client/clientStatem.erl index 89f80992..cd2a0016 100644 --- a/src_erl/NerlnetApp/src/Client/clientStatem.erl +++ b/src_erl/NerlnetApp/src/Client/clientStatem.erl @@ -128,6 +128,7 @@ waitforWorkers(cast, In = {stateChange,WorkerName}, State = #client_statem_state case NewWaitforWorkers of % TODO Guy here we need to check for keep alive with workers [] -> send_client_is_ready(MyName), % when all workers done their work stats:increment_messages_sent(ClientStatsEts), + ?LOG_INFO("Client ~p and its workers are ready~n",[MyName]), {next_state, NextState, State#client_statem_state{waitforWorkers = []}}; _ -> %io:format("Client ~p is waiting for workers ~p~n",[MyName,NewWaitforWorkers]), {next_state, waitforWorkers, State#client_statem_state{waitforWorkers = NewWaitforWorkers}} diff --git a/src_erl/NerlnetApp/src/Source/sourceStatem.erl b/src_erl/NerlnetApp/src/Source/sourceStatem.erl index 17cc4ee2..ea708547 100644 --- a/src_erl/NerlnetApp/src/Source/sourceStatem.erl +++ b/src_erl/NerlnetApp/src/Source/sourceStatem.erl @@ -162,7 +162,6 @@ idle(cast, {startCasting,_Body}, State = #source_statem_state{batchesList = Batc ?LOG_NOTICE("Frequency: ~pHz [Batches/Second]",[Frequency]), ?LOG_NOTICE("Batch size: ~p", [BatchSize]), ?LOG_NOTICE("Sample size = ~p",[SampleSize]), - ?LOG_NOTICE("Rounds of all data (Source Epochs): ~p", [Epochs]), ?LOG_NOTICE("# of batches to send is ~p ",[BatchesToSend]), if Epochs =:= 0 -> @@ -286,14 +285,14 @@ spawnTransmitter(SourceEtsRef, WorkersListOfNames, BatchesListToSend)-> Method = ets:lookup_element(SourceEtsRef, method , ?DATA_IDX), TimeInterval_ms = ets:lookup_element(SourceEtsRef, time_interval_ms, ?DATA_IDX), % frequency to time interval duration in milliseconds between each send ClientWorkerPairs = nerl_tools:get_client_worker_pairs(WorkersListOfNames,WorkersMap,[]), - Epochs = ets:lookup_element(SourceEtsRef, epochs, ?DATA_IDX), Phase = ets:lookup_element(SourceEtsRef, current_phase, ?DATA_IDX), MyName = ets:lookup_element(SourceEtsRef, my_name, ?DATA_IDX), - case Phase of - ?PHASE_TRAINING_ATOM -> pass; - ?PHASE_PREDICTION_ATOM -> Epochs = 1; % In prediction phase, we send only a single epoch always! + Epochs = case Phase of + ?PHASE_TRAINING_ATOM -> ets:lookup_element(SourceEtsRef, epochs, ?DATA_IDX); + ?PHASE_PREDICTION_ATOM -> 1; % In prediction phase, we send only a single epoch always! _ -> ?LOG_ERROR("Source ~p has an unknown phase: ~p",[MyName, Phase]) end, + ?LOG_NOTICE("Rounds of all data (Source Epochs): ~p", [Epochs]), SourcePid = self(), TimeIntervalWithOverheadFactor = TimeInterval_ms * ?SENDING_FREQUENCY_OVERHEAD_FIX_FACTOR_PERC, spawn_link(?MODULE,transmitter,[TimeIntervalWithOverheadFactor,SourceEtsRef, SourcePid ,Epochs, ClientWorkerPairs, BatchesListToSend, Method]).