Skip to content

Commit

Permalink
Removed unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
TeachMeTW committed Oct 14, 2024
1 parent 2b5cefd commit 64cfc3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions emission/storage/timeseries/non_user_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ def update_data(user_id, key, obj_id, data):
versioned objects
"""
raise AttributeError("non_user_timeseries does not support updates")

14 changes: 6 additions & 8 deletions emission/tests/funcTests/TestFunctionTiming.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ def execute_and_time_function(func: t.Callable[[], bool]):
# Verification: Adjusted Query to Match Document Structure
timeseries_db = gdb.get_timeseries_db()

# Define a time window (e.g., +/- 5 seconds) to account for any timing discrepancies
time_window = 5 # seconds
current_time = time.time()

query = {
"metadata.key": "stats/dashboard_time",
"data.name": function_name,
"data.ts": {"$gte": timestamp - time_window, "$lte": timestamp + time_window},
"data.reading": {"$gte": elapsed_ms - 10, "$lte": elapsed_ms + 10} # 10 ms tolerance
"data.ts": {"$gte": timestamp, "$lte": timestamp},
"data.reading": {"$gte": elapsed_ms, "$lte": elapsed_ms}
}

# Retrieve the most recent document for the function
Expand Down Expand Up @@ -118,12 +116,12 @@ def execute_and_time_function(func: t.Callable[[], bool]):

# Verification: Adjusted Error Query to Match Document Structure
timeseries_db = gdb.get_timeseries_db()
current_time = time.time()

error_query = {
"metadata.key": "stats/dashboard_error",
"data.name": function_name,
"data.ts": {"$gte": timestamp - 5, "$lte": timestamp + 5}, # 5 second window
"data.reading": {"$gte": elapsed_ms - 10, "$lte": elapsed_ms + 10} # 10 ms tolerance
"data.ts": {"$gte": timestamp, "$lte": timestamp},
"data.reading": {"$gte": elapsed_ms, "$lte": elapsed_ms}
}
stored_error = timeseries_db.find_one(
error_query,
Expand Down

0 comments on commit 64cfc3f

Please sign in to comment.