Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/options/pipeline_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1994,8 +1994,8 @@ def _add_argparse_args(cls, parser):
help=(
'Local path to a file. During job submission, the files will be '
'staged in the staging area (--staging_location option) and then '
'workers will upload them to the worker specific staging location '
'(e.g. $SEMI_PERSISTENT_DIRECTORY/staged/ for portable runner.'))
'workers will download them to the worker-specific directory '
'$SEMI_PERSISTENT_DIRECTORY/staged/.'))
parser.add_argument(
'--prebuild_sdk_container_engine',
help=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ Staged files are downloaded onto the worker:

import my_module

* **Data or configuration files**: If you staged non-Python files (such as a JSON config), they are downloaded to the staged files directory. You can locate this directory on the worker by reading the `SEMI_PERSISTENT_DIRECTORY` environment variable, or look for `/tmp/staged` which is the default location for staged files on containerized runners:
* **Data or configuration files**: If you staged non-Python files (such as a JSON config), they are downloaded to the `$SEMI_PERSISTENT_DIRECTORY/staged` directory. The full path depends on the runner, so build it from the environment variable instead of hardcoding it.

import os
staged_dir = os.environ.get('SEMI_PERSISTENT_DIRECTORY', '/tmp/staged')
staged_dir = os.path.join(
os.environ.get('SEMI_PERSISTENT_DIRECTORY', '/tmp'), 'staged')
config_path = os.path.join(staged_dir, 'data_config.json')

### Importing Plugins on Worker Startup
Expand Down
Loading