Skip to content

Commit

Permalink
[ApiServerDB] WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad123 committed Feb 22, 2024
1 parent f0b8e55 commit 389da10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src_py/apiServer/apiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,19 @@ def run_current_experiment_phase(self):
events_sync_inst.sync_on_event(EventSync.UPDATE_PHASE)

events_sync_inst.set_event_wait(EventSync.START_CASTING)
self.transmitter.start_casting(current_exp_phase)
self.transmitter.start_casting(current_exp_phase) # Source start sending data to workers
events_sync_inst.sync_on_event(EventSync.START_CASTING)

events_sync_inst.reset() # preparing for next phase
LOG_INFO(f"Phase of {current_exp_phase.get_name()} {current_exp_phase.get_phase_type()} completed")


def next_experiment_phase(self):
current_exp_flow = globe.experiment_focused_on
current_exp_flow.current_exp_phase_index += 1
if current_exp_flow.current_exp_phase_index >= len(current_exp_flow.exp_phase_list) - 1:
return False
return True

def sendDataToSources(self, phase, splitMode = 1): #deprecated
if not globe.CSVsplit: # what is this? TODO ask haran
globe.CSVsplit = splitMode
Expand Down
16 changes: 8 additions & 8 deletions src_py/apiServer/experiment_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def __init__(self ,experiment_name, batch_size_dc: int, network_componenets: Net
self.exp_flow_json = None
self.events_sync_inst = EventSync()

def next_experiment_phase(self):
self.current_exp_phase_index += 1
if self.current_exp_phase_index >= len(self.exp_phase_list) - 1:
return False
return True
# def next_experiment_phase(self):
# self.current_exp_phase_index += 1
# if self.current_exp_phase_index >= len(self.exp_phase_list) - 1:
# return False
# return True

def get_current_experiment_phase(self):
return self.exp_phase_list[self.current_exp_phase_index]
Expand Down Expand Up @@ -160,17 +160,17 @@ def print(self):
#LOG_INFO(f"CSV dataset: {self.csv_dataset.get_csv_file_path()}")
LOG_INFO(f"Number of features: {self.csv_dataset.get_num_of_features()}")
LOG_INFO(f"Number of labels: {self.csv_dataset.get_num_of_labels()}")
LOG_INFO("Phases:")
LOG_INFO("\nPhases:\n")
for phase in self.exp_phase_list:
LOG_INFO(f"Phase name: {phase.get_name()}")
LOG_INFO(f"Phase type: {phase.get_phase_type()}")
LOG_INFO(f"Sources: {phase.get_sources_str_list()}")
LOG_INFO("Source pieces:")
LOG_INFO("\nSource pieces:\n")
for source_piece in phase.get_sources_pieces():
LOG_INFO(f"Source name: {source_piece.get_source_name()}")
LOG_INFO(f"Batch size: {source_piece.get_batch_size()}")
LOG_INFO(f"Phase: {source_piece.get_phase()}")
LOG_INFO(f"Starting offset: {source_piece.get_starting_offset()}")
LOG_INFO(f"Number of batches: {source_piece.get_num_of_batches()}")
LOG_INFO(f"Workers target: {source_piece.get_workers_target()}")
LOG_INFO(f"Workers target: {source_piece.get_target_workers()}")
LOG_INFO("")
1 change: 1 addition & 0 deletions src_py/apiServer/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def post(self):
print(f"Created batch {batch_id} from worker {worker_name} with source {source_name} and duration {duration}") # Todo remove print



#http_request(RouterHost,RouterPort,"predictRes",ListOfResults++"#"++BatchID++"#"++CSVName++"#"++BatchSize)
class predictRes(Resource):
def post(self):
Expand Down

0 comments on commit 389da10

Please sign in to comment.