apache / apache/beam

File based sink doesn't respect temp_location pipeline option

Open
#21,212 0 comments 0 reactions 0 assignees View on GitHub
bug documentation files io P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

[Unlike](https://github.com/apache/beam/blob/a92965969fda3d7be5b65996d1a9a5b7dd373119/sdks/python/apache_beam/io/fileio.py#L476-L483) [FileIO module](https://beam.apache.org/releases/pydoc/2.32.0/apache_beam.io.fileio.html), the [FileBasedSink](https://beam.apache.org/releases/pydoc/2.32.0/apache_beam.io.filebasedsink.html) module [doesn't respect](https://github.com/apache/beam/blob/2c619c81082839e054f16efee9311b9f74b6e436/sdks/python/apache_beam/io/filebasedsink.py#L164-L177) the _[temp_location](https://beam.apache.org/releases/pydoc/2.32.0/_modules/apache_beam/options/pipeline_options.html)_ pipeline option. This isn't expected and documented properly in the respective module's documentation.

I do understand that the _temp_location_ [is technically a pipeline option that's only required by the DataflowRunner](https://github.com/apache/beam/blob/cf8e08f51bc9b1b25f6ee8007dfcc0fa04322e15/sdks/python/apache_beam/options/pipeline_options.py#L626-L631) but I think it might be worth it to pluck it out of the DataflowRunner and make it be a global pipeline option.

In addition, I couldn't info on what is the difference between [WriteToFiles](https://beam.apache.org/releases/pydoc/2.32.0/apache_beam.io.fileio.html) and [WriteToText](https://beam.apache.org/releases/pydoc/2.32.0/apache_beam.io.textio.html) transforms. It seems that the former uses the FileBasedSink and thus correctly writes temporary files to the temp_location when specified but the latter doesn't do that.

Imported from Jira [BEAM-12932](https://issues.apache.org/jira/browse/BEAM-12932). Original Jira may contain additional context.
Reported by: mareksuscak.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.