Skip to content

Commit a020807

Browse files
authored
feat: add maxItems and maxTotalChargeUsd to resurrect (#360)
Can be merged after apify/apify-core#19740 is released
1 parent 279238a commit a020807

File tree

1 file changed

+20
-1
lines changed
  • src/apify_client/clients/resource_clients

1 file changed

+20
-1
lines changed

src/apify_client/clients/resource_clients/run.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import random
55
import string
66
import time
7-
from typing import Any
7+
from typing import TYPE_CHECKING, Any
88

99
from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields
1010

@@ -15,6 +15,9 @@
1515
from apify_client.clients.resource_clients.log import LogClient, LogClientAsync
1616
from apify_client.clients.resource_clients.request_queue import RequestQueueClient, RequestQueueClientAsync
1717

18+
if TYPE_CHECKING:
19+
from decimal import Decimal
20+
1821

1922
class RunClient(ActorJobBaseClient):
2023
"""Sub-client for manipulating a single Actor run."""
@@ -132,6 +135,8 @@ def resurrect(
132135
build: str | None = None,
133136
memory_mbytes: int | None = None,
134137
timeout_secs: int | None = None,
138+
max_items: int | None = None,
139+
max_total_charge_usd: Decimal | None = None,
135140
) -> dict:
136141
"""Resurrect a finished Actor run.
137142
@@ -147,6 +152,10 @@ def resurrect(
147152
uses the same memory limit as before.
148153
timeout_secs: New timeout for the resurrected run, in seconds. By default, the resurrected run uses the
149154
same timeout as before.
155+
max_items: Maximum number of items that the resurrected pay-per-result run will return. By default, the
156+
resurrected run uses the same limit as before. Limit can be only increased.
157+
max_total_charge_usd: Maximum cost for the resurrected pay-per-event run in USD. By default, the
158+
resurrected run uses the same limit as before. Limit can be only increased.
150159
151160
Returns:
152161
The Actor run data.
@@ -155,6 +164,8 @@ def resurrect(
155164
build=build,
156165
memory=memory_mbytes,
157166
timeout=timeout_secs,
167+
maxItems=max_items,
168+
maxTotalChargeUsd=max_total_charge_usd,
158169
)
159170

160171
response = self.http_client.call(
@@ -385,6 +396,8 @@ async def resurrect(
385396
build: str | None = None,
386397
memory_mbytes: int | None = None,
387398
timeout_secs: int | None = None,
399+
max_items: int | None = None,
400+
max_total_charge_usd: Decimal | None = None,
388401
) -> dict:
389402
"""Resurrect a finished Actor run.
390403
@@ -400,6 +413,10 @@ async def resurrect(
400413
uses the same memory limit as before.
401414
timeout_secs: New timeout for the resurrected run, in seconds. By default, the resurrected run uses the
402415
same timeout as before.
416+
max_items: Maximum number of items that the resurrected pay-per-result run will return. By default, the
417+
resurrected run uses the same limit as before. Limit can be only increased.
418+
max_total_charge_usd: Maximum cost for the resurrected pay-per-event run in USD. By default, the
419+
resurrected run uses the same limit as before. Limit can be only increased.
403420
404421
Returns:
405422
The Actor run data.
@@ -408,6 +425,8 @@ async def resurrect(
408425
build=build,
409426
memory=memory_mbytes,
410427
timeout=timeout_secs,
428+
maxItems=max_items,
429+
maxTotalChargeUsd=max_total_charge_usd,
411430
)
412431

413432
response = await self.http_client.call(

0 commit comments

Comments
 (0)