Skip to content

Commit

Permalink
in my log statements, use logger formatting instead of f strings
Browse files Browse the repository at this point in the history
Signed-off-by: shalberd <21118431+shalberd@users.noreply.github.com>
  • Loading branch information
shalberd committed Aug 19, 2024
1 parent 038aa4e commit 6bcc7ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions elyra/airflow/bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def execute(self) -> None:
# Really hate to do this but have to invoke Papermill via library as workaround
import papermill

logger.info(f"Processing file: {notebook}")
logger.info("Processing file: %s", notebook)
papermill.execute_notebook(
notebook,
notebook_output,
Expand Down Expand Up @@ -346,7 +346,7 @@ def execute(self) -> None:

run_args = ["python3", python_script]

logger.info(f"Processing file: {python_script}")
logger.info("Processing file: %s", python_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
Expand Down Expand Up @@ -391,7 +391,7 @@ def execute(self) -> None:

run_args = ["Rscript", r_script]

logger.info(f"Processing file: {r_script}")
logger.info("Processing file: %s", r_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
Expand Down
14 changes: 7 additions & 7 deletions elyra/kfp/bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def execute(self) -> None:
self.set_parameters_in_env()

import papermill
logger.info(f"Processing file: {notebook}")
logger.info("Processing file: %s", notebook)
papermill.execute_notebook(
notebook,
notebook_output,
Expand Down Expand Up @@ -498,15 +498,15 @@ def execute(self) -> None:
if self.parameter_pass_method == "env":
self.set_parameters_in_env()

logger.info(f"Processing file: {python_script}")
logger.info("Processing file: %s", python_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
if enable_generic_node_script_output_to_s3:
with open(python_script_output, "w") as log_file:
log_file.write(output)
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
logger.info("Output: %s", output)
logger.info("Return code: %s", result.returncode)
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
Expand Down Expand Up @@ -545,15 +545,15 @@ def execute(self) -> None:
if self.parameter_pass_method == "env":
self.set_parameters_in_env()

logger.info(f"Processing file: {r_script}")
logger.info("Processing file: %s", r_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
if enable_generic_node_script_output_to_s3:
with open(r_script_output, "w") as log_file:
log_file.write(output)
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
logger.info("Output: %s", output)
logger.info("Return code: %s", result.returncode)
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
Expand Down

0 comments on commit 6bcc7ee

Please sign in to comment.