Skip to content
Open
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
13 changes: 9 additions & 4 deletions sdks/python/apache_beam/runners/worker/sdk_worker_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,22 @@ def _import_beam_plugins(plugins):
try:
importlib.import_module(plugin)
_LOGGER.debug('Imported beam-plugin %s', plugin)
except ImportError:
except ImportError as exc:
if '.' not in plugin:
_LOGGER.warning('Failed to import beam-plugin %s', plugin, exc_info=exc)
continue

try:
_LOGGER.debug((
"Looks like %s is not a module. "
"Trying to import it assuming it's a class"),
"Trying to import it assuming it's a class."),
plugin)
module, _ = plugin.rsplit('.', 1)
importlib.import_module(module)
_LOGGER.debug('Imported %s for beam-plugin %s', module, plugin)
except ImportError as exc:
_LOGGER.warning('Failed to import beam-plugin %s', plugin, exc_info=exc)
except ImportError as fallback_exc:
_LOGGER.warning(
'Failed to import beam-plugin %s', plugin, exc_info=fallback_exc)


def create_harness(environment, dry_run=False):
Expand Down
Loading