Skip to content

Commit ea39adc

Browse files
committed
[IMP] snippets: prepare for changed default in python 3.14
Cited from documentation: > Note The default multiprocessing start method (see Contexts and start > methods) will change away from fork in Python 3.14. Code that requires fork > be used for their ProcessPoolExecutor should explicitly specify that by > passing a `mp_context=multiprocessing.get_context("fork")` parameter.[^1] [^1]: https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor
1 parent 1f58187 commit ea39adc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/snippets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import inspect
33
import logging
4+
import multiprocessing
45
import re
56
import sys
67
import uuid
@@ -305,7 +306,7 @@ def convert_html_columns(cr, table, columns, converter_callback, where_column="I
305306
update_sql = ", ".join(f'"{column}" = %({column})s' for column in columns)
306307
update_query = f"UPDATE {table} SET {update_sql} WHERE id = %(id)s"
307308

308-
with ProcessPoolExecutor(max_workers=get_max_workers()) as executor:
309+
with ProcessPoolExecutor(max_workers=get_max_workers(), mp_context=multiprocessing.get_context("fork")) as executor:
309310
convert = Convertor(converters, converter_callback)
310311
for query in log_progress(split_queries, logger=_logger, qualifier=f"{table} updates"):
311312
cr.execute(query)

0 commit comments

Comments
 (0)