Skip to content

Commit

Permalink
feat: expose the timeoutSeconds RUN API parameter to the WherobotsRun…
Browse files Browse the repository at this point in the history
…Operator (#21)

* feat: expose the timeoutSeconds RUN API parameter to the WherobotsRunOperator

* chore: update version to 1.1.1

* Revert "chore: update version to 1.1.1"

This reverts commit 006308e.
  • Loading branch information
furqaankhan authored Dec 6, 2024
1 parent 8742457 commit 11214a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
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

0 comments on commit 11214a4

Please sign in to comment.