Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd4bf90

Browse filesBrowse files
authored
feat: add actor standby (#248)
This PR adds Actor Standby parameters to Actors and tasks.
1 parent 0d008aa commit dd4bf90
Copy full SHA for dd4bf90

4 files changed

+166Lines changed: 166 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/apify_client/clients/resource_clients/actor.py‎

Copy file name to clipboardExpand all lines: src/apify_client/clients/resource_clients/actor.py
+52Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def get_actor_representation(
4141
default_run_timeout_secs: int | None = None,
4242
example_run_input_body: Any = None,
4343
example_run_input_content_type: str | None = None,
44+
actor_standby_is_enabled: bool | None = None,
45+
actor_standby_desired_requests_per_actor_run: int | None = None,
46+
actor_standby_max_requests_per_actor_run: int | None = None,
47+
actor_standby_idle_timeout_secs: int | None = None,
48+
actor_standby_build: str | None = None,
49+
actor_standby_memory_mbytes: int | None = None,
4450
) -> dict:
4551
"""Get dictionary representation of the Actor."""
4652
return {
@@ -65,6 +71,14 @@ def get_actor_representation(
6571
'body': example_run_input_body,
6672
'contentType': example_run_input_content_type,
6773
},
74+
'actorStandby': {
75+
'isEnabled': actor_standby_is_enabled,
76+
'desiredRequestsPerActorRun': actor_standby_desired_requests_per_actor_run,
77+
'maxRequestsPerActorRun': actor_standby_max_requests_per_actor_run,
78+
'idleTimeoutSecs': actor_standby_idle_timeout_secs,
79+
'build': actor_standby_build,
80+
'memoryMbytes': actor_standby_memory_mbytes,
81+
},
6882
}
6983

7084

@@ -107,6 +121,12 @@ def update(
107121
default_run_timeout_secs: int | None = None,
108122
example_run_input_body: Any = None,
109123
example_run_input_content_type: str | None = None,
124+
actor_standby_is_enabled: bool | None = None,
125+
actor_standby_desired_requests_per_actor_run: int | None = None,
126+
actor_standby_max_requests_per_actor_run: int | None = None,
127+
actor_standby_idle_timeout_secs: int | None = None,
128+
actor_standby_build: str | None = None,
129+
actor_standby_memory_mbytes: int | None = None,
110130
) -> dict:
111131
"""Update the actor with the specified fields.
112132
@@ -131,6 +151,13 @@ def update(
131151
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
132152
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
133153
example_run_input_content_type (str, optional): The content type of the example run input.
154+
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
155+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
156+
a single Actor Standby run.
157+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
158+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
159+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
160+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
134161
135162
Returns:
136163
dict: The updated actor
@@ -153,6 +180,12 @@ def update(
153180
default_run_timeout_secs=default_run_timeout_secs,
154181
example_run_input_body=example_run_input_body,
155182
example_run_input_content_type=example_run_input_content_type,
183+
actor_standby_is_enabled=actor_standby_is_enabled,
184+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
185+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
186+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
187+
actor_standby_build=actor_standby_build,
188+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
156189
)
157190

158191
return self._update(filter_out_none_values_recursively(actor_representation))
@@ -414,6 +447,12 @@ async def update(
414447
default_run_timeout_secs: int | None = None,
415448
example_run_input_body: Any = None,
416449
example_run_input_content_type: str | None = None,
450+
actor_standby_is_enabled: bool | None = None,
451+
actor_standby_desired_requests_per_actor_run: int | None = None,
452+
actor_standby_max_requests_per_actor_run: int | None = None,
453+
actor_standby_idle_timeout_secs: int | None = None,
454+
actor_standby_build: str | None = None,
455+
actor_standby_memory_mbytes: int | None = None,
417456
) -> dict:
418457
"""Update the actor with the specified fields.
419458
@@ -438,6 +477,13 @@ async def update(
438477
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
439478
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
440479
example_run_input_content_type (str, optional): The content type of the example run input.
480+
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
481+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
482+
a single Actor Standby run.
483+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
484+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
485+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
486+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
441487
442488
Returns:
443489
dict: The updated actor
@@ -460,6 +506,12 @@ async def update(
460506
default_run_timeout_secs=default_run_timeout_secs,
461507
example_run_input_body=example_run_input_body,
462508
example_run_input_content_type=example_run_input_content_type,
509+
actor_standby_is_enabled=actor_standby_is_enabled,
510+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
511+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
512+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
513+
actor_standby_build=actor_standby_build,
514+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
463515
)
464516

465517
return await self._update(filter_out_none_values_recursively(actor_representation))
Collapse file

‎src/apify_client/clients/resource_clients/actor_collection.py‎

Copy file name to clipboardExpand all lines: src/apify_client/clients/resource_clients/actor_collection.py
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ def create(
6363
default_run_timeout_secs: int | None = None,
6464
example_run_input_body: Any = None,
6565
example_run_input_content_type: str | None = None,
66+
actor_standby_is_enabled: bool | None = None,
67+
actor_standby_desired_requests_per_actor_run: int | None = None,
68+
actor_standby_max_requests_per_actor_run: int | None = None,
69+
actor_standby_idle_timeout_secs: int | None = None,
70+
actor_standby_build: str | None = None,
71+
actor_standby_memory_mbytes: int | None = None,
6672
) -> dict:
6773
"""Create a new actor.
6874
@@ -87,6 +93,13 @@ def create(
8793
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
8894
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
8995
example_run_input_content_type (str, optional): The content type of the example run input.
96+
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
97+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
98+
a single Actor Standby run.
99+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
100+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
101+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
102+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
90103
91104
Returns:
92105
dict: The created actor.
@@ -109,6 +122,12 @@ def create(
109122
default_run_timeout_secs=default_run_timeout_secs,
110123
example_run_input_body=example_run_input_body,
111124
example_run_input_content_type=example_run_input_content_type,
125+
actor_standby_is_enabled=actor_standby_is_enabled,
126+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
127+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
128+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
129+
actor_standby_build=actor_standby_build,
130+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
112131
)
113132

114133
return self._create(filter_out_none_values_recursively(actor_representation))
@@ -166,6 +185,12 @@ async def create(
166185
default_run_timeout_secs: int | None = None,
167186
example_run_input_body: Any = None,
168187
example_run_input_content_type: str | None = None,
188+
actor_standby_is_enabled: bool | None = None,
189+
actor_standby_desired_requests_per_actor_run: int | None = None,
190+
actor_standby_max_requests_per_actor_run: int | None = None,
191+
actor_standby_idle_timeout_secs: int | None = None,
192+
actor_standby_build: str | None = None,
193+
actor_standby_memory_mbytes: int | None = None,
169194
) -> dict:
170195
"""Create a new actor.
171196
@@ -190,6 +215,13 @@ async def create(
190215
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
191216
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
192217
example_run_input_content_type (str, optional): The content type of the example run input.
218+
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
219+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
220+
a single Actor Standby run.
221+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
222+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
223+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
224+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
193225
194226
Returns:
195227
dict: The created actor.
@@ -212,6 +244,12 @@ async def create(
212244
default_run_timeout_secs=default_run_timeout_secs,
213245
example_run_input_body=example_run_input_body,
214246
example_run_input_content_type=example_run_input_content_type,
247+
actor_standby_is_enabled=actor_standby_is_enabled,
248+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
249+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
250+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
251+
actor_standby_build=actor_standby_build,
252+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
215253
)
216254

217255
return await self._create(filter_out_none_values_recursively(actor_representation))
Collapse file

‎src/apify_client/clients/resource_clients/task.py‎

Copy file name to clipboardExpand all lines: src/apify_client/clients/resource_clients/task.py
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def get_task_representation(
2929
memory_mbytes: int | None = None,
3030
timeout_secs: int | None = None,
3131
title: str | None = None,
32+
actor_standby_desired_requests_per_actor_run: int | None = None,
33+
actor_standby_max_requests_per_actor_run: int | None = None,
34+
actor_standby_idle_timeout_secs: int | None = None,
35+
actor_standby_build: str | None = None,
36+
actor_standby_memory_mbytes: int | None = None,
3237
) -> dict:
3338
"""Get the dictionary representation of a task."""
3439
return {
@@ -42,6 +47,13 @@ def get_task_representation(
4247
},
4348
'input': task_input,
4449
'title': title,
50+
'actorStandby': {
51+
'desiredRequestsPerActorRun': actor_standby_desired_requests_per_actor_run,
52+
'maxRequestsPerActorRun': actor_standby_max_requests_per_actor_run,
53+
'idleTimeoutSecs': actor_standby_idle_timeout_secs,
54+
'build': actor_standby_build,
55+
'memoryMbytes': actor_standby_memory_mbytes,
56+
},
4557
}
4658

4759

@@ -74,6 +86,11 @@ def update(
7486
memory_mbytes: int | None = None,
7587
timeout_secs: int | None = None,
7688
title: str | None = None,
89+
actor_standby_desired_requests_per_actor_run: int | None = None,
90+
actor_standby_max_requests_per_actor_run: int | None = None,
91+
actor_standby_idle_timeout_secs: int | None = None,
92+
actor_standby_build: str | None = None,
93+
actor_standby_memory_mbytes: int | None = None,
7794
) -> dict:
7895
"""Update the task with specified fields.
7996
@@ -90,6 +107,12 @@ def update(
90107
timeout_secs (int, optional): Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
91108
task_input (dict, optional): Task input dictionary
92109
title (str, optional): A human-friendly equivalent of the name
110+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
111+
a single Actor Standby run.
112+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
113+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
114+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
115+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
93116
94117
Returns:
95118
dict: The updated task
@@ -102,6 +125,11 @@ def update(
102125
memory_mbytes=memory_mbytes,
103126
timeout_secs=timeout_secs,
104127
title=title,
128+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
129+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
130+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
131+
actor_standby_build=actor_standby_build,
132+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
105133
)
106134

107135
return self._update(filter_out_none_values_recursively(task_representation))
@@ -311,6 +339,11 @@ async def update(
311339
memory_mbytes: int | None = None,
312340
timeout_secs: int | None = None,
313341
title: str | None = None,
342+
actor_standby_desired_requests_per_actor_run: int | None = None,
343+
actor_standby_max_requests_per_actor_run: int | None = None,
344+
actor_standby_idle_timeout_secs: int | None = None,
345+
actor_standby_build: str | None = None,
346+
actor_standby_memory_mbytes: int | None = None,
314347
) -> dict:
315348
"""Update the task with specified fields.
316349
@@ -327,6 +360,12 @@ async def update(
327360
timeout_secs (int, optional): Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
328361
task_input (dict, optional): Task input dictionary
329362
title (str, optional): A human-friendly equivalent of the name
363+
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
364+
a single Actor Standby run.
365+
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
366+
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
367+
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
368+
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.
330369
331370
Returns:
332371
dict: The updated task
@@ -339,6 +378,11 @@ async def update(
339378
memory_mbytes=memory_mbytes,
340379
timeout_secs=timeout_secs,
341380
title=title,
381+
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
382+
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
383+
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
384+
actor_standby_build=actor_standby_build,
385+
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
342386
)
343387

344388
return await self._update(filter_out_none_values_recursively(task_representation))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.