Returns a list of all partitions that are currently led by this broker.
963479
def led_partitions
      result, mutex = [], Mutex.new
      threads = cluster.partitions.map do |partition|
        Thread.new do
          Thread.abort_on_exception = true
          select = partition.leader == self
          mutex.synchronize { result << partition } if select
        end
      end
      threads.each(&:join)
      result
    end
880802
public List<ManagementGroupVertex> getSuccessors() {

		final List<ManagementGroupVertex> successors = new ArrayList<ManagementGroupVertex>();

		for (ManagementGroupEdge edge : this.forwardEdges) {
			successors.add(edge.getTarget());
		}

		return successors;
	}
240649
async def get_all_leases(self):
        
        lease_futures = []
        partition_ids = await self.host.partition_manager.get_partition_ids_async()
        for partition_id in partition_ids:
            lease_futures.append(self.get_lease_async(partition_id))
        return lease_futures
1265865
public List<List<RESOURCE>> partitionMediumResources(List<RESOURCE> resources, Map<Long, Integer> days) {

        if (resources.isEmpty()) {
            return Collections.<List<RESOURCE>> emptyList();
        }
        RESOURCE firstRes = resources.get(0);
        int lastDay = days.get(new Long(getDateLastModified(firstRes))).intValue();
        List<List<RESOURCE>> result = new ArrayList<List<RESOURCE>>();
        List<RESOURCE> currentGroup = new ArrayList<RESOURCE>();
        result.add(currentGroup);
        for (RESOURCE res : resources) {
            LOG.debug("Processing medium-aged resource " + getRootPath(res));
            int day = days.get(new Long(getDateLastModified(res))).intValue();
            if (day != lastDay) {
                LOG.debug("=== new group ===");
                currentGroup = new ArrayList<RESOURCE>();
                result.add(currentGroup);
            }
            lastDay = day;
            currentGroup.add(res);
        }
        return result;
    }
284149
public List<Partition> getPartitionsFromDataset() throws IOException{
    try (AutoReturnableObject<IMetaStoreClient> client = getClientPool().getClient()) {
      List<Partition> partitions =
          HiveUtils.getPartitions(client.get(), getTable(), Optional.<String>absent());
      return sortPartitions(partitions);
    }
  }
286103
private static List<Element> getLastPartition(List<List<Element>> partitions) {
		if (partitions.isEmpty()) {
			List<Element> newPartition = new LinkedList<Element>();
			partitions.add(newPartition);
			return newPartition;
		} else {
			return partitions.get(partitions.size() - 1);
		}
	}
451584
def get_partition_trees(self, p):
        
        trees = []
        for grp in p.get_membership():
            try:
                result = self.get_group_result(grp)
                trees.append(result['ml_tree'])
            except ValueError:
                trees.append(None)
                logger.error('No tree found for group {}'.format(grp))
        return trees
1310738
private List<SchemaColumn> findPartitioningColumns() {
        if (m_partitioningColumns != null) {
            return m_partitioningColumns;
        }

        m_partitioningColumns = new ArrayList<>();
        assert(getScanPartitioning() != null);

        if (getScanPartitioning().getCountOfPartitionedTables() > 0) {
            for (StmtTableScan tableScan : m_subqueryStmt.allScans()) {
                List<SchemaColumn> scols = tableScan.getPartitioningColumns();
                if (scols != null) {
                    addPartitioningColumns(scols);
                }
            }
        }
        return m_partitioningColumns;
    }
526599
def partitions(self):
        
        if not self._partitions:
            self._partitions = [Partition(d, self)
                                for d in self.device.children]
        return self._partitions
32835
def list(self):
        
        backups = []
        for d in glob(join(self.backup_directory, '*')):
            backups.append(WorkspaceBackup.from_path(d))
        backups.sort(key=lambda b: b.lastmod, reverse=True)
        return backups
461194
public java.util.List<ImageDiskContainer> getDiskContainers() {
        if (diskContainers == null) {
            diskContainers = new com.amazonaws.internal.SdkInternalList<ImageDiskContainer>();
        }
        return diskContainers;
    }
