[
https://issues.apache.org/jira/browse/AIRFLOW-3069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16619625#comment-16619625
]
ASF GitHub Bot commented on AIRFLOW-3069:
-----------------------------------------
sbilinski opened a new pull request #3914: [AIRFLOW-3069] Log all output of the
S3 file transform script
URL: https://github.com/apache/incubator-airflow/pull/3914
### Jira
- [x] My PR addresses the following [Airflow
Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references
them in the PR title.
-
[https://jira.apache.org/jira/browse/AIRFLOW-3069](https://jira.apache.org/jira/browse/AIRFLOW-3069)
### Description
- [x] Here are some details about my PR, including screenshots of any UI
changes:
The output of the process spawned by `S3FileTransformOperator` is not
properly decoded, which makes reading logs rather difficult. Additionally, the
`stderr` stream is only shown when process exit code is not equal to `0`.
I would like to propose the following changes to `S3FileTransformOperator`:
- Send both output streams (stdout & stderr) to the logger, regardless of
the outcome (if any data is present)
- Decode the output, so that new lines can be displayed correctly.
- Include process exit code in the exception message, if the process fails.
### Tests
- [x] My PR adds the following unit tests __OR__ does not need testing for
this extremely good reason:
I've added a separate case for testing `transform_script` with output
present. Since logging is essential in this case, the test checks if a valid
message was passed to the logging module.
### Commits
- [x] My commits all reference Jira issues in their subject lines, and I
have squashed multiple commits if they address the same issue. In addition, my
commits follow the guidelines from "[How to write a good git commit
message](http://chris.beams.io/posts/git-commit/)":
1. Subject is separated from body by a blank line
1. Subject is limited to 50 characters (not including Jira issue reference)
1. Subject does not end with a period
1. Subject uses the imperative mood ("add", not "adding")
1. Body wraps at 72 characters
1. Body explains "what" and "why", not "how"
### Documentation
- [x] In case of new functionality, my PR adds documentation that describes
how to use it.
- When adding new operators/hooks/sensors, the autoclass documentation
generation needs to be added.
### Code Quality
- [x] Passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Decode output of S3 file transform operator
> -------------------------------------------
>
> Key: AIRFLOW-3069
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3069
> Project: Apache Airflow
> Issue Type: Improvement
> Components: aws
> Affects Versions: 1.10.0
> Reporter: Szymon Bilinski
> Assignee: Szymon Bilinski
> Priority: Trivial
>
> h3. Current behaviour
> {{S3FileTransformOperator}} logs {{stdout}} of the underlying process as such:
> {code}
> [2018-09-15 23:17:13,850] {{s3_file_transform_operator.py:122}} INFO -
> Transform script stdout b'Copying /tmp/tmpd5rjo8g0 to
> /tmp/tmpd3vkhzte\nDone\n'
> {code}
> While {{stderr}} is omitted entirely, unless exit code is not {{0}} (in this
> case it's included in the exception message only).
> h3. Proposed behaviour
> 1. Both streams are logged, regardless of the underlying process outcome
> (i.e. success or failure).
> 2. Stream output is decoded before logging (e.g. {{\n}} is replaced with an
> actual new line).
> 3. If {{transform_script}} fails, the exception message contains return code
> of the process.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)