Skip to content
Open
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
22 changes: 19 additions & 3 deletions src/apify_client/clients/resource_clients/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def get_actor_representation(
'seoTitle': seo_title,
'seoDescription': seo_description,
'versions': versions,
'restartOnError': restart_on_error,
'isPublic': is_public,
'isDeprecated': is_deprecated,
'isAnonymouslyRunnable': is_anonymously_runnable,
Expand All @@ -79,6 +78,7 @@ def get_actor_representation(
'maxItems': default_run_max_items,
'memoryMbytes': default_run_memory_mbytes,
'timeoutSecs': default_run_timeout_secs,
'restartOnError': restart_on_error,
'forcePermissionLevel': default_run_force_permission_level,
},
'exampleRunInput': {
Expand Down Expand Up @@ -153,7 +153,7 @@ def update(
seo_title: The title of the Actor optimized for search engines.
seo_description: The description of the Actor optimized for search engines.
versions: The list of Actor versions.
restart_on_error: If true, the main Actor run process will be restarted whenever it exits with
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
is_public: Whether the Actor is public.
is_deprecated: Whether the Actor is deprecated.
Expand Down Expand Up @@ -224,6 +224,7 @@ def start(
build: str | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
force_permission_level: ActorPermissionLevel | None = None,
Expand All @@ -242,6 +243,8 @@ def start(
max_items: Maximum number of results that will be returned by this run. If the Actor is charged
per result, you will not be charged for more results than the given limit.
max_total_charge_usd: A limit on the total charged amount for pay-per-event actors.
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit
specified in the default run configuration for the Actor.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
Expand All @@ -267,6 +270,7 @@ def start(
build=build,
maxItems=max_items,
maxTotalChargeUsd=max_total_charge_usd,
restartOnError=restart_on_error,
memory=memory_mbytes,
timeout=timeout_secs,
waitForFinish=wait_for_finish,
Expand All @@ -292,6 +296,7 @@ def call(
build: str | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
webhooks: list[dict] | None = None,
Expand All @@ -313,6 +318,8 @@ def call(
max_items: Maximum number of results that will be returned by this run. If the Actor is charged
per result, you will not be charged for more results than the given limit.
max_total_charge_usd: A limit on the total charged amount for pay-per-event actors.
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit
specified in the default run configuration for the Actor.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
Expand All @@ -338,6 +345,7 @@ def call(
build=build,
max_items=max_items,
max_total_charge_usd=max_total_charge_usd,
restart_on_error=restart_on_error,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
webhooks=webhooks,
Expand Down Expand Up @@ -565,7 +573,7 @@ async def update(
seo_title: The title of the Actor optimized for search engines.
seo_description: The description of the Actor optimized for search engines.
versions: The list of Actor versions.
restart_on_error: If true, the main Actor run process will be restarted whenever it exits with
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
is_public: Whether the Actor is public.
is_deprecated: Whether the Actor is deprecated.
Expand Down Expand Up @@ -636,6 +644,7 @@ async def start(
build: str | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
force_permission_level: ActorPermissionLevel | None = None,
Expand All @@ -654,6 +663,8 @@ async def start(
max_items: Maximum number of results that will be returned by this run. If the Actor is charged
per result, you will not be charged for more results than the given limit.
max_total_charge_usd: A limit on the total charged amount for pay-per-event actors.
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit
specified in the default run configuration for the Actor.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
Expand All @@ -679,6 +690,7 @@ async def start(
build=build,
maxItems=max_items,
maxTotalChargeUsd=max_total_charge_usd,
restartOnError=restart_on_error,
memory=memory_mbytes,
timeout=timeout_secs,
waitForFinish=wait_for_finish,
Expand All @@ -704,6 +716,7 @@ async def call(
build: str | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
webhooks: list[dict] | None = None,
Expand All @@ -725,6 +738,8 @@ async def call(
max_items: Maximum number of results that will be returned by this run. If the Actor is charged
per result, you will not be charged for more results than the given limit.
max_total_charge_usd: A limit on the total charged amount for pay-per-event actors.
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit
specified in the default run configuration for the Actor.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
Expand All @@ -750,6 +765,7 @@ async def call(
build=build,
max_items=max_items,
max_total_charge_usd=max_total_charge_usd,
restart_on_error=restart_on_error,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
webhooks=webhooks,
Expand Down
4 changes: 2 additions & 2 deletions src/apify_client/clients/resource_clients/actor_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create(
seo_title: The title of the Actor optimized for search engines.
seo_description: The description of the Actor optimized for search engines.
versions: The list of Actor versions.
restart_on_error: If true, the main Actor run process will be restarted whenever it exits with
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
is_public: Whether the Actor is public.
is_deprecated: Whether the Actor is deprecated.
Expand Down Expand Up @@ -205,7 +205,7 @@ async def create(
seo_title: The title of the Actor optimized for search engines.
seo_description: The description of the Actor optimized for search engines.
versions: The list of Actor versions.
restart_on_error: If true, the main Actor run process will be restarted whenever it exits with
restart_on_error: If true, the Actor run process will be restarted whenever it exits with
a non-zero status code.
is_public: Whether the Actor is public.
is_deprecated: Whether the Actor is deprecated.
Expand Down
8 changes: 8 additions & 0 deletions src/apify_client/clients/resource_clients/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def resurrect(
timeout_secs: int | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
) -> dict:
"""Resurrect a finished Actor run.

Expand All @@ -181,6 +182,8 @@ def resurrect(
resurrected run uses the same limit as before. Limit can be only increased.
max_total_charge_usd: Maximum cost for the resurrected pay-per-event run in USD. By default, the
resurrected run uses the same limit as before. Limit can be only increased.
restart_on_error: Determines whether the resurrected run will be restarted if it fails.
By default, the resurrected run uses the same setting as before.

Returns:
The Actor run data.
Expand All @@ -191,6 +194,7 @@ def resurrect(
timeout=timeout_secs,
maxItems=max_items,
maxTotalChargeUsd=max_total_charge_usd,
restartOnError=restart_on_error,
)

response = self.http_client.call(
Expand Down Expand Up @@ -483,6 +487,7 @@ async def resurrect(
timeout_secs: int | None = None,
max_items: int | None = None,
max_total_charge_usd: Decimal | None = None,
restart_on_error: bool | None = None,
) -> dict:
"""Resurrect a finished Actor run.

Expand All @@ -502,6 +507,8 @@ async def resurrect(
resurrected run uses the same limit as before. Limit can be only increased.
max_total_charge_usd: Maximum cost for the resurrected pay-per-event run in USD. By default, the
resurrected run uses the same limit as before. Limit can be only increased.
restart_on_error: Determines whether the resurrected run will be restarted if it fails.
By default, the resurrected run uses the same setting as before.

Returns:
The Actor run data.
Expand All @@ -512,6 +519,7 @@ async def resurrect(
timeout=timeout_secs,
maxItems=max_items,
maxTotalChargeUsd=max_total_charge_usd,
restartOnError=restart_on_error,
)

response = await self.http_client.call(
Expand Down
27 changes: 27 additions & 0 deletions src/apify_client/clients/resource_clients/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def get_task_representation(
actor_standby_idle_timeout_secs: int | None = None,
actor_standby_build: str | None = None,
actor_standby_memory_mbytes: int | None = None,
*,
restart_on_error: bool | None = None,
) -> dict:
"""Get the dictionary representation of a task."""
return {
Expand All @@ -48,6 +50,7 @@ def get_task_representation(
'maxItems': max_items,
'memoryMbytes': memory_mbytes,
'timeoutSecs': timeout_secs,
'restartOnError': restart_on_error,
},
'input': task_input,
'title': title,
Expand Down Expand Up @@ -87,6 +90,7 @@ def update(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | 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,
Expand All @@ -108,6 +112,8 @@ def update(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
task_input: Task input dictionary.
title: A human-friendly equivalent of the name.
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
Expand All @@ -129,6 +135,7 @@ def update(
max_items=max_items,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
restart_on_error=restart_on_error,
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,
Expand All @@ -154,6 +161,7 @@ def start(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | None = None,
wait_for_finish: int | None = None,
webhooks: list[dict] | None = None,
) -> dict:
Expand All @@ -171,6 +179,8 @@ def start(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
wait_for_finish: The maximum number of seconds the server waits for the run to finish. By default,
it is 0, the maximum value is 60.
webhooks: Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with
Expand All @@ -189,6 +199,7 @@ def start(
maxItems=max_items,
memory=memory_mbytes,
timeout=timeout_secs,
restartOnError=restart_on_error,
waitForFinish=wait_for_finish,
webhooks=encode_webhook_list_to_base64(webhooks) if webhooks is not None else None,
)
Expand All @@ -211,6 +222,7 @@ def call(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | None = None,
webhooks: list[dict] | None = None,
wait_secs: int | None = None,
) -> dict | None:
Expand All @@ -230,6 +242,8 @@ def call(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
webhooks: Specifies optional webhooks associated with the Actor run, which can be used to receive
a notification e.g. when the Actor finished or failed. Note: if you already have a webhook set up for
the Actor or task, you do not have to add it again here.
Expand All @@ -245,6 +259,7 @@ def call(
max_items=max_items,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
restart_on_error=restart_on_error,
webhooks=webhooks,
)

Expand Down Expand Up @@ -343,6 +358,7 @@ async def update(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | 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,
Expand All @@ -364,6 +380,8 @@ async def update(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
task_input: Task input dictionary.
title: A human-friendly equivalent of the name.
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
Expand All @@ -385,6 +403,7 @@ async def update(
max_items=max_items,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
restart_on_error=restart_on_error,
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,
Expand All @@ -410,6 +429,7 @@ async def start(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | None = None,
wait_for_finish: int | None = None,
webhooks: list[dict] | None = None,
) -> dict:
Expand All @@ -427,6 +447,8 @@ async def start(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
wait_for_finish: The maximum number of seconds the server waits for the run to finish. By default,
it is 0, the maximum value is 60.
webhooks: Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with
Expand All @@ -445,6 +467,7 @@ async def start(
maxItems=max_items,
memory=memory_mbytes,
timeout=timeout_secs,
restartOnError=restart_on_error,
waitForFinish=wait_for_finish,
webhooks=encode_webhook_list_to_base64(webhooks) if webhooks is not None else None,
)
Expand All @@ -467,6 +490,7 @@ async def call(
max_items: int | None = None,
memory_mbytes: int | None = None,
timeout_secs: int | None = None,
restart_on_error: bool | None = None,
webhooks: list[dict] | None = None,
wait_secs: int | None = None,
) -> dict | None:
Expand All @@ -486,6 +510,8 @@ async def call(
in the task settings.
timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
in the task settings.
restart_on_error: If true, the Task run process will be restarted whenever it exits with
a non-zero status code.
webhooks: Specifies optional webhooks associated with the Actor run, which can be used to receive
a notification e.g. when the Actor finished or failed. Note: if you already have a webhook set up for
the Actor or task, you do not have to add it again here.
Expand All @@ -501,6 +527,7 @@ async def call(
max_items=max_items,
memory_mbytes=memory_mbytes,
timeout_secs=timeout_secs,
restart_on_error=restart_on_error,
webhooks=webhooks,
)

Expand Down
Loading