fix: move restart on error Actor option to Run options#508
Conversation
fnesveda
left a comment
There was a problem hiding this comment.
Shouldn't someone from tooling team who handles Python development be assigned for review too, instead of 3 platform devs?
Yep, added @janbuchar. |
|
Shouldn't this be a |
| max_items: int | None = None, | ||
| memory_mbytes: int | None = None, | ||
| timeout_secs: int | None = None, | ||
| restart_on_error: bool | None = None, |
There was a problem hiding this comment.
Question: @janbuchar, is this a breaking change (changing the order of the parameters) ? I'm not sure about the exact intricacies of the Python argument ordering.
There was a problem hiding this comment.
Well, technically it is. But:
- Nobody in their right mind would call this with positional (non-keyword) arguments. In fact, the entire signature of the function should probably be keyword-only, but that's breaking
- While it is not de facto private, it probably should be
That considered, is it a problem to just move the parameter down?
There was a problem hiding this comment.
Sorry, I wasn't specific enough and didn't choose the best example. Similar changes are present throughout this and other files in public function. Please, see the last commit.
See for instance start. Same question there.
The positioning can be changed, but I would rather keep it near other similar options.
What do you think ? In other languages, it would definitely be a BC, but I'm not sure about the Python.
There was a problem hiding this comment.
Yeah, if there's no asterisk in the list of args, I'd just add a new argument at the end, just to be safe.
There was a problem hiding this comment.
Ok. Only such occurrence was in get_task_representation in the task.py.
Moved to the end of args list.
There was a problem hiding this comment.
Im getting FBT001 Boolean-typed positional argument in function definition linting error.
Would adding asterix in the list help?
def get_task_representation(
actor_id: str | None = None,
name: str | None = None,
task_input: dict | None = None,
build: str | None = None,
max_items: int | None = None,
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,
*,
restart_on_error: bool | None = None,
) -> dict:
There was a problem hiding this comment.
Yes, Asterix should be able to help. The lint rule exists because free-floating boolean arguments are confusing (foo(True, True, False, True)).

Changes related to move of
restartOnErrorfrom Actor's top level to its run options.Core: https://github.com/apify/apify-core/pull/23381
Worker: https://github.com/apify/apify-worker/pull/1515
Shared: apify/apify-shared-js#546
JS Client: apify/apify-client-js#760
Docs: apify/apify-docs#1965