Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: kirkrodrigues <[email protected]>
  • Loading branch information
haiqi96 and kirkrodrigues authored Jun 26, 2024
1 parent df88105 commit bebde54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def search(
clo_log_path = get_logger_file_path(clp_logs_dir, job_id, task_id)
clo_log_file = open(clo_log_path, "w")

logger.info(f"Started task for job {job_id}")
logger.info(f"Started search task for job {job_id}")

search_config = SearchJobConfig.parse_obj(job_config_obj)
sql_adapter = SQL_Adapter(Database.parse_obj(clp_metadata_db_conn_params))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,15 @@ def get_archive_and_update_config_for_extraction(
db_conn,
extract_ir_config: ExtractIrJobConfig,
) -> Optional[str]:

orig_file_id = extract_ir_config.orig_file_id
msg_ix = extract_ir_config.msg_ix

results = get_archive_and_file_split_for_extraction(db_conn, orig_file_id, msg_ix)
if len(results) == 0:
logger.error(f"No file split and archive match with config: {orig_file_id}:{msg_ix}")
logger.error(f"No matching file splits for orig_file_id={orig_file_id}, msg_ix={msg_ix}")
return None
elif len(results) > 1:
logger.error(f"Multiple splits match with config: {orig_file_id}:{msg_ix}")
logger.error(f"Multiple file splits found for orig_file_id={orig_file_id}, msg_ix={msg_ix}")
for result in results:
logger.error(f"{result['archive_id']}:{result['id']}")
return None
Expand Down Expand Up @@ -532,7 +531,7 @@ def handle_pending_query_jobs(
num_tasks=0,
duration=0,
):
logger.error(f"Failed to set job: {job_id} as failed")
logger.error(f"Failed to set job {job_id} as failed")
continue

new_extract_ir_job = ExtractIrJob(
Expand Down Expand Up @@ -712,7 +711,7 @@ async def handle_finished_search_job(


async def handle_finished_extract_ir_job(
db_conn, job: SearchJob, task_results: Optional[Any]
db_conn, job: ExtractIrJob, task_results: Optional[Any]
) -> None:
global active_jobs

Expand All @@ -721,8 +720,8 @@ async def handle_finished_extract_ir_job(
num_task = len(task_results)
if 1 != num_task:
logger.error(
f"Unexpected number of task under IR extraction job: {job_id}. "
f"expected 1, got {num_task}"
f"Unexpected number of tasks for IR extraction job {job_id}. "
f"Expected 1, got {num_tasks}."
)
new_job_status = QueryJobStatus.FAILED
else:
Expand Down Expand Up @@ -750,9 +749,9 @@ async def handle_finished_extract_ir_job(
duration=(datetime.datetime.now() - job.start_time).total_seconds(),
):
if new_job_status == QueryJobStatus.SUCCEEDED:
logger.info(f"Completed job {job_id}.")
logger.info(f"Completed IR extraction job {job_id}.")
else:
logger.info(f"Completed job {job_id} with failing tasks.")
logger.info(f"Completed IR extraction job {job_id} with failing tasks.")
del active_jobs[job_id]


Expand Down
5 changes: 2 additions & 3 deletions components/package-template/src/etc/clp-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@
# # How much data CLP should try to fit into each segment within an archive
# target_segment_size: 268435456 # 256 MB
#
## Where IR should be output to
## Where CLP IR files should be output
#ir_output:
# directory: "var/data/ir"
#
# # How large each IR chunk should be before being
# # split into a new IR chunk
# # How large each IR file should be before being split into a new IR file
# target_uncompressed_size: 134217728 # 128 MB
#
## Location where other data (besides archives) are stored. It will be created if
Expand Down

0 comments on commit bebde54

Please sign in to comment.