Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/apify_client/clients/resource_clients/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def get_actor_representation(
default_run_timeout_secs: int | None = None,
example_run_input_body: Any = None,
example_run_input_content_type: str | None = None,
actor_standby_is_enabled: bool | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Get dictionary representation of the Actor."""
return {
Expand All @@ -65,6 +71,14 @@ def get_actor_representation(
'body': example_run_input_body,
'contentType': example_run_input_content_type,
},
'actorStandby': {
'isEnabled': actor_standby_is_enabled,
'desiredRequestsPerActorRun': actor_standby_desired_requests_per_actor_run,
'maxRequestsPerActorRun': actor_standby_max_requests_per_actor_run,
'idleTimeoutSecs': actor_standby_idle_timeout_secs,
'build': actor_standby_build,
'memoryMbytes': actor_standby_memory_mbytes,
},
}


Expand Down Expand Up @@ -107,6 +121,12 @@ def update(
default_run_timeout_secs: int | None = None,
example_run_input_body: Any = None,
example_run_input_content_type: str | None = None,
actor_standby_is_enabled: bool | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Update the actor with the specified fields.

Expand All @@ -131,6 +151,13 @@ def update(
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
example_run_input_content_type (str, optional): The content type of the example run input.
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The updated actor
Expand All @@ -153,6 +180,12 @@ def update(
default_run_timeout_secs=default_run_timeout_secs,
example_run_input_body=example_run_input_body,
example_run_input_content_type=example_run_input_content_type,
actor_standby_is_enabled=actor_standby_is_enabled,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return self._update(filter_out_none_values_recursively(actor_representation))
Expand Down Expand Up @@ -414,6 +447,12 @@ async def update(
default_run_timeout_secs: int | None = None,
example_run_input_body: Any = None,
example_run_input_content_type: str | None = None,
actor_standby_is_enabled: bool | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Update the actor with the specified fields.

Expand All @@ -438,6 +477,13 @@ async def update(
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
example_run_input_content_type (str, optional): The content type of the example run input.
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The updated actor
Expand All @@ -460,6 +506,12 @@ async def update(
default_run_timeout_secs=default_run_timeout_secs,
example_run_input_body=example_run_input_body,
example_run_input_content_type=example_run_input_content_type,
actor_standby_is_enabled=actor_standby_is_enabled,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return await self._update(filter_out_none_values_recursively(actor_representation))
Expand Down
38 changes: 38 additions & 0 deletions src/apify_client/clients/resource_clients/actor_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def create(
default_run_timeout_secs: int | None = None,
example_run_input_body: Any = None,
example_run_input_content_type: str | None = None,
actor_standby_is_enabled: bool | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Create a new actor.

Expand All @@ -87,6 +93,13 @@ def create(
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
example_run_input_content_type (str, optional): The content type of the example run input.
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The created actor.
Expand All @@ -109,6 +122,12 @@ def create(
default_run_timeout_secs=default_run_timeout_secs,
example_run_input_body=example_run_input_body,
example_run_input_content_type=example_run_input_content_type,
actor_standby_is_enabled=actor_standby_is_enabled,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return self._create(filter_out_none_values_recursively(actor_representation))
Expand Down Expand Up @@ -166,6 +185,12 @@ async def create(
default_run_timeout_secs: int | None = None,
example_run_input_body: Any = None,
example_run_input_content_type: str | None = None,
actor_standby_is_enabled: bool | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Create a new actor.

Expand All @@ -190,6 +215,13 @@ async def create(
default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
example_run_input_content_type (str, optional): The content type of the example run input.
actor_standby_is_enabled (bool, optional): Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The created actor.
Expand All @@ -212,6 +244,12 @@ async def create(
default_run_timeout_secs=default_run_timeout_secs,
example_run_input_body=example_run_input_body,
example_run_input_content_type=example_run_input_content_type,
actor_standby_is_enabled=actor_standby_is_enabled,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return await self._create(filter_out_none_values_recursively(actor_representation))
44 changes: 44 additions & 0 deletions src/apify_client/clients/resource_clients/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def get_task_representation(
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
title: str | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Get the dictionary representation of a task."""
return {
Expand All @@ -42,6 +47,13 @@ def get_task_representation(
},
'input': task_input,
'title': title,
'actorStandby': {
'desiredRequestsPerActorRun': actor_standby_desired_requests_per_actor_run,
'maxRequestsPerActorRun': actor_standby_max_requests_per_actor_run,
'idleTimeoutSecs': actor_standby_idle_timeout_secs,
'build': actor_standby_build,
'memoryMbytes': actor_standby_memory_mbytes,
},
}


Expand Down Expand Up @@ -74,6 +86,11 @@ def update(
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
title: str | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Update the task with specified fields.

Expand All @@ -90,6 +107,12 @@ def update(
timeout_secs (int, optional): Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
task_input (dict, optional): Task input dictionary
title (str, optional): A human-friendly equivalent of the name
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The updated task
Expand All @@ -102,6 +125,11 @@ def update(
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
title=title,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return self._update(filter_out_none_values_recursively(task_representation))
Expand Down Expand Up @@ -311,6 +339,11 @@ async def update(
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
title: str | None = None,
actor_standby_desired_requests_per_actor_run: int | None = None,
actor_standby_max_requests_per_actor_run: int | None = None,
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
) -> dict:
"""Update the task with specified fields.

Expand All @@ -327,6 +360,12 @@ async def update(
timeout_secs (int, optional): Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
task_input (dict, optional): Task input dictionary
title (str, optional): A human-friendly equivalent of the name
actor_standby_desired_requests_per_actor_run (int, optional): The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run (int, optional): The maximum number of concurrent HTTP requests for a single Actor Standby run.
actor_standby_idle_timeout_secs (int, optional): If the Actor run does not receive any requests for this time, it will be shut down.
actor_standby_build (str, optional): The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes (int, optional): The memory in megabytes to use when the Actor is in Standby mode.

Returns:
dict: The updated task
Expand All @@ -339,6 +378,11 @@ async def update(
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
title=title,
actor_standby_desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
actor_standby_max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
actor_standby_idle_timeout_secs=actor_standby_idle_timeout_secs,
actor_standby_build=actor_standby_build,
actor_standby_memory_mbytes=actor_standby_memory_mbytes,
)

return await self._update(filter_out_none_values_recursively(task_representation))
Expand Down
Loading