276016
private List<Short> selectInitializedPartitions(int clusterPartitions, List<Short> partitions) {
    List<Short> initializedPartitions = new ArrayList<>();
    SessionState state = sessionState();

    for (short partition : partitions) {
      PartitionState ps = state.get(partition);
      if (ps != null) {
        if (MathUtils.lessThanUnsigned(ps.getStartSeqno(), ps.getEndSeqno())) {
          initializedPartitions.add(partition);
        } else {
          LOGGER.debug("Skipping partition {}, because startSeqno({}) >= endSeqno({})",
              partition, ps.getStartSeqno(), ps.getEndSeqno());
        }
      } else {
        LOGGER.debug("Skipping partition {}, because its state is null", partition);
      }
    }

    if (initializedPartitions.size() > clusterPartitions) {
      throw new IllegalStateException("Session State has " + initializedPartitions
          + " partitions while the cluster has " + clusterPartitions + "!");
    }
    return initializedPartitions;
  }
809305
public List<KafkaTopicPartition> discoverPartitions() throws WakeupException, ClosedException {
		if (!closed && !wakeup) {
			try {
				List<KafkaTopicPartition> newDiscoveredPartitions;

				// (1) get all possible partitions, based on whether we are subscribed to fixed topics or a topic pattern
				if (topicsDescriptor.isFixedTopics()) {
					newDiscoveredPartitions = getAllPartitionsForTopics(topicsDescriptor.getFixedTopics());
				} else {
					List<String> matchedTopics = getAllTopics();

					// retain topics that match the pattern
					Iterator<String> iter = matchedTopics.iterator();
					while (iter.hasNext()) {
						if (!topicsDescriptor.isMatchingTopic(iter.next())) {
							iter.remove();
						}
					}

					if (matchedTopics.size() != 0) {
						// get partitions only for matched topics
						newDiscoveredPartitions = getAllPartitionsForTopics(matchedTopics);
					} else {
						newDiscoveredPartitions = null;
					}
				}

				// (2) eliminate partition that are old partitions or should not be subscribed by this subtask
				if (newDiscoveredPartitions == null || newDiscoveredPartitions.isEmpty()) {
					throw new RuntimeException("Unable to retrieve any partitions with KafkaTopicsDescriptor: " + topicsDescriptor);
				} else {
					Iterator<KafkaTopicPartition> iter = newDiscoveredPartitions.iterator();
					KafkaTopicPartition nextPartition;
					while (iter.hasNext()) {
						nextPartition = iter.next();
						if (!setAndCheckDiscoveredPartition(nextPartition)) {
							iter.remove();
						}
					}
				}

				return newDiscoveredPartitions;
			} catch (WakeupException e) {
				// the actual topic / partition metadata fetching methods
				// may be woken up midway; reset the wakeup flag and rethrow
				wakeup = false;
				throw e;
			}
		} else if (!closed && wakeup) {
			// may have been woken up before the method call
			wakeup = false;
			throw new WakeupException();
		} else {
			throw new ClosedException();
		}
	}
683103
public List<ElementSubSet<E>> getPartitions() {
        final List<ElementSubSet<E>> partitions = new ArrayList<>();
        forEachPartition((idx, key, from, to) -> {
            partitions.add(new ElementSubSet<>(SplittableElementSet.this, key, from, to));
            return true;
        });
        return partitions;
    }
45087
public String[] getPartitionKeys(String location, Job job) throws IOException
    {
        if (!usePartitionFilter)
            return null;
        List<ColumnDef> indexes = getIndexes();
        String[] partitionKeys = new String[indexes.size()];
        for (int i = 0; i < indexes.size(); i++)
        {
            partitionKeys[i] = new String(indexes.get(i).getName());
        }
        return partitionKeys;
    }
1122382
def get_partitions_ps(self, db_name, tbl_name, part_vals, max_parts):
    
    self.send_get_partitions_ps(db_name, tbl_name, part_vals, max_parts)
    return self.recv_get_partitions_ps()
1220246
def all(self):
        
        partitions = []

        query = text("""
            SELECT dataset_vid, vid
            FROM partition_index;""")

        for result in self.execute(query):
            dataset_vid, vid = result
            partitions.append(PartitionSearchResult(dataset_vid=dataset_vid, vid=vid, score=1))
        return partitions