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
2 changes: 1 addition & 1 deletion docs/02_concepts/14_server_actors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A [Server Actor](https://docs.apify.com/platform/actors/running/standby) (former

:::note Formerly Actor Standby

Actor Standby is the former name of Server Actors, and it'll be deprecated. The platform documentation and the API still use it, for example in the Actor's `standby_url` and `actor_standby` fields, and in the `actor_standby_*` arguments of `ActorClient.update`. In the client, `ActorClient.standby` is a deprecated alias of `ActorClient.server` that will be removed in v4.
Actor Standby is the former name of Server Actors, and it'll be deprecated. The platform documentation and the API still use it, for example in the Actor's `standby_url` and `actor_standby` fields. In the client, `ActorClient.standby` is a deprecated alias of `ActorClient.server`, and the `actor_standby_*` arguments of the Actor and task `update` and `create` methods are deprecated aliases of their `server_*` counterparts, such as `server_build` for `actor_standby_build`. The aliases will be removed in v4.

:::

Expand Down
170 changes: 117 additions & 53 deletions src/apify_client/_resource_clients/actor.py

Large diffs are not rendered by default.

162 changes: 113 additions & 49 deletions src/apify_client/_resource_clients/actor_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from apify_client._models import (
ActorResource,
ActorResponse,
ActorStandby,
CreateActorRequest,
DefaultRunOptions,
ExampleRunInput,
Expand All @@ -15,6 +14,7 @@
)
from apify_client._pagination import get_items_iterator, get_items_iterator_async
from apify_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync
from apify_client._utils.server_args import build_actor_standby
from apify_client._utils.time import to_seconds

if TYPE_CHECKING:
Expand Down Expand Up @@ -129,6 +129,16 @@ def create(
default_run_force_permission_level: ActorPermissionLevel | None = None,
example_run_input_body: str | None = None,
example_run_input_content_type: str | None = None,
server_is_enabled: bool | None = None,
server_desired_requests_per_actor_run: int | None = None,
server_max_requests_per_actor_run: int | None = None,
server_idle_timeout: timedelta | None = None,
server_build: str | None = None,
server_memory_mbytes: int | None = None,
server_disable_fields_override: bool | None = None,
server_should_pass_actor_input: bool | None = None,
actor_permission_level: ActorPermissionLevel | None = None,
timeout: Timeout = 'medium',
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,
Expand All @@ -137,8 +147,6 @@ def create(
actor_standby_memory_mbytes: int | None = None,
actor_standby_disable_standby_fields_override: bool | None = None,
actor_standby_should_pass_actor_input: bool | None = None,
actor_permission_level: ActorPermissionLevel | None = None,
timeout: Timeout = 'medium',
) -> ActorResource:
"""Create a new Actor.

Expand Down Expand Up @@ -166,21 +174,33 @@ def create(
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
as a string (e.g. `json.dumps(input)` for a JSON input).
example_run_input_content_type: The content type of the example run input.
actor_standby_is_enabled: Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run: The maximum number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_idle_timeout: If the Actor run does not receive any requests for this time,
it will be shut down.
actor_standby_build: The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes: The memory in megabytes to use when the Actor is in Standby mode.
actor_standby_disable_standby_fields_override: If true, prevents the Standby configuration from being
overridden elsewhere.
actor_standby_should_pass_actor_input: Whether to pass the Actor input to the Standby runs. If false,
the Standby runs start with no input.
server_is_enabled: Whether the Actor is a Server Actor, which runs a web server called over HTTP.
server_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for a single run of
the Server Actor.
server_max_requests_per_actor_run: The maximum number of concurrent HTTP requests for a single run of the
Server Actor.
server_idle_timeout: If a run of the Server Actor does not receive any requests for this time, it is shut
down.
server_build: The build tag or number that the Server Actor runs.
server_memory_mbytes: The memory in megabytes for the runs of the Server Actor.
server_disable_fields_override: If true, prevents the Server Actor configuration from being overridden
elsewhere.
server_should_pass_actor_input: Whether to pass the Actor input to the runs of the Server Actor. If false,
they start with no input.
actor_permission_level: The permission level of the Actor on Apify platform.
timeout: Timeout for the API HTTP request.
actor_standby_is_enabled: Deprecated alias of `server_is_enabled`. Will be removed in v4.
actor_standby_desired_requests_per_actor_run: Deprecated alias of `server_desired_requests_per_actor_run`.
Will be removed in v4.
actor_standby_max_requests_per_actor_run: Deprecated alias of `server_max_requests_per_actor_run`. Will be
removed in v4.
actor_standby_idle_timeout: Deprecated alias of `server_idle_timeout`. Will be removed in v4.
actor_standby_build: Deprecated alias of `server_build`. Will be removed in v4.
actor_standby_memory_mbytes: Deprecated alias of `server_memory_mbytes`. Will be removed in v4.
actor_standby_disable_standby_fields_override: Deprecated alias of `server_disable_fields_override`. Will be
removed in v4.
actor_standby_should_pass_actor_input: Deprecated alias of `server_should_pass_actor_input`. Will be removed
in v4.

Returns:
The created Actor.
Expand All @@ -204,15 +224,27 @@ def create(
force_permission_level=default_run_force_permission_level,
restart_on_error=restart_on_error,
),
actor_standby=ActorStandby(
is_enabled=actor_standby_is_enabled,
desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
idle_timeout_secs=to_seconds(actor_standby_idle_timeout, as_int=True),
build=actor_standby_build,
memory_mbytes=actor_standby_memory_mbytes,
disable_standby_fields_override=actor_standby_disable_standby_fields_override,
should_pass_actor_input=actor_standby_should_pass_actor_input,
actor_standby=build_actor_standby(
{
'server_is_enabled': server_is_enabled,
'server_desired_requests_per_actor_run': server_desired_requests_per_actor_run,
'server_max_requests_per_actor_run': server_max_requests_per_actor_run,
'server_idle_timeout': server_idle_timeout,
'server_build': server_build,
'server_memory_mbytes': server_memory_mbytes,
'server_disable_fields_override': server_disable_fields_override,
'server_should_pass_actor_input': server_should_pass_actor_input,
},
{
'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': actor_standby_idle_timeout,
'actor_standby_build': actor_standby_build,
'actor_standby_memory_mbytes': actor_standby_memory_mbytes,
'actor_standby_disable_standby_fields_override': actor_standby_disable_standby_fields_override,
'actor_standby_should_pass_actor_input': actor_standby_should_pass_actor_input,
},
),
example_run_input=ExampleRunInput(
body=example_run_input_body,
Expand Down Expand Up @@ -326,6 +358,16 @@ async def create(
default_run_force_permission_level: ActorPermissionLevel | None = None,
example_run_input_body: str | None = None,
example_run_input_content_type: str | None = None,
server_is_enabled: bool | None = None,
server_desired_requests_per_actor_run: int | None = None,
server_max_requests_per_actor_run: int | None = None,
server_idle_timeout: timedelta | None = None,
server_build: str | None = None,
server_memory_mbytes: int | None = None,
server_disable_fields_override: bool | None = None,
server_should_pass_actor_input: bool | None = None,
actor_permission_level: ActorPermissionLevel | None = None,
timeout: Timeout = 'medium',
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,
Expand All @@ -334,8 +376,6 @@ async def create(
actor_standby_memory_mbytes: int | None = None,
actor_standby_disable_standby_fields_override: bool | None = None,
actor_standby_should_pass_actor_input: bool | None = None,
actor_permission_level: ActorPermissionLevel | None = None,
timeout: Timeout = 'medium',
) -> ActorResource:
"""Create a new Actor.

Expand Down Expand Up @@ -363,21 +403,33 @@ async def create(
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
as a string (e.g. `json.dumps(input)` for a JSON input).
example_run_input_content_type: The content type of the example run input.
actor_standby_is_enabled: Whether the Actor Standby is enabled.
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_max_requests_per_actor_run: The maximum number of concurrent HTTP requests for
a single Actor Standby run.
actor_standby_idle_timeout: If the Actor run does not receive any requests for this time,
it will be shut down.
actor_standby_build: The build tag or number to run when the Actor is in Standby mode.
actor_standby_memory_mbytes: The memory in megabytes to use when the Actor is in Standby mode.
actor_standby_disable_standby_fields_override: If true, prevents the Standby configuration from being
overridden elsewhere.
actor_standby_should_pass_actor_input: Whether to pass the Actor input to the Standby runs. If false,
the Standby runs start with no input.
server_is_enabled: Whether the Actor is a Server Actor, which runs a web server called over HTTP.
server_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for a single run of
the Server Actor.
server_max_requests_per_actor_run: The maximum number of concurrent HTTP requests for a single run of the
Server Actor.
server_idle_timeout: If a run of the Server Actor does not receive any requests for this time, it is shut
down.
server_build: The build tag or number that the Server Actor runs.
server_memory_mbytes: The memory in megabytes for the runs of the Server Actor.
server_disable_fields_override: If true, prevents the Server Actor configuration from being overridden
elsewhere.
server_should_pass_actor_input: Whether to pass the Actor input to the runs of the Server Actor. If false,
they start with no input.
actor_permission_level: The permission level of the Actor on Apify platform.
timeout: Timeout for the API HTTP request.
actor_standby_is_enabled: Deprecated alias of `server_is_enabled`. Will be removed in v4.
actor_standby_desired_requests_per_actor_run: Deprecated alias of `server_desired_requests_per_actor_run`.
Will be removed in v4.
actor_standby_max_requests_per_actor_run: Deprecated alias of `server_max_requests_per_actor_run`. Will be
removed in v4.
actor_standby_idle_timeout: Deprecated alias of `server_idle_timeout`. Will be removed in v4.
actor_standby_build: Deprecated alias of `server_build`. Will be removed in v4.
actor_standby_memory_mbytes: Deprecated alias of `server_memory_mbytes`. Will be removed in v4.
actor_standby_disable_standby_fields_override: Deprecated alias of `server_disable_fields_override`. Will be
removed in v4.
actor_standby_should_pass_actor_input: Deprecated alias of `server_should_pass_actor_input`. Will be removed
in v4.

Returns:
The created Actor.
Expand All @@ -401,15 +453,27 @@ async def create(
force_permission_level=default_run_force_permission_level,
restart_on_error=restart_on_error,
),
actor_standby=ActorStandby(
is_enabled=actor_standby_is_enabled,
desired_requests_per_actor_run=actor_standby_desired_requests_per_actor_run,
max_requests_per_actor_run=actor_standby_max_requests_per_actor_run,
idle_timeout_secs=to_seconds(actor_standby_idle_timeout, as_int=True),
build=actor_standby_build,
memory_mbytes=actor_standby_memory_mbytes,
disable_standby_fields_override=actor_standby_disable_standby_fields_override,
should_pass_actor_input=actor_standby_should_pass_actor_input,
actor_standby=build_actor_standby(
{
'server_is_enabled': server_is_enabled,
'server_desired_requests_per_actor_run': server_desired_requests_per_actor_run,
'server_max_requests_per_actor_run': server_max_requests_per_actor_run,
'server_idle_timeout': server_idle_timeout,
'server_build': server_build,
'server_memory_mbytes': server_memory_mbytes,
'server_disable_fields_override': server_disable_fields_override,
'server_should_pass_actor_input': server_should_pass_actor_input,
},
{
'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': actor_standby_idle_timeout,
'actor_standby_build': actor_standby_build,
'actor_standby_memory_mbytes': actor_standby_memory_mbytes,
'actor_standby_disable_standby_fields_override': actor_standby_disable_standby_fields_override,
'actor_standby_should_pass_actor_input': actor_standby_should_pass_actor_input,
},
),
example_run_input=ExampleRunInput(
body=example_run_input_body,
Expand Down
Loading
Loading