Skip to content

Commit

Permalink
Changed to Aug 21 for the time being
Browse files Browse the repository at this point in the history
  • Loading branch information
TeachMeTW committed Dec 18, 2024
1 parent 3d688f2 commit 8022a1f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion bin/historical/migrations/populate_pipeline_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.analysis.plotting.composite_trip_creation as eapc
import emission.analysis.userinput.matcher as eaum
import emission.analysis.result.user_stat as eaurs

def add_pipeline_range(process_number, uuid_list, skip_if_no_new_data):
import logging
Expand All @@ -25,7 +26,7 @@ def add_pipeline_range(process_number, uuid_list, skip_if_no_new_data):
continue

try:
epi._get_and_store_range(uuid, "analysis/composite_trip")
eaurs.get_and_store_user_stats(uuid, "analysis/composite_trip")
except Exception as e:
print("Found error %s while processing pipeline for user %s, check log files for details"
% (e, uuid))
Expand Down
17 changes: 10 additions & 7 deletions emission/tests/analysisTests/intakeTests/TestUserStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.core.wrapper.user as ecwu
import emission.net.api.stats as enac
import emission.pipeline.intake_stage as epi

# Test imports
import emission.tests.common as etc
Expand All @@ -32,16 +33,18 @@ def setUp(self):
Set up the test environment by loading real example data for both Android and users.
"""
# Set up the real example data with entries
etc.setupRealExample(self, "emission/tests/data/real_examples/shankari_2015-aug-27")

self.testUUID = uuid.uuid4()
with open("emission/tests/data/real_examples/shankari_2015-aug-21") as fp:
self.entries = json.load(fp, object_hook = esj.wrapped_object_hook)
# Retrieve the user profile
etc.setupRealExampleWithEntries(self)
profile = edb.get_profile_db().find_one({"user_id": self.testUUID})
if profile is None:
# Initialize the profile if it does not exist
edb.get_profile_db().insert_one({"user_id": self.testUUID})

etc.runIntakePipeline(self.testUUID)

#etc.runIntakePipeline(self.testUUID)
epi.run_intake_pipeline_for_user(self.testUUID, skip_if_no_new_data = False)
logging.debug("UUID = %s" % (self.testUUID))

def tearDown(self):
Expand Down Expand Up @@ -72,7 +75,7 @@ def testGetAndStoreUserStats(self):
self.assertIn("pipeline_range", profile, "User profile should contain 'pipeline_range'.")
self.assertIn("last_call_ts", profile, "User profile should contain 'last_call_ts'.")

expected_total_trips = 8
expected_total_trips = 5
expected_labeled_trips = 0

self.assertEqual(profile["total_trips"], expected_total_trips,
Expand All @@ -85,8 +88,8 @@ def testGetAndStoreUserStats(self):
self.assertIn("start_ts", pipeline_range, "Pipeline range should contain 'start_ts'.")
self.assertIn("end_ts", pipeline_range, "Pipeline range should contain 'end_ts'.")

expected_start_ts = 1440688739.672
expected_end_ts = 1440729142.709
expected_start_ts = 1440168891.095
expected_end_ts = 1440209488.817

self.assertEqual(pipeline_range["start_ts"], expected_start_ts,
f"Expected start_ts to be {expected_start_ts}, got {pipeline_range['start_ts']}")
Expand Down
2 changes: 1 addition & 1 deletion emission/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def getRealExampleEmail(testObj):
def fillExistingUUID(testObj):
userObj = ecwu.User.fromEmail(getRealExampleEmail(testObj))
print("Setting testUUID to %s" % userObj.uuid)
testObj.testUUID = userObj.uuir
testObj.testUUID = userObj.uuid

def getRegEmailIfPresent(testObj):
if hasattr(testObj, "evaluation") and testObj.evaluation:
Expand Down

0 comments on commit 8022a1f

Please sign in to comment.