Skip to content

Commit

Permalink
Add current_start_method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hhhilulu committed Dec 8, 2023
1 parent b11be03 commit d13210c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ def __init__(
self._validate_inputs = validate_inputs
multiprocessing_start_method = os.environ.get("PF_BATCH_METHOD")
sys_start_methods = multiprocessing.get_all_start_methods()
current_start_method = multiprocessing_start_method or multiprocessing.get_start_method()

if multiprocessing_start_method and multiprocessing_start_method not in sys_start_methods:
bulk_logger.warning(
f"Failed to set start method to '{multiprocessing_start_method}', "
f"start method {multiprocessing_start_method} is not in: {sys_start_methods}."
)
bulk_logger.info(f"Set start method to default {multiprocessing.get_start_method()}.")
multiprocessing_start_method = None
elif ((multiprocessing_start_method == "fork" or
multiprocessing.get_start_method() == "fork") and
"forkserver" in sys_start_methods):
elif (current_start_method == "fork" and "forkserver" in sys_start_methods):
bulk_logger.info(
"Current method is 'fork' and 'forkserver' is available. Set start method to 'forkserver'.")
multiprocessing_start_method = "forkserver"
Expand Down

0 comments on commit d13210c

Please sign in to comment.