Skip to content

Commit

Permalink
update the function of getting logs
Browse files Browse the repository at this point in the history
Signed-off-by: helenxie-bit <[email protected]>
  • Loading branch information
helenxie-bit committed Sep 14, 2024
1 parent 8862d79 commit e4f614d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/e2e/v1beta1/scripts/gh-actions/run-e2e-tune-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ def get_experiment_pods_logs(katib_client: KatibClient, exp_name: str, exp_names
if exp_name in pod.metadata.name:
logging.info(f"Fetching logs for pod: {pod.metadata.name}")
try:
# Specify the container name when retrieving logs
pod_logs = v1.read_namespaced_pod_log(
name=pod.metadata.name, namespace=exp_namespace
name=pod.metadata.name,
namespace=exp_namespace,
container="metrics-logger-and-collector" # Specify the desired container
)
logging.info(f"Logs for pod {pod.metadata.name}:\n{pod_logs}")
logging.info(f"Logs for pod {pod.metadata.name} (container: metrics-logger-and-collector):\n{pod_logs}")
except Exception as e:
logging.error(f"Failed to get logs for pod {pod.metadata.name}: {str(e)}")

Expand Down

0 comments on commit e4f614d

Please sign in to comment.