faust.assignor.partition_assignor

Partition assignor.

class faust.assignor.partition_assignor.PartitionAssignor(app: AppT, replicas: int = 0)[source]

PartitionAssignor handles internal topic creation.

Further, this assignor needs to be sticky and potentially redundant In addition, it tracks external topic assignments as well (to support topic routes)

Notes

Interface copied from kafka.coordinator.assignors.abstract.

group_for_topic(topic: str) int[source]
Return type:

int

property changelog_distribution: MutableMapping[str, MutableMapping[str, List[int]]]
Return type:

_GenericAlias[str, _GenericAlias[str, _GenericAlias[int]]]

property external_topic_distribution: MutableMapping[str, MutableMapping[str, List[int]]]
Return type:

_GenericAlias[str, _GenericAlias[str, _GenericAlias[int]]]

on_assignment(assignment: ConsumerProtocolMemberMetadata) None[source]

Callback that runs on each assignment.

This method can be used to update internal state, if any, of the partition assignor.

Parameters:

assignment (MemberAssignment) – the member’s assignment

Return type:

None

metadata(topics: Set[str]) ConsumerProtocolMemberMetadata[source]

Generate ProtocolMetadata to be submitted via JoinGroupRequest.

Parameters:

topics (set) – a member’s subscribed topics

Return type:

ConsumerProtocolMemberMetadata

Returns:

MemberMetadata struct

assign(cluster: ClusterMetadata, member_metadata: MutableMapping[str, ConsumerProtocolMemberMetadata]) MutableMapping[str, ConsumerProtocolMemberAssignment][source]

Perform group assignment given cluster metadata and member subscriptions

Parameters:
  • cluster (ClusterMetadata) – metadata for use in assignment

  • {member_id (members (dict of) – MemberMetadata}): decoded metadata for each member in the group.

Return type:

_GenericAlias[str, ConsumerProtocolMemberAssignment]

Returns:

{member_id: MemberAssignment}

Return type:

dict

property name: str

.name should be a string identifying the assignor :rtype: str

property version: int
Return type:

int

assigned_standbys() Set[TP][source]
Return type:

_GenericAlias[TP]

assigned_actives() Set[TP][source]
Return type:

_GenericAlias[TP]

table_metadata(topic: str) MutableMapping[str, MutableMapping[str, List[int]]][source]
Return type:

_GenericAlias[str, _GenericAlias[str, _GenericAlias[int]]]

tables_metadata() MutableMapping[str, MutableMapping[str, List[int]]][source]
Return type:

_GenericAlias[str, _GenericAlias[str, _GenericAlias[int]]]

external_topics_metadata() MutableMapping[str, MutableMapping[str, List[int]]][source]
Return type:

_GenericAlias[str, _GenericAlias[str, _GenericAlias[int]]]

key_store(topic: str, key: bytes) URL[source]
Return type:

URL

external_key_store(topic: str, key: bytes) URL[source]
Return type:

URL

is_active(tp: TP) bool[source]
Return type:

bool

is_standby(tp: TP) bool[source]
Return type:

bool