Skip to content

Commit

Permalink
Optimization log
Browse files Browse the repository at this point in the history
  • Loading branch information
Hhhilulu committed Dec 6, 2023
1 parent 664efc5 commit b2a09a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,16 @@ def get_available_max_worker_count():
# 2. When the degree of parallelism is 1, main process executes the task directly and not
# create the child process
bulk_logger.warning(
f"Available max worker count {estimated_available_worker_count} is less than 1, set it to 1.")
f"Current system's available memory is {available_memory}MB, less than the memory "
f"{process_memory}MB required by the process. The maximum available worker count is 1.")
estimated_available_worker_count = 1
bulk_logger.info(
f"Current system's available memory is {available_memory}MB, "
f"memory consumption of current process is {process_memory}MB, "
f"estimated available worker count is {available_memory}/{process_memory} "
f"= {estimated_available_worker_count}"
)
else:
bulk_logger.info(
f"Current system's available memory is {available_memory}MB, "
f"memory consumption of current process is {process_memory}MB, "
f"estimated available worker count is {available_memory}/{process_memory} "
f"= {estimated_available_worker_count}"
)
return estimated_available_worker_count


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class TestGetAvailableMaxWorkerCount:
"available_memory, process_memory, expected_max_worker_count, actual_calculate_worker_count",
[
(128.0, 64.0, 2, 2), # available_memory/process_memory > 1
(63.0, 64.0, 1, 1), # available_memory/process_memory < 1
(63.0, 64.0, 1, 0), # available_memory/process_memory < 1
],
)
def test_get_available_max_worker_count(
Expand All @@ -452,12 +452,13 @@ def test_get_available_max_worker_count(
assert estimated_available_worker_count == expected_max_worker_count
if actual_calculate_worker_count < 1:
mock_logger.warning.assert_called_with(
f"Available max worker count {actual_calculate_worker_count} is less than 1, "
"set it to 1."
f"Current system's available memory is {available_memory}MB, less than the memory "
f"{process_memory}MB required by the process. The maximum available worker count is 1."
)
else:
mock_logger.info.assert_called_with(
f"Current system's available memory is {available_memory}MB, "
f"memory consumption of current process is {process_memory}MB, "
f"estimated available worker count is {available_memory}/{process_memory} "
f"= {actual_calculate_worker_count}"
)
mock_logger.info.assert_called_with(
f"Current system's available memory is {available_memory}MB, "
f"memory consumption of current process is {process_memory}MB, "
f"estimated available worker count is {available_memory}/{process_memory} "
f"= {actual_calculate_worker_count}"
)

0 comments on commit b2a09a2

Please sign in to comment.