Given a directed graph representing resource allocation dependencies between microservices, determine whether the graph contains a cycle. The input consists of an integer n for the number of nodes labeled 0 to n - 1, and a list of directed edges edges where each edge [u, v] means service u is waiting on service v. Return True if any cycle exists, otherwise return False.
def has_cycle(n, edges):