Skip to content

Commit 2702943

Browse files
authored
Merge pull request #560 from ddps-lab/azure-collector-fix
폴더 이름 오타 수정, 멀티 호출를 as_completed 방식아닌 기존 방식으로 롤백
2 parents fbed342 + 16929a1 commit 2702943

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

collector/spot-dataset/azure/lambda/current_collector/lambda_function_sps.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def handle_res_df_for_research(sps_res_desired_count_1_df, sps_res_desired_count
146146
data_type='desired_count_1')
147147

148148
save_raw_az_true_desired_count_loop_success = save_raw(sps_res_desired_count_loop_df, time_datetime, availability_zones,
149-
data_type='desired_count_loop')
149+
data_type='multi')
150150
save_raw_specific_az_true_success = save_raw(sps_res_specific_df, time_datetime, availability_zones, data_type='specific')
151151

152152

@@ -173,4 +173,5 @@ def handle_response(status_code, body, action, time_datetime, error_message=None
173173
if error_message:
174174
response["error_message"] = error_message
175175

176+
Logger.info(f"Response: {response}")
176177
return response

collector/spot-dataset/azure/lambda/current_collector/load_sps.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from datetime import datetime, timezone
1515
from utils.azure_auth import get_sps_token_and_subscriptions
1616
from utils.pub_service import S3, AZURE_CONST, Logger
17-
from concurrent.futures import ThreadPoolExecutor, as_completed
17+
from concurrent.futures import ThreadPoolExecutor
1818

1919
availability_zones = os.environ.get("availability_zones", "False").lower() == "true"
2020

@@ -196,7 +196,7 @@ def execute_spot_placement_score_task_by_parameter_pool_df(api_calls_df, desired
196196
future_to_desired_count[future] = desired_count
197197

198198
try:
199-
for future in as_completed(futures):
199+
for future in futures:
200200
try:
201201
result = future.result()
202202
desired_count = future_to_desired_count[future]
@@ -283,7 +283,6 @@ def execute_spot_placement_score_api(region_chunk, instance_type_chunk, desired_
283283
if res is None:
284284
return "NO_AVAILABLE_LOCATIONS"
285285
else:
286-
SS_Resources.succeed_to_get_next_available_location_count += 1
287286
subscription_id, location, history, over_limit_locations = res
288287
SL_Manager.update_call_history(subscription_id, location, history)
289288

collector/spot-dataset/azure/lambda/current_collector/sps_module/sps_location_manager.py

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def get_next_available_location():
114114
if validation_can_call(location, current_history, current_over_limit_locations):
115115
SS_Resources.last_subscription_id_and_location_tmp['last_subscription_id'] = subscription_id
116116
SS_Resources.last_subscription_id_and_location_tmp['last_location'] = location
117+
SS_Resources.succeed_to_get_next_available_location_count += 1
117118
return subscription_id, location, current_history, current_over_limit_locations
118119

119120
return None

collector/spot-dataset/azure/lambda/current_collector/utils/upload_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def save_raw(all_data_dataframe, time_utc, az, data_type=None):
236236
else:
237237
data_path = f"{base_path}/{data_type}/{az_str}/{s3_dir_name}/{s3_obj_name}.csv.gz"
238238

239-
elif data_type in {"desired_count_loop", "specific"}:
239+
elif data_type in {"multi", "specific"}:
240240
data_path = f"{base_path}/{data_type}/{az_str}/{s3_dir_name}/{s3_obj_name}.csv.gz"
241241

242242
else:

0 commit comments

Comments
 (0)