Skip to main content

ChargingManagerImplementation

Implementation of the ChargingManager Protocol - this is only meant to be instantiated internally.

Hierarchy

Index

Methods

__aenter__

  • async __aenter__(): None
  • Initialize the charging manager - this is called by the Actor class and shouldn't be invoked manually.


    Returns None

__aexit__

  • async __aexit__(exc_type, exc_value, exc_traceback): None
  • Parameters

    • exc_type: type[BaseException] | None
    • exc_value: BaseException | None
    • exc_traceback: TracebackType | None

    Returns None

__init__

  • __init__(configuration, client): None
  • Parameters

    Returns None

calculate_max_event_charge_count_within_limit

  • calculate_max_event_charge_count_within_limit(event_name): int | None

calculate_total_charged_amount

  • calculate_total_charged_amount(): Decimal

charge

  • Charge for a specified number of events - sub-operations of the Actor.

    This is relevant only for the pay-per-event pricing model.


    Parameters

    • event_name: str

      Name of the event to be charged for.

    • optionalcount: int = 1

      Number of events to charge for.

    Returns ChargeResult

compute_chargeable

  • compute_chargeable(): dict[str, int | None]

compute_push_data_limit

  • compute_push_data_limit(items_count, event_name, *, is_default_dataset): int
  • Compute how many items can be pushed and charged within the current budget.

    Accounts for both the explicit event and the synthetic DEFAULT_DATASET_ITEM_EVENT event, so that the combined cost per item does not exceed the remaining budget.


    Parameters

    • items_count: int

      The number of items to be pushed.

    • event_name: str

      The explicit event name to charge for each item.

    • keyword-onlyis_default_dataset: bool

      Whether the data is pushed to the default dataset. If True, the synthetic event cost is included in the combined price.

    Returns int

    Max number of items that can be pushed within the budget.

get_charged_event_count

  • get_charged_event_count(event_name): int

get_max_total_charge_usd

  • get_max_total_charge_usd(): Decimal

get_pricing_info

  • Retrieve detailed information about the effective pricing of the current Actor run.

    This can be used for instance when your code needs to support multiple pricing models in transition periods.


    Returns ActorPricingInfo

is_event_charge_limit_reached

  • is_event_charge_limit_reached(event_name): bool

Properties

charge_lock

charge_lock: ReentrantLock

Lock to synchronize charge operations. Prevents race conditions between charge and push_data calls.

LOCAL_CHARGING_LOG_DATASET_NAME

LOCAL_CHARGING_LOG_DATASET_NAME: Undefined