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

Move responsibility to run a command from WinRMOperator to WinRMHook #43646

Merged

Conversation

dabla
Copy link
Contributor

@dabla dabla commented Nov 4, 2024

This PR moved the responsibility to be able to run a command from the WinRMOperator to the WinRMHook, just like it's also the case with a lot of other operators like for example the SQL operators which delegate the responsibility to be able to run an SQL statement to the DbApiHook. The reason is simple, if you want to execute an SQL statement or in this case a command from within a PythonOperator, you cannot use the WinRMOperator, you have to use the WinRMHook, so it makes sense that the WinRMHook has the logic to execute the command, not the operator, as the operator is only a facilitator to allow you to run a command from within a DAG


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

…or to WinRMHook and also made WinRMHook closable
@dabla dabla changed the title Move responsibility to run a command from WinRMOpeator to WinRMHook and make it closable Move responsibility to run a command from WinRMOperator to WinRMHook and make it closable Nov 4, 2024
@dabla dabla changed the title Move responsibility to run a command from WinRMOperator to WinRMHook and make it closable Move responsibility to run a command from WinRMOperator to WinRMHook Nov 5, 2024
@dabla dabla marked this pull request as draft November 5, 2024 09:42
@dabla dabla marked this pull request as ready for review November 5, 2024 14:06
@eladkal eladkal merged commit 464f7c4 into apache:main Nov 6, 2024
56 checks passed
@dabla
Copy link
Contributor Author

dabla commented Nov 6, 2024

Thx @eladkal :)

ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
…pache#43646)

* refactor: Moved responsibility to run a command away from WinRmOperator to WinRMHook and also made WinRMHook closable

* refactor: Reformatted exception message in WinRMOperator

* refactor: command parameter of run method in WinRMHook must be specified

* refactor: Changed return type of run method in WinRMHook

* refactor: WinRMHook cannot be closable as it doesn't have the winrm_client instance

* refactor: Reorganized imports in WinRMHook

* refactor: Added unit tests for new run method in WinRMHook

* refactor: Reorganized imports in TestWinRMHook

---------

Co-authored-by: David Blain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants