Skip to content

Commit

Permalink
Improve speed of get_task_family() (#3129)
Browse files Browse the repository at this point in the history
* Use f-string instead of str.format()
* Save duplicate call to get_task_namespace()

Co-authored-by: Dillon Stadther <dlstadther+github@gmail.com>
  • Loading branch information
nehaljwani and dlstadther authored Mar 12, 2022
1 parent d9450d4 commit 07f4d7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions luigi/task_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ def task_family(cls):
"""
Internal note: This function will be deleted soon.
"""
if not cls.get_task_namespace():
task_namespace = cls.get_task_namespace()
if not task_namespace:
return cls.__name__
else:
return "{}.{}".format(cls.get_task_namespace(), cls.__name__)
return f"{task_namespace}.{cls.__name__}"

@classmethod
def _get_reg(cls):
Expand Down

0 comments on commit 07f4d7d

Please sign in to comment.