potiuk commented on a change in pull request #7128: [AIRFLOW-6529] Pickle error
occurs when the scheduler tries to run on macOS.
URL: https://github.com/apache/airflow/pull/7128#discussion_r365559172
##########
File path: tests/test_utils/mock_executor.py
##########
@@ -36,10 +36,17 @@ def __init__(self, do_update=True, *args, **kwargs):
self.history = []
# All the tasks, in a stable sort order
self.sorted_tasks = []
- self.mock_task_results = defaultdict(lambda: State.SUCCESS)
+
+ # If multiprocessing runs in spawn mode,
+ # arguments are to be pickled but lambda is not picclable.
+ # So we should pass self.success instead of lambda.
Review comment:
I was wondering if we could add an automated test to make sure it all stays
picklable.
We could have a test that executes all the multiprocessing-relevant code
from those Airflow classes and runs them in "spawn" mode also on Linux.
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
I think the easiest way we could do is to simply add a dedicated environment
variable in the airflow startup code (and call `mp.set_start_method('spawn')`
if the variable is set) and process one of the example Dags with that
environment variable set.
That would be a nice protection for the future.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services