mdx.mtmc.stream.state.mtmc_plus module

class StateManager

Bases: object

Module to manage MTMC state

mtmc_state = StateManager()
delete_older_state(keys_in_behavior_state: Set[str]) None

Deletes global IDs in state when none of the matched behaviors are present in the behavior state

Parameters:

keys_in_behavior_state (Set[str]) – keys (ID-timestamp pairs) present in the behavior state

Returns:

None

mtmc_state.delete_older_state(keys_in_behavior_state)
get_global_ids_in_state() Set[str]

Gets all the global IDs in state

Returns:

set of global IDs

Return type:

Set[str]

global_ids = mtmc_state.get_global_ids_in_state()
get_map_global_id_to_mtmc_object() Dict[str, MTMCObject]

Gets a map from all the global IDs to MTMC objects in state

Returns:

map from global IDs to MTMC objects

Return type:

Dict[str,MTMCObject]

map_global_id_to_mtmc_object = mtmc_state.get_map_global_id_to_mtmc_object()
get_mtmc_object(global_id: str) MTMCObject | None

Gets the MTMC object given a global ID

Parameters:

global_id (str) – global ID

Returns:

MTMC object

Return type:

Optional[MTMCObject]

mtmc_object = mtmc_state.get_mtmc_object(global_id)
get_mtmc_objects(global_ids: List[str]) List[MTMCObject | None]

Gets a list of MTMC objects given a list of global IDs

Parameters:

global_ids (List[str]) – global IDs

Returns:

list of MTMC objects

Return type:

List[Optional[MTMCObject]]

mtmc_objects = mtmc_state.get_mtmc_objects(global_ids)
get_mtmc_objects_in_state() List[MTMCObject]

Gets all the MTMC objects in state

Returns:

list of MTMC objects

Return type:

List[MTMCObject]

mtmc_objects = mtmc_state.get_mtmc_objects_in_state()
get_updated_mtmc_objects(mtmc_objects: List[MTMCObject], batch_id: int) List[MTMCObject]

Gets updated MTMC objects from state

Parameters:
  • mtmc_objects (List[MTMCObject]) – list of MTMC objects

  • batch_id (int) – batch ID

Returns:

updated MTMC objects

Return type:

List[MTMCObject]

updated_mtmc_objects = mtmc_state.get_updated_mtmc_objects(mtmc_objects, batch_id)