diff --git a/src/apify_client/clients/resource_clients/actor.py b/src/apify_client/clients/resource_clients/actor.py index b889e431..a55307b9 100644 --- a/src/apify_client/clients/resource_clients/actor.py +++ b/src/apify_client/clients/resource_clients/actor.py @@ -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, @@ -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': { @@ -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. @@ -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, @@ -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 @@ -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, @@ -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, @@ -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 @@ -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, @@ -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. @@ -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, @@ -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 @@ -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, @@ -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, @@ -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 @@ -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, diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index 3746dfbb..95c7b105 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -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. @@ -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. diff --git a/src/apify_client/clients/resource_clients/run.py b/src/apify_client/clients/resource_clients/run.py index 0392e815..22f4ac02 100644 --- a/src/apify_client/clients/resource_clients/run.py +++ b/src/apify_client/clients/resource_clients/run.py @@ -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. @@ -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. @@ -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( @@ -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. @@ -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. @@ -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( diff --git a/src/apify_client/clients/resource_clients/task.py b/src/apify_client/clients/resource_clients/task.py index 5db942b4..4f53fb6b 100644 --- a/src/apify_client/clients/resource_clients/task.py +++ b/src/apify_client/clients/resource_clients/task.py @@ -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 { @@ -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, @@ -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, @@ -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 @@ -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, @@ -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: @@ -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 @@ -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, ) @@ -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: @@ -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. @@ -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, ) @@ -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, @@ -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 @@ -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, @@ -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: @@ -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 @@ -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, ) @@ -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: @@ -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. @@ -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, ) diff --git a/src/apify_client/clients/resource_clients/task_collection.py b/src/apify_client/clients/resource_clients/task_collection.py index 7956eda1..0f8fe188 100644 --- a/src/apify_client/clients/resource_clients/task_collection.py +++ b/src/apify_client/clients/resource_clients/task_collection.py @@ -47,6 +47,7 @@ def create( timeout_secs: int | None = None, memory_mbytes: int | None = None, max_items: int | None = None, + restart_on_error: bool | None = None, task_input: dict | None = None, title: str | None = None, actor_standby_desired_requests_per_actor_run: int | None = None, @@ -70,6 +71,8 @@ def create( is charged per result, you will not be charged for more results than the given limit. 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 object. title: A human-friendly equivalent of the name. actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for @@ -92,6 +95,7 @@ def create( 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, @@ -140,6 +144,7 @@ async def create( timeout_secs: int | None = None, memory_mbytes: int | None = None, max_items: int | None = None, + restart_on_error: bool | None = None, task_input: dict | None = None, title: str | None = None, actor_standby_desired_requests_per_actor_run: int | None = None, @@ -163,6 +168,8 @@ async def create( is charged per result, you will not be charged for more results than the given limit. 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 object. title: A human-friendly equivalent of the name. actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for @@ -185,6 +192,7 @@ async def create( 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,