Skip to content

Commit d69df4c

Browse files
committed
refactor!: Remove wait argument from Actor.start
Actor.start only starts the run without waiting for it to finish, so a wait argument contradicts its purpose, and the JS SDK does not expose it either. To wait for a run to finish, use Actor.call.
1 parent a1e295b commit d69df4c

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

docs/04_upgrading/upgrading_to_v4.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ The deprecated `latest_sdk_version`, `log_format`, and `standby_port` fields hav
6969
- In place of `standby_port`, use `web_server_port`.
7070
- `latest_sdk_version` and `log_format` don't have replacement. SDK version checking isn't supported for the Python SDK and the log format should be adjusted in code instead.
7171

72-
## `Actor.start``wait_for_finish` is now `wait`
72+
### `wait_for_finish` argument of `Actor.start`
7373

74-
The `wait_for_finish: int` argument of `Actor.start()` has been renamed to `wait: timedelta`, matching `Actor.call()` and `Actor.call_task()`. The behavior is unchanged: the server still waits at most the given time (capped at 300 seconds) before returning the run info.
74+
The `wait_for_finish` argument of `Actor.start()` has been removed. It contradicted the purpose of `Actor.start()`, which only starts the run without waiting for it to finish. The JS SDK does not expose it on `Actor.start()` either. To wait for a run to finish, use `Actor.call()`.
7575

7676
```python
7777
from datetime import timedelta
@@ -80,7 +80,7 @@ from datetime import timedelta
8080
run = await Actor.start('my-actor-id', wait_for_finish=60)
8181

8282
# After (v4)
83-
run = await Actor.start('my-actor-id', wait=timedelta(seconds=60))
83+
run = await Actor.call('my-actor-id', wait=timedelta(seconds=60))
8484
```
8585

8686
## Built on `apify-client` v3

src/apify/_actor.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,11 @@ async def start(
890890
timeout: timedelta | None | Literal['inherit'] = None,
891891
force_permission_level: ActorPermissionLevel | None = None,
892892
webhooks: list[Webhook] | None = None,
893-
wait: timedelta | None = None,
894893
) -> Run:
895894
"""Run an Actor on the Apify platform.
896895
897-
Unlike `Actor.call`, this method just starts the run without waiting for finish.
896+
Unlike `Actor.call`, this method just starts the run without waiting for finish. To wait for the run to
897+
finish, use `Actor.call` instead.
898898
899899
Args:
900900
actor_id: The ID of the Actor to be run.
@@ -916,8 +916,6 @@ async def start(
916916
webhooks: Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with
917917
the Actor run which can be used to receive a notification, e.g. when the Actor finished or failed.
918918
If you already have a webhook set up for the Actor or task, you do not have to add it again here.
919-
wait: The maximum time the server waits for the run to finish. By default, it does not wait at all.
920-
The maximum value is 300 seconds.
921919
922920
Returns:
923921
Info about the started Actor run
@@ -943,7 +941,6 @@ async def start(
943941
memory_mbytes=memory_mbytes,
944942
run_timeout=actor_start_timeout,
945943
force_permission_level=force_permission_level,
946-
wait_for_finish=int(wait.total_seconds()) if wait is not None else None,
947944
webhooks=to_client_representations(webhooks),
948945
)
949946

0 commit comments

Comments
 (0)