code: def attempt(self, context, goals):
      
      sorted_goal_infos = self.sort_goals(context, goals)
      self._propose_alternative_target_roots(context, sorted_goal_infos)
      goal_executors = list(self._prepare(context, sorted_goal_infos))
      execution_goals = ' -> '.join(e.goal.name for e in goal_executors)
      context.log.info('Executing tasks in goals: {goals}'.format(goals=execution_goals))
  
      explain = context.options.for_global_scope().explain
      if explain:
        print('Goal Execution Order:\n\n{}\n'.format(execution_goals))
        print('Goal [TaskRegistrar->Task] Order:\n')
  
      serialized_goals_executors = [ge for ge in goal_executors if ge.goal.serialize]
      outer_lock_holder = serialized_goals_executors[-1] if serialized_goals_executors else None
  
      if outer_lock_holder:
        context.acquire_lock()
      try:
        for goal_executor in goal_executors:
          goal_executor.attempt(explain)
          if goal_executor is outer_lock_holder:
            context.release_lock()
            outer_lock_holder = None
      finally:
        if outer_lock_holder:
          context.release_lock()
docs: :API: public