faust.assignor.client_assignment

Client Assignment.

class faust.assignor.client_assignment.CopartitionedAssignment(actives: Set[int] = None, standbys: Set[int] = None, topics: Set[str] = None) → None[source]

Copartitioned Assignment.

validate() → None[source]
Return type:None
num_assigned(active: bool) → int[source]
Return type:int
get_unassigned(num_partitions: int, active: bool) → Set[int][source]
Return type:Set[int]
pop_partition(active: bool) → int[source]
Return type:int
unassign_partition(partition: int, active: bool) → None[source]
Return type:None
assign_partition(partition: int, active: bool) → None[source]
Return type:None
unassign_extras(capacity: int, replicas: int) → None[source]
Return type:None
partition_assigned(partition: int, active: bool) → bool[source]
Return type:bool
promote_standby_to_active(standby_partition: int) → None[source]
Return type:None
get_assigned_partitions(active: bool) → Set[int][source]
Return type:Set[int]
can_assign(partition: int, active: bool) → bool[source]
Return type:bool
class faust.assignor.client_assignment.ClientAssignment(actives, standbys, *, __strict__=True, __faust=None, **kwargs) → NoneType[source]

Client Assignment data model.

actives

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.
  • type (Type) – Field value type.
  • model (Type) – Model class the field belongs to.
  • required (bool) – Set to false if field is optional.
  • default (Any) – Default value when required=False.
standbys

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.
  • type (Type) – Field value type.
  • model (Type) – Model class the field belongs to.
  • required (bool) – Set to false if field is optional.
  • default (Any) – Default value when required=False.
active_tps
standby_tps
kafka_protocol_assignment(table_manager: faust.types.tables.TableManagerT) → Sequence[Tuple[str, List[int]]][source]
Return type:Sequence[Tuple[str, List[int]]]
add_copartitioned_assignment(assignment: faust.assignor.client_assignment.CopartitionedAssignment) → None[source]
Return type:None
copartitioned_assignment(topics: Set[str]) → faust.assignor.client_assignment.CopartitionedAssignment[source]
Return type:CopartitionedAssignment
asdict()
class faust.assignor.client_assignment.ClientMetadata(assignment, url, changelog_distribution, *, __strict__=True, __faust=None, **kwargs) → NoneType[source]

Client Metadata data model.

asdict()
assignment

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.
  • type (Type) – Field value type.
  • model (Type) – Model class the field belongs to.
  • required (bool) – Set to false if field is optional.
  • default (Any) – Default value when required=False.
url

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.
  • type (Type) – Field value type.
  • model (Type) – Model class the field belongs to.
  • required (bool) – Set to false if field is optional.
  • default (Any) – Default value when required=False.
changelog_distribution

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.
  • type (Type) – Field value type.
  • model (Type) – Model class the field belongs to.
  • required (bool) – Set to false if field is optional.
  • default (Any) – Default value when required=False.