Skip to content

Commit

Permalink
Use logging.exception to log stacktrace (kubeflow#151)
Browse files Browse the repository at this point in the history
* Use logging.exception to log stacktrace

* update
  • Loading branch information
Ankush Agarwal authored and k8s-ci-robot committed Jun 6, 2018
1 parent f0aaa5e commit fe1c2d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions py/kubeflow/testing/run_e2e_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ def run(args, file_handler): # pylint: disable=too-many-statements,too-many-bran
logging.info("Workflow %s/%s finished phase: %s", get_namespace(args), name, phase)
except util.TimeoutError:
success = False
logging.error("Time out waiting for Workflows %s to finish", ",".join(workflow_names))
logging.exception("Time out waiting for Workflows %s to finish", ",".join(workflow_names))
except Exception as e:
# We explicitly log any exceptions so that they will be captured in the
# build-log.txt that is uploaded to Gubernator.
logging.error("Exception occurred: %s", e)
logging.exception("Exception occurred: %s", e)
raise
finally:
success = prow_artifacts.finalize_prow_job(args.bucket, success, workflow_phase, ui_urls)
Expand Down
4 changes: 2 additions & 2 deletions py/kubeflow/testing/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def wrap_test(test_case):
try:
test_case.test_func(test_case)
except subprocess.CalledProcessError as e:
logging.error("Subprocess failed;\n%s", e.output)
logging.exception("Subprocess failed;\n%s", e.output)
test_case.add_failure_info("Subprocess failed;\n{0}".format(e.output))
raise
except Exception as e:
logging.error("Test failed; %s", e.message)
logging.exception("Test failed; %s", e.message)
test_case.add_failure_info("Test failed; " + e.message)
raise
finally:
Expand Down
8 changes: 4 additions & 4 deletions py/kubeflow/testing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def create_cluster(gke, project, zone, cluster_request):
logging.info("Cluster creation done.\n %s", create_op)

except errors.HttpError as e:
logging.error("Exception occured creating cluster: %s, status: %s", e,
e.resp["status"])
logging.exception("Exception occured creating cluster: %s, status: %s", e,
e.resp["status"])
# Status appears to be a string.
if e.resp["status"] == '409':
pass
Expand Down Expand Up @@ -200,8 +200,8 @@ def delete_cluster(gke, name, project, zone):
logging.info("Cluster deletion done.\n %s", delete_op)

except errors.HttpError as e:
logging.error("Exception occured deleting cluster: %s, status: %s", e,
e.resp["status"])
logging.exception("Exception occured deleting cluster: %s, status: %s", e,
e.resp["status"])


def wait_for_operation(client,
Expand Down

0 comments on commit fe1c2d4

Please sign in to comment.