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

Fix Dockerfile to work on Silicon chip #989

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
acf7f3e
Typo Fix
TeachMeTW Oct 2, 2024
553a45d
Added Func Time Collection?
TeachMeTW Oct 4, 2024
d19392d
Fixed per feedback, removed decorator
TeachMeTW Oct 5, 2024
593e61c
Merge pull request #987 from shankari/fix_push_again
shankari Oct 6, 2024
05bac58
Update emission/storage/decorations/stats_queries.py
TeachMeTW Oct 12, 2024
e23d4b6
Update emission/storage/decorations/stats_queries.py
TeachMeTW Oct 12, 2024
7fc3f81
Update emission/storage/decorations/stats_queries.py
TeachMeTW Oct 12, 2024
e7e50da
Update emission/storage/timeseries/builtin_timeseries.py
TeachMeTW Oct 12, 2024
dd253dd
Update emission/storage/decorations/stats_queries.py
TeachMeTW Oct 12, 2024
8957a06
Review Changes
TeachMeTW Oct 12, 2024
f428069
Changes
TeachMeTW Oct 13, 2024
4f636a9
Reverted some
TeachMeTW Oct 14, 2024
b2e3cb5
Added verification
TeachMeTW Oct 14, 2024
a1ff54e
resolve
TeachMeTW Oct 14, 2024
12d5e86
Fixed whitespace commits
TeachMeTW Oct 14, 2024
cf5b5a1
Removed unused imports
TeachMeTW Oct 14, 2024
2b5cefd
Removed unused imports
TeachMeTW Oct 14, 2024
5ac74fa
Delete miniconda.sh
TeachMeTW Oct 14, 2024
64cfc3f
Removed unnecessary
TeachMeTW Oct 14, 2024
a7884e5
Merge branch 'feature/stats_timing' of https://github.com/TeachMeTW/e…
TeachMeTW Oct 14, 2024
196e410
Timeseries
TeachMeTW Oct 14, 2024
fc3f0ee
Used TimeSeries Interface and made it so _get_query accepts dict and …
TeachMeTW Oct 15, 2024
d02f186
Used get entry at ts
TeachMeTW Oct 15, 2024
b6bb6b9
Refactor
TeachMeTW Oct 15, 2024
bc9f638
Turned into unit test
TeachMeTW Oct 15, 2024
f814102
Wrong comment
TeachMeTW Oct 15, 2024
5066c85
Update .gitignore
TeachMeTW Oct 15, 2024
9996707
Update emission/tests/funcTests/TestFunctionTiming.py
TeachMeTW Oct 15, 2024
fed4964
Update emission/storage/decorations/stats_queries.py
TeachMeTW Oct 15, 2024
09f93df
remvoed whitespace
TeachMeTW Oct 15, 2024
9c418c8
Used find_entries
TeachMeTW Oct 15, 2024
5ba94d7
Jack Changes
TeachMeTW Oct 15, 2024
7f12f67
Reverts
TeachMeTW Oct 16, 2024
4c7b80b
Reverted Non_user
TeachMeTW Oct 16, 2024
e843169
Added more tests
TeachMeTW Oct 16, 2024
9f9ec9e
Update emission/tests/funcTests/TestFunctionTiming.py
TeachMeTW Oct 16, 2024
d76f63a
Update emission/tests/funcTests/TestFunctionTiming.py
TeachMeTW Oct 16, 2024
f5b07a4
Implemented Review Changes
TeachMeTW Oct 16, 2024
a24b03b
simplify tests for store_dashboard_time / store_dashboard_error
JGreenlee Oct 17, 2024
39f763d
move TestFunctionTiming -> TestStatsQueries
JGreenlee Oct 17, 2024
1bdc922
Merge pull request #1 from JGreenlee/simpler_stats_timing
TeachMeTW Oct 17, 2024
db1e7bb
Added comments and changed param
TeachMeTW Oct 17, 2024
0b39803
Toned back comments
TeachMeTW Oct 18, 2024
1551a30
Merge pull request #986 from TeachMeTW/feature/stats_timing
shankari Oct 18, 2024
a9331d5
Enable support for Apple silicon chip
jpfleischer Oct 18, 2024
68b5fb5
Merge branch 'master' of https://github.com/jpfleischer/e-mission-server
jpfleischer Oct 18, 2024
9211c61
see what the platforms are
jpfleischer Oct 19, 2024
c1482f4
Test docker build workflow
jpfleischer Oct 19, 2024
f337883
Get rid of colima
jpfleischer Oct 19, 2024
7277364
Add colima back
jpfleischer Oct 19, 2024
3304752
Automate docker install
jpfleischer Oct 19, 2024
9aeb37a
Troubleshoot docker
jpfleischer Oct 19, 2024
618aea1
Add homebrew
jpfleischer Oct 19, 2024
095ddf0
Revert to docker successfully installing
jpfleischer Oct 19, 2024
db9713a
fix colima
jpfleischer Oct 19, 2024
478482c
debug ubuntu arm
jpfleischer Oct 19, 2024
f1bbd2c
Return working setup_config.sh
jpfleischer Oct 19, 2024
ab65b89
Undo arm ubuntu runner. It is paid only.
jpfleischer Oct 19, 2024
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
Prev Previous commit
Next Next commit
Used TimeSeries Interface and made it so _get_query accepts dict and …
…objects
  • Loading branch information
