Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose the timeoutSeconds RUN API parameter to the WherobotsRunOperator #21

Merged
merged 3 commits into from
Dec 6, 2024
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ The arguments for the `WherobotsRunOperator` constructor:
If `False`, the operator will not poll the logs, just track the status of the run.
* `polling_interval`: The interval in seconds to poll the status of the run.
The default value is `30`.
* `timeout_seconds: int`: This parameter sets a maximum run time (in seconds) to prevent runaway processes.
If the specified value exceeds the Max Workload Alive Hours, the timeout will be capped at the maximum permissible limit.
Defaults to `3600` seconds (1 hour).
* `run_python: dict`: A dictionary with the following keys:
* `uri: str`: The URI of the Python file to run.
* `args: list[str]`: A list of arguments to pass to the Python file.
Expand Down
2 changes: 2 additions & 0 deletions airflow_providers_wherobots/operators/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(
polling_interval: int = 20,
wherobots_conn_id: str = DEFAULT_CONN_ID,
poll_logs: bool = False,
timeout_seconds: int = 3600,
xcom_push: bool = True,
**kwargs,
):
Expand All @@ -50,6 +51,7 @@ def __init__(
self.run_payload: dict[str, Any] = {
"runtime": runtime.value,
"name": name or self.default_run_name,
"timeoutSeconds": timeout_seconds,
}
if run_python:
self.run_payload["runPython"] = run_python
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/hooks/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_create_run(self, test_default_conn) -> None:
"args": ["arg1", "arg2"],
"entrypoint": "src.main",
},
"timeoutSeconds": 5000,
}
responses.add(
responses.POST,
Expand Down
Loading