code: def on_task_init(self, task_id, task):
          
          try:
              is_eager = task.request.is_eager
          except AttributeError:
              is_eager = False
          if not is_eager:
              self.close_database()
docs: Called before every task.