Perf improvement for Templar.is_template (#57489)

* Faster is_template
This commit is contained in:
Matt Martz 2019-06-06 14:49:27 -05:00 committed by Brian Coca
parent 95882faca6
commit 728fce0c44
8 changed files with 90 additions and 47 deletions

View file

@ -164,7 +164,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
else:
is_static = C.DEFAULT_TASK_INCLUDES_STATIC or \
(use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC) or \
(not templar._contains_vars(t.args['_raw_params']) and t.all_parents_static() and not t.loop)
(not templar.is_template(t.args['_raw_params']) and t.all_parents_static() and not t.loop)
if is_static:
if t.loop is not None:
@ -351,7 +351,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
# template the role name now, if needed
all_vars = variable_manager.get_vars(play=play, task=ir)
templar = Templar(loader=loader, variables=all_vars)
if templar._contains_vars(ir._role_name):
if templar.is_template(ir._role_name):
ir._role_name = templar.template(ir._role_name)
# uses compiled list from object