xBis7 commented on code in PR #43941: URL: https://github.com/apache/airflow/pull/43941#discussion_r2008781816
########## airflow/utils/thread_safe_dict.py: ########## @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import threading + + +class ThreadSafeDict: Review Comment: This is used for creating a common dictionary that will hold all active spans for both dag runs and task instances. The common dictionary is a class attribute on the `scheduler_job_runner.py` and references are passed to the `base_executor.py` and the `dagrun.py`. All the methods that use it are getting called by the scheduler and I know that each iteration of the scheduler loop is sequential. At the time that I added it, I wasn't sure where it was going to be used and whether it would be accessed async by a celery executor the same moment that an iteration of the scheduler's loop also accesses it. Once I'm done with the changes, I'll see if I can remove it. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
