Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display kaniko log if failed #1247

Merged
merged 1 commit into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions sdk/python/kfp/compiler/_component_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,11 @@ def _configure_logger(logger):
""" _configure_logger configures the logger such that the info level logs
go to the stdout and the error(or above) level logs go to the stderr.
It is important for the Jupyter notebook log rendering """
if logger.hasHandlers():
# If the logger has handlers, it has been configured, thus return immediately.
if hasattr(_configure_logger, 'configured'):
# Skip the logger configuration the second time this function
# is called to avoid multiple streamhandlers bound to the logger.
return
setattr(_configure_logger, 'configured', 'true')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably just write.

Suggested change
setattr(_configure_logger, 'configured', 'true')
_configure_logger.configured = 'true'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to keep the code consistent using hasattr and setattr.

logger.setLevel(logging.INFO)
info_handler = logging.StreamHandler(stream=sys.stdout)
info_handler.addFilter(lambda record: record.levelno <= logging.INFO)
Expand Down
3 changes: 1 addition & 2 deletions sdk/python/kfp/compiler/_k8s_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ def run_job(self, yaml_spec, timeout=600):
succ = self._wait_for_k8s_job(pod_name, yaml_spec, timeout)
if not succ:
logging.info('Kubernetes job failed.')
print(self._read_pod_log(pod_name, yaml_spec))
return False
#TODO: investigate the read log error
# print(self._read_pod_log(pod_name, yaml_spec))
self._delete_k8s_job(pod_name, yaml_spec)
return succ

Expand Down