-
Notifications
You must be signed in to change notification settings - Fork 17
perf: Use Apify-provided environment variables to obtain PPE pricing information #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| charged_counts = json.loads(self._configuration.charged_event_counts) | ||
|
|
||
| # Validate pricing info with proper discriminator support | ||
| pricing_info_adapter: TypeAdapter[ | ||
| FreeActorPricingInfo | ||
| | FlatPricePerMonthActorPricingInfo | ||
| | PricePerDatasetItemActorPricingInfo | ||
| | PayPerEventActorPricingInfo | ||
| ] = TypeAdapter( | ||
| FreeActorPricingInfo | ||
| | FlatPricePerMonthActorPricingInfo | ||
| | PricePerDatasetItemActorPricingInfo | ||
| | PayPerEventActorPricingInfo | ||
| ) | ||
| pricing_info = pricing_info_adapter.validate_json(self._configuration.actor_pricing_info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this to the Configuration class itself so that self._configuration.actor_pricing_info is already parsed and validated
class Configuration
...
actor_pricing_info: Annotated[FreeActorPricingInfo | ..., Field(...), BeforeValidator(json.loads)]| def get_max_total_charge_usd(self) -> Decimal: | ||
| return self._max_total_charge_usd | ||
|
|
||
| async def _fetch_pricing_info(self) -> dict[str, Any]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please return a better type here
|
|
||
| # Set up charging log dataset for local development | ||
| if not self._is_at_home and self._pricing_model == 'PAY_PER_EVENT': | ||
| # We are not running on the Apify platform, but PPE is enabled for testing - open a dataset that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was wrong with that comment?
closes: #614