code: public int getAssignedNumWorkers(TopologyDetails topology) {
          SchedulerAssignment assignment = this.getAssignmentById(topology.getId());
          if (assignment == null) {
              return 0;
          }
  
          Set<WorkerSlot> slots = new HashSet<>();
          slots.addAll(assignment.getExecutorToSlot().values());
  
          return slots.size();
      }
docs: Gets the number of workers assigned to this topology.