TeachMeTW committed Oct 15, 2024
commit fc3f0eea6d2765f700a5024d2964e5c6f596cbfd
61 changes: 43 additions & 18 deletions emission/storage/timeseries/builtin_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,53 @@ def _get_query(self, key_list = None, time_query = None, geo_query = None,
:return:
"""
ret_query = {"invalid": {"$exists": False}}
ret_query.update(self.user_query)
if key_list is not None and len(key_list) > 0:
key_query_list = []
for key in key_list:
key_query_list.append(self.key_query(key))
ret_query.update({"$or": key_query_list})
if time_query is not None:
ret_query.update(time_query.get_query())
if geo_query is not None:
ret_query.update(geo_query.get_query())
if extra_query_list is not None:

# Update with user-specific queries
if hasattr(self, 'user_query') and isinstance(self.user_query, dict):
ret_query.update(self.user_query)
elif hasattr(self, 'user_query'):
logging.warning("user_query is not a dict and will not be used.")

# Handle key_list
if key_list:
key_query_list = [self.key_query(key) for key in key_list]
ret_query["$or"] = key_query_list

# Handle time_query
if time_query:
if hasattr(time_query, 'get_query') and callable(time_query.get_query):
time_query_dict = time_query.get_query()
ret_query.update(time_query_dict)
elif isinstance(time_query, dict):
ret_query.update(time_query)
else:
raise TypeError("time_query must have a get_query method or be a dict")

# Handle geo_query
if geo_query:
if hasattr(geo_query, 'get_query') and callable(geo_query.get_query):
geo_query_dict = geo_query.get_query()
ret_query.update(geo_query_dict)
elif isinstance(geo_query, dict):
ret_query.update(geo_query)
else:
raise TypeError("geo_query must have a get_query method or be a dict")

# Handle extra_query_list
if extra_query_list:
for extra_query in extra_query_list:
if not isinstance(extra_query, dict):
raise TypeError("Each extra_query must be a dict")
eq_keys = set(extra_query.keys())
curr_keys = set(ret_query.keys())
overlap_keys = eq_keys.intersection(curr_keys)
if len(overlap_keys) != 0:
logging.info("eq_keys = %s, curr_keys = %s, overlap_keys = %s" %
(eq_keys, curr_keys, overlap_keys))
raise AttributeError("extra query would overwrite keys %s" %
list(overlap_keys))
else:
ret_query.update(extra_query)
if overlap_keys:
logging.info(
f"eq_keys = {eq_keys}, curr_keys = {curr_keys}, overlap_keys = {overlap_keys}"
)
raise AttributeError(f"extra query would overwrite keys {list(overlap_keys)}")
ret_query.update(extra_query)

return ret_query

def _get_sort_key(self, time_query = None):
Expand Down
50 changes: 29 additions & 21 deletions emission/tests/funcTests/TestFunctionTiming.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import time
import typing as t
import pymongo

# Import the store_dashboard_time and store_dashboard_error functions
import emission.storage.decorations.stats_queries as sdq
Expand All @@ -11,8 +12,8 @@
import emission.core.timer as ec_timer

# Import the database module for verification
import emission.storage.timeseries.builtin_timeseries as bits
builtin_ts = bits.BuiltinTimeSeries(None)
import emission.storage.timeseries.abstract_timeseries as esta

# Define test functions
def test_function_1():
logging.info("Executing test_function_1")
Expand Down Expand Up @@ -67,20 +68,21 @@ def execute_and_time_function(func: t.Callable[[], bool]):
logging.info(f"Function '{function_name}' executed successfully in {elapsed_ms:.2f} ms.")

# Verification: Adjusted Query to Match Document Structure
timeseries_db = builtin_ts.get_timeseries_db(key="stats/dashboard_time")

timeseries_db = esta.TimeSeries.get_time_series(None)

query = {
"metadata.key": "stats/dashboard_time",
"data.name": function_name,
# Define the time range and additional filters
time_query = {
"data.ts": {"$gte": timestamp, "$lte": timestamp},
"data.reading": {"$gte": elapsed_ms, "$lte": elapsed_ms}
"data.name": function_name,
"data.reading": {"$gte": elapsed_ms, "$lte": elapsed_ms}
}

# Retrieve the most recent document for the function
stored_document = timeseries_db.find_one(
query,
sort=[("data.ts", -1)]

# Retrieve the first matching entry using the get_first_entry method
stored_document = timeseries_db.get_first_entry(
key="stats/dashboard_time",
field="data.ts",
sort_order=pymongo.DESCENDING,
time_query=time_query
)

if stored_document:
Expand Down Expand Up @@ -115,19 +117,25 @@ def execute_and_time_function(func: t.Callable[[], bool]):
logging.error(f"Function '{function_name}' failed after {elapsed_ms:.2f} ms with error: {e}")

# Verification: Adjusted Error Query to Match Document Structure
timeseries_db = builtin_ts.get_timeseries_db(key="stats/dashboard_error")
# Initialize the TimeSeries database connection
timeseries_db = esta.TimeSeries.get_time_series(None)

error_query = {
"metadata.key": "stats/dashboard_error",
"data.name": function_name,
# Define the time range and additional filters
time_query = {
"data.ts": {"$gte": timestamp, "$lte": timestamp},
"data.name": function_name,
"data.reading": {"$gte": elapsed_ms, "$lte": elapsed_ms}
}
stored_error = timeseries_db.find_one(
error_query,
sort=[("data.ts", -1)]

# Retrieve the first matching entry using the get_first_entry method
stored_error = timeseries_db.get_first_entry(
key="stats/dashboard_error",
field="data.ts",
sort_order=pymongo.DESCENDING,
time_query=time_query
)


if stored_error:
stored_ts = stored_error.get("data", {}).get("ts", 0)
stored_reading = stored_error.get("data", {}).get("reading", 0)
Expand All @@ -148,7 +156,7 @@ def main():
function_list: t.List[t.Callable[[], bool]] = [
test_function_1,
test_function_2,
# test_function_faulty, # This will raise an exception
test_function_faulty, # This will raise an exception
test_function_3 # This should execute normally after the faulty function
]
# Execute and time each function
Expand Down
Loading