You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/10/05 18:00:23 UTC
[GitHub] [airflow] fredthomsen opened a new pull request #18752: Open src and dst in binary for samba copy
fredthomsen opened a new pull request #18752:
URL: https://github.com/apache/airflow/pull/18752
Be consistent with how files are opened when using samba to push local
files to remote. Opening files in binay in this case is safer since we
don't care about their contents.
Without this fix the following traceback occurs:
```
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1165, in _run_raw_task
self._prepare_and_execute_task_with_callbacks(context, task)
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1283, in _prepare_and_execute_task_with_callbacks
result = self._execute_task(context, task_copy)
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1313, in _execute_task
result = task_copy.execute(context=context)
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/operators/python.py", line 150, in execute
return_value = self.execute_callable()
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/operators/python.py", line 161, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/opt/airflow/dags/vmware_license_billing.py", line 389, in reports_to_fs01
SambaHook().push_from_local(
File "/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/samba/hooks/samba.py", line 247, in push_from_local
copyfileobj(f, g)
File "/usr/local/lib/python3.8/shutil.py", line 208, in copyfileobj
fdst_write(buf)
```
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-936485659
> > Would it be possible to add a test for this?
>
> I struggled to think of a test that can add any value here while mocking all interactions with the underlying `smbprotocol` library. Mocking `open` and the `open_file` method to ensure they are both opened using binary and/or ensuring that `copyfileobj` only takes file-like objects whose read and write methods expect binary strings seems like the only options, but I didn't that having that as a test helped.
My thughts exactly. For me that's one of those fixes for which the unit tests bring no value, just add complexitty really.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr merged pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
uranusjr merged pull request #18752:
URL: https://github.com/apache/airflow/pull/18752
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-936586052
REopened to rebuild
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-934640337
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-935083037
Would it be possible to add a test for this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr merged pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
uranusjr merged pull request #18752:
URL: https://github.com/apache/airflow/pull/18752
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] fredthomsen commented on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
fredthomsen commented on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-936464880
>
>
> Would it be possible to add a test for this?
I struggled to think of a test that can add any value here while mocking all interactions with the underlying `smbprotocol` library. Mocking `open` and the `open_file` method to ensure they are both opened using binary and/or ensuring that `copyfileobj` only takes file-like objects whose read and write methods expect binary strings seems like the only options, but I didn't that having that as a test helped.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk edited a comment on pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #18752:
URL: https://github.com/apache/airflow/pull/18752#issuecomment-936485659
> > Would it be possible to add a test for this?
>
> I struggled to think of a test that can add any value here while mocking all interactions with the underlying `smbprotocol` library. Mocking `open` and the `open_file` method to ensure they are both opened using binary and/or ensuring that `copyfileobj` only takes file-like objects whose read and write methods expect binary strings seems like the only options, but I didn't that having that as a test helped.
My thoughts exactly. For me that's one of those fixes for which the unit tests bring no value, just add complexitty really.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk closed pull request #18752: Open src and dst in binary for samba copy
Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #18752:
URL: https://github.com/apache/airflow/pull/18752
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org