File tree Expand file tree Collapse file tree 3 files changed +32
-12
lines changed
Expand file tree Collapse file tree 3 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 11Changelog
22=========
33
4+ In Progress
5+ -----------
6+
7+ Fixed
8+ ~~~~~
9+
10+ * Warn users when there is a loop and no start task identified. (bug fix)
11+ * Lock global variables during initialization to make them thread safe. (bug fix)
12+
4131.1.1
514-----
615
Original file line number Diff line number Diff line change 1717import logging
1818import re
1919import six
20+ import threading
2021
2122from stevedore import extension
2223
2728LOG = logging .getLogger (__name__ )
2829
2930_EXP_EVALUATORS = None
31+ _EXP_EVALUATORS_LOCK = threading .Lock ()
3032_EXP_EVALUATOR_NAMESPACE = "orquesta.expressions.evaluators"
3133
3234
@@ -73,14 +75,18 @@ def get_evaluator(language):
7375
7476def get_evaluators ():
7577 global _EXP_EVALUATORS
78+ global _EXP_EVALUATORS_LOCK
7679
77- if _EXP_EVALUATORS is None :
78- _EXP_EVALUATORS = {}
80+ with _EXP_EVALUATORS_LOCK :
81+ if _EXP_EVALUATORS is None :
82+ _EXP_EVALUATORS = {}
7983
80- mgr = extension .ExtensionManager (namespace = _EXP_EVALUATOR_NAMESPACE , invoke_on_load = False )
84+ mgr = extension .ExtensionManager (
85+ namespace = _EXP_EVALUATOR_NAMESPACE , invoke_on_load = False
86+ )
8187
82- for name in mgr .names ():
83- _EXP_EVALUATORS [name ] = get_evaluator (name )
88+ for name in mgr .names ():
89+ _EXP_EVALUATORS [name ] = get_evaluator (name )
8490
8591 return _EXP_EVALUATORS
8692
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import threading
16+
1517from stevedore import extension
1618
1719
1820_EXP_FUNC_CATALOG = None
21+ _EXP_FUNC_CATALOG_LOCK = threading .Lock ()
1922
2023
2124def load ():
2225 global _EXP_FUNC_CATALOG
26+ global _EXP_FUNC_CATALOG_LOCK
2327
24- if _EXP_FUNC_CATALOG is None :
25- _EXP_FUNC_CATALOG = {}
28+ with _EXP_FUNC_CATALOG_LOCK :
29+ if _EXP_FUNC_CATALOG is None :
30+ _EXP_FUNC_CATALOG = {}
2631
27- mgr = extension .ExtensionManager (
28- namespace = "orquesta.expressions.functions" , invoke_on_load = False
29- )
32+ mgr = extension .ExtensionManager (
33+ namespace = "orquesta.expressions.functions" , invoke_on_load = False
34+ )
3035
31- for name in mgr .names ():
32- _EXP_FUNC_CATALOG [name ] = mgr [name ].plugin
36+ for name in mgr .names ():
37+ _EXP_FUNC_CATALOG [name ] = mgr [name ].plugin
3338
3439 return _EXP_FUNC_CATALOG
You can’t perform that action at this time.
0 commit comments