Skip to content

Commit 525780e

Browse files
authored
Provide a better error when beam plugin was supplied but wasn't staged. (#39440)
* Provide better error when beam plugin was supplied but wasn't staged. * formatting
1 parent 61fad4f commit 525780e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

sdks/python/apache_beam/runners/worker/sdk_worker_main.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,22 @@ def _import_beam_plugins(plugins):
5858
try:
5959
importlib.import_module(plugin)
6060
_LOGGER.debug('Imported beam-plugin %s', plugin)
61-
except ImportError:
61+
except ImportError as exc:
62+
if '.' not in plugin:
63+
_LOGGER.warning('Failed to import beam-plugin %s', plugin, exc_info=exc)
64+
continue
65+
6266
try:
6367
_LOGGER.debug((
6468
"Looks like %s is not a module. "
65-
"Trying to import it assuming it's a class"),
69+
"Trying to import it assuming it's a class."),
6670
plugin)
6771
module, _ = plugin.rsplit('.', 1)
6872
importlib.import_module(module)
6973
_LOGGER.debug('Imported %s for beam-plugin %s', module, plugin)
70-
except ImportError as exc:
71-
_LOGGER.warning('Failed to import beam-plugin %s', plugin, exc_info=exc)
74+
except ImportError as fallback_exc:
75+
_LOGGER.warning(
76+
'Failed to import beam-plugin %s', plugin, exc_info=fallback_exc)
7277

7378

7479
def create_harness(environment, dry_run=False):

0 commit comments

Comments
 (0)