Skip to content
Merged
Changes from 1 commit
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
Next Next commit
chore: Fix error where all calls report is_test as true because typeg…
…uard pulls in unittest

Signed-off-by: Danny Chiao <danny@tecton.ai>
  • Loading branch information
adchia committed Aug 7, 2022
commit 06a4bfd998fe4d141c060c0010101544055fd3a4
5 changes: 4 additions & 1 deletion sdk/python/feast/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import requests

from feast import flags_helper
from feast.constants import DEFAULT_FEAST_USAGE_VALUE, FEAST_USAGE
from feast.version import get_version

Expand Down Expand Up @@ -168,11 +169,13 @@ def _set_installation_id():


def _export(event: typing.Dict[str, typing.Any]):
print(f"DANNY_{event}")
_executor.submit(requests.post, USAGE_ENDPOINT, json=event, timeout=30)


def _produce_event(ctx: UsageContext):
is_test = bool({"pytest", "unittest"} & sys.modules.keys())
# Cannot check for unittest because typeguard pulls in unittest
is_test = flags_helper.is_test() or bool({"pytest"} & sys.modules.keys())
event = {
"timestamp": datetime.utcnow().isoformat(),
"is_test": is_test,
Expand Down