Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
Fix logging in the new worker images.
Browse files Browse the repository at this point in the history
* Attach extra metadata information in the log messages.

* Related to #70 - use ensemble models
  • Loading branch information
jlewi authored and Jeremy Lewi committed Jan 18, 2020
1 parent a7fe608 commit 2ccd3e7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Label_Microservice/deployment/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
images:
- digest: sha256:cb2b2e604d4056b78ecd51d7113de04ebfa60e542310265b3871e7873417e34a
name: gcr.io/issue-label-bot-dev/bot-worker
newName: gcr.io/issue-label-bot-dev/bot-worker:3a82547
commonLabels:
environment: dev
namespace: label-bot-dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ patchesStrategicMerge:
resources:
- ../../base
images:
- digest: sha256:cb2b2e604d4056b78ecd51d7113de04ebfa60e542310265b3871e7873417e34a
name: gcr.io/issue-label-bot-dev/bot-worker
newName: gcr.io/issue-label-bot-dev/bot-worker:3a82547
- name: gcr.io/issue-label-bot-dev/bot-worker
newName: gcr.io/issue-label-bot-dev/bot-worker
newTag: 57c6d26
21 changes: 20 additions & 1 deletion py/label_microservice/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

DEFAULT_APP_URL = "https://github.com/marketplace/issue-label-bot"

DEFAULT_APP_URL = "https://github.com/marketplace/issue-label-bot"

class Worker:
"""
The worker class aims to do label prediction for issues from github repos.
Expand Down Expand Up @@ -169,6 +171,23 @@ def callback(message):
}
logging.info("Add labels to issue.", extra=log_dict)

# TODO(jlewi): I observed cases where some of the initial inferences
# would succeed but on subsequent ones it started failing
# see: https://github.com/kubeflow/code-intelligence/issues/70#issuecomment-570491289
# Restarting is a bit of a hack. We should try to figure out
# why its happening and fix it.
except tf_errors.FailedPreconditionError as e:
logging.fatal(f"Exception occurred while handling issue "
f"{repo_owner}/{repo_name}#{issue_num}. \n"
f"Exception: {e}\n"
f"{traceback.format_exc()}\n."
f"This usually indicates an issue with "
f"trying to use the model in a thread different "
f"from the one it was created in. "
f"The program will restart to try to recover.",
extra=log_dict)
sys.exit(1)

# TODO(jlewi): I observed cases where some of the initial inferences
# would succeed but on subsequent ones it started failing
# see: https://github.com/kubeflow/code-intelligence/issues/70#issuecomment-570491289
Expand Down Expand Up @@ -196,7 +215,7 @@ def callback(message):
logging.error(f"Exception occurred while handling issue "
f"{repo_owner}/{repo_name}#{issue_num}. \n"
f"Exception: {e}\n"
f"{traceback.format_exc()}")
f"{traceback.format_exc()}", extra=log_dict)

# acknowledge the message, or pubsub will repeatedly attempt to deliver it
message.ack()
Expand Down

0 comments on commit 2ccd3e7

Please sign in to comment.