Skip to main content

ChargingManager

Provides fine-grained access to pay-per-event functionality.

The ChargingManager allows you to charge for specific events in your Actor when using the pay-per-event pricing model. This enables precise cost control and transparent billing for different operations within your Actor.

References

Hierarchy

Index

Methods

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.