This is an automated email from the ASF dual-hosted git repository.

shunping pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 185dee0c994 Add a pipeline option for setting prism log level. (#35778)
185dee0c994 is described below

commit 185dee0c994b7ea240df02e6ac96dfabb48f0380
Author: Shunping Huang <[email protected]>
AuthorDate: Tue Aug 5 09:32:06 2025 -0400

    Add a pipeline option for setting prism log level. (#35778)
    
    * Add a pipeline option for setting prism log level.
    
    * Add choices in argparse per review. Remove the unnecessary parsing 
function.
---
 sdks/python/apache_beam/options/pipeline_options.py         | 9 ++++++++-
 sdks/python/apache_beam/runners/portability/prism_runner.py | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sdks/python/apache_beam/options/pipeline_options.py 
b/sdks/python/apache_beam/options/pipeline_options.py
index a7db5bfb0e7..c3fbdf7c79c 100644
--- a/sdks/python/apache_beam/options/pipeline_options.py
+++ b/sdks/python/apache_beam/options/pipeline_options.py
@@ -226,7 +226,7 @@ class _CommaSeparatedListAction(argparse.Action):
   a list. This allows options like --experiments=abc,def to be treated
   as separate experiments 'abc' and 'def', similar to how Java SDK handles
   them.
-  
+
   If there are key=value experiments in a raw argument, the remaining part of
   the argument are treated as values and won't split further. For example:
   'abc,def,master_key=k1=v1,k2=v2' becomes
@@ -1942,6 +1942,13 @@ class PrismRunnerOptions(PipelineOptions):
         'downloading a zipped prism binary, for the current platform. If '
         'prism_location is set to a Github Release page URL, them it will use '
         'that release page as a base when constructing the download URL.')
+    parser.add_argument(
+        '--prism_log_level',
+        default="info",
+        choices=["debug", "info", "warn", "error"],
+        help=(
+            'Controls the log level in Prism. Values can be "debug", "info", '
+            '"warn", and "error". Default log level is "info".'))
 
 
 class TestOptions(PipelineOptions):
diff --git a/sdks/python/apache_beam/runners/portability/prism_runner.py 
b/sdks/python/apache_beam/runners/portability/prism_runner.py
index 6a6e7d6d9a4..4cda4f41625 100644
--- a/sdks/python/apache_beam/runners/portability/prism_runner.py
+++ b/sdks/python/apache_beam/runners/portability/prism_runner.py
@@ -130,6 +130,8 @@ class PrismJobServer(job_server.SubprocessJobServer):
     job_options = options.view_as(pipeline_options.JobServerOptions)
     self._job_port = job_options.job_port
 
+    self._log_level = prism_options.prism_log_level
+
   # the method is only kept for testing and backward compatibility
   @classmethod
   def local_bin(
@@ -425,6 +427,8 @@ class PrismJobServer(job_server.SubprocessJobServer):
     return [
         '--job_port',
         job_port,
+        '--log_level',
+        self._log_level,
         '--serve_http',
         False,
     ]

Reply via email to