Skip to content

Commit 8022a1f

Browse files
committed
Changed to Aug 21 for the time being
1 parent 3d688f2 commit 8022a1f

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

bin/historical/migrations/populate_pipeline_range.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import emission.storage.decorations.analysis_timeseries_queries as esda
1414
import emission.analysis.plotting.composite_trip_creation as eapc
1515
import emission.analysis.userinput.matcher as eaum
16+
import emission.analysis.result.user_stat as eaurs
1617

1718
def add_pipeline_range(process_number, uuid_list, skip_if_no_new_data):
1819
import logging
@@ -25,7 +26,7 @@ def add_pipeline_range(process_number, uuid_list, skip_if_no_new_data):
2526
continue
2627

2728
try:
28-
epi._get_and_store_range(uuid, "analysis/composite_trip")
29+
eaurs.get_and_store_user_stats(uuid, "analysis/composite_trip")
2930
except Exception as e:
3031
print("Found error %s while processing pipeline for user %s, check log files for details"
3132
% (e, uuid))

emission/tests/analysisTests/intakeTests/TestUserStat.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import emission.storage.decorations.analysis_timeseries_queries as esda
2222
import emission.core.wrapper.user as ecwu
2323
import emission.net.api.stats as enac
24+
import emission.pipeline.intake_stage as epi
2425

2526
# Test imports
2627
import emission.tests.common as etc
@@ -32,16 +33,18 @@ def setUp(self):
3233
Set up the test environment by loading real example data for both Android and users.
3334
"""
3435
# Set up the real example data with entries
35-
etc.setupRealExample(self, "emission/tests/data/real_examples/shankari_2015-aug-27")
36-
36+
self.testUUID = uuid.uuid4()
37+
with open("emission/tests/data/real_examples/shankari_2015-aug-21") as fp:
38+
self.entries = json.load(fp, object_hook = esj.wrapped_object_hook)
3739
# Retrieve the user profile
40+
etc.setupRealExampleWithEntries(self)
3841
profile = edb.get_profile_db().find_one({"user_id": self.testUUID})
3942
if profile is None:
4043
# Initialize the profile if it does not exist
4144
edb.get_profile_db().insert_one({"user_id": self.testUUID})
4245

43-
etc.runIntakePipeline(self.testUUID)
44-
46+
#etc.runIntakePipeline(self.testUUID)
47+
epi.run_intake_pipeline_for_user(self.testUUID, skip_if_no_new_data = False)
4548
logging.debug("UUID = %s" % (self.testUUID))
4649

4750
def tearDown(self):
@@ -72,7 +75,7 @@ def testGetAndStoreUserStats(self):
7275
self.assertIn("pipeline_range", profile, "User profile should contain 'pipeline_range'.")
7376
self.assertIn("last_call_ts", profile, "User profile should contain 'last_call_ts'.")
7477

75-
expected_total_trips = 8
78+
expected_total_trips = 5
7679
expected_labeled_trips = 0
7780

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

88-
expected_start_ts = 1440688739.672
89-
expected_end_ts = 1440729142.709
91+
expected_start_ts = 1440168891.095
92+
expected_end_ts = 1440209488.817
9093

9194
self.assertEqual(pipeline_range["start_ts"], expected_start_ts,
9295
f"Expected start_ts to be {expected_start_ts}, got {pipeline_range['start_ts']}")

emission/tests/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def getRealExampleEmail(testObj):
107107
def fillExistingUUID(testObj):
108108
userObj = ecwu.User.fromEmail(getRealExampleEmail(testObj))
109109
print("Setting testUUID to %s" % userObj.uuid)
110-
testObj.testUUID = userObj.uuir
110+
testObj.testUUID = userObj.uuid
111111

112112
def getRegEmailIfPresent(testObj):
113113
if hasattr(testObj, "evaluation") and testObj.evaluation:

0 commit comments

Comments
 (0)