-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Support pay-per-event via Actor.charge
#393
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
Conversation
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.
Could you please explain it somewhere in the concepts docs?
Starting with: https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle
There are docs being written in apify/apify-sdk-js#356 - would you like to check it out so that I can mirror it here afterwards? Are you sure that the Actor lifecycle page is a good place for this? If monetization belongs there, why not dataset handling, for example? |
Cool, I'll check it out, thanks.
Sorry for the confusion. I just linked the first page from the concepts. Unfortunately, the https://docs.apify.com/sdk/python/docs/concepts/ leads to 404. Choose the right location by yourself. |
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.
a few comments... (more will come tomorrow)
PricingModel: TypeAlias = Literal[ | ||
'FREE', | ||
'FLAT_PRICE_PER_MONTH', | ||
'PRICE_PER_DATASET_ITEM', | ||
'PAY_PER_EVENT', | ||
] |
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 believe this should be rendered in the docs.
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.
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.
Ah, so probably we will have to reach out to @barjin to update the doc tooling 👀.
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.
Crossposting the convo we had with Honza for more reach (>two heads are better than two):
Do I understand correctly that this is some kind of a sum type of literals (something like an enum, just not an enum)? We render enums in JS like this – I think we can also attach documentation to each member.
I'm not sure how it would work in Python like you have it now, since it's all essentially a single expression… maybe with some of those Annotated
generic types? Is there a Pythonic way of documenting each single Literal
member?
In any case, as a user, I would appreciate documentation for each PricingModel
member, at least with a link to the Apify documentation.
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.
Yes, this is analogous to type Foo = "asdf" | "hjkl"
. An inline list of the possible string values would be the best IMO, we can add the link to the documentation to the pricing_model
field.
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 see, so you cannot use PricingModel.FREE
as a runtime value, I got confused by the assignment (sth = Literal[]
) syntax. I'll see what I can do regarding the expansion of the type alias to its "value" in the call site doc.
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 would really add a clarifying note to the new events docstring, such as: "Note: Do not confuse these events with system events used by event manager blah blah". Because I am sure someone will get confused in the future since 2 different things are named the same.
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.
LGTM
Do you think we can close it today? 🙏🏻 I'd like to have it ready for the Agents Hackathon. |
Actor.charge
#374Actor.charge
ChargingManager
is needed only for advanced use cases