riteshghorse commented on code in PR #26220:
URL: https://github.com/apache/beam/pull/26220#discussion_r1175472539
##########
sdks/python/apache_beam/runners/worker/sdk_worker_main.py:
##########
@@ -173,32 +173,47 @@ def create_harness(environment, dry_run=False):
return fn_log_handler, sdk_harness, sdk_pipeline_options
+def _start_profiler(gcp_profiler_service_name, gcp_profiler_service_version):
+ try:
+ import googlecloudprofiler
+ if gcp_profiler_service_version:
+ googlecloudprofiler.start(
+ service=gcp_profiler_service_name,
+ service_version=gcp_profiler_service_version,
+ verbose=1)
+ _LOGGER.info('Turning on Google Cloud Profiler.')
+ else:
+ raise RuntimeError('Unable to find the job id from envvar.')
+ except Exception as e: # pylint: disable=broad-except
+ _LOGGER.warning(
+ 'Unable to start google cloud profiler due to error: %s. For how to '
+ 'enable Cloud Profiler with Dataflow see '
+ 'https://cloud.google.com/dataflow/docs/guides/profiling-a-pipeline.'
+ 'For troubleshooting tips with Cloud Profiler see '
+ 'https://cloud.google.com/profiler/docs/troubleshooting.' % e)
+
+
+def _get_gcp_profiler_name_if_enabled(sdk_pipeline_options):
Review Comment:
Done, added check back
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]