Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 4ffb9f5

Browse files
robertwbgildea
authored andcommitted
Allow the sdk_location to point to a tarball as well as a directory
----Release Notes---- [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117060287
1 parent 9bea52e commit 4ffb9f5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

google/cloud/dataflow/utils/dependency.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,13 @@ def stage_job_resources(options, file_copy=_dependency_file_copy,
322322
# used by tests running with the SDK built at head.
323323
if setup_options.sdk_location == 'default':
324324
module_path = os.path.abspath(__file__)
325-
sdk_dir = os.path.join(os.path.dirname(module_path), '..')
325+
sdk_path = os.path.join(
326+
os.path.dirname(module_path), '..', names.DATAFLOW_SDK_TARBALL_FILE)
327+
elif os.path.isdir(setup_options.sdk_location):
328+
sdk_path = os.path.join(
329+
setup_options.sdk_location, names.DATAFLOW_SDK_TARBALL_FILE)
326330
else:
327-
sdk_dir = setup_options.sdk_location
328-
sdk_path = os.path.join(sdk_dir, names.DATAFLOW_SDK_TARBALL_FILE)
331+
sdk_path = setup_options.sdk_location
329332
if os.path.isfile(sdk_path):
330333
logging.info('Copying dataflow SDK "%s" to staging location.', sdk_path)
331334
file_copy(sdk_path, staged_path)

google/cloud/dataflow/utils/dependency_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def test_sdk_location_local_not_present(self):
261261
self.assertEqual(
262262
'The file "%s" cannot be found. Its '
263263
'directory was specified by the --sdk_location command-line option.' %
264-
os.path.join(sdk_location, names.DATAFLOW_SDK_TARBALL_FILE),
264+
sdk_location,
265265
cm.exception.message)
266266

267267
def test_sdk_location_gcs(self):

0 commit comments

Comments
 (0)