Skip to content
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

actor charge support #745

Open
netmilk opened this issue Feb 11, 2025 · 2 comments
Open

actor charge support #745

netmilk opened this issue Feb 11, 2025 · 2 comments
Labels
t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@netmilk
Copy link
Contributor

netmilk commented Feb 11, 2025

As discussed with @mhamas, I'd like to introduce Actor.charge() equivalent to the Apify CLI actor namespace. It should work locally (without the run id an the run API key) as well as in the production deployment on Apify. Locally it should log to stderr every charge event on apify run and output the aggregated breakdown of event charges at the end of the run.

Syntax proposal:

$ apify actor charge <EVENT_NAME> \
[--eventCount <EVENT_COUNT>] \
[--idempotency-key <IDEMPOTENCY_KEY>]
...
Pay Per Event fired: <amount>, <count> times
...


Charges Breakdown:
-----------------------------------------------
|  <event name> | <count> |  <each> | <total>  |
...    
-----------------------------------------------
| Grand total: <sum>                                            |
-----------------------------------------------
...
$ echo $?
0
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Feb 11, 2025
@netmilk
Copy link
Contributor Author

netmilk commented Feb 14, 2025

@mhamas 's Draft PR here: #748

@B4nan
Copy link
Member

B4nan commented Feb 17, 2025

Locally it should log to stderr every charge event on apify run and output the aggregated breakdown of event charges at the end of the run.

We discussed this briefly on tooling sync and none of us really had an idea (at least one that wasn't frightening) on how to go about that. The CLI is stateless, and the charge command is not something long running, it literally represents the single console log. Also apify run just runs some script (nodejs/python or anything else really), we don't have control over what is that script doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

2 participants