cold-carpenter-83628
01/26/2024, 9:30 PMobject ๐
_pickle.PicklingError: Can't pickle <function root at 0x11e52ccc0>: attribute lookup root on __main__ failedshy-address-41011
01/26/2024, 9:33 PMshy-address-41011
01/26/2024, 9:34 PMself.bq_client = <create my awesome BQ client>cold-carpenter-83628
01/26/2024, 9:37 PMself.client = bigquery.Client(project="mozdata", location="us")cold-carpenter-83628
01/26/2024, 9:39 PMinstantiate_client. When I moved that line to step 4 where I actually need the client, my print messages indicated that I was getting all the way to the end of step 3 (by which point no BigQuery client is created yet), but then I get _pickle.PicklingError: Can't pickle <function root at 0x11e52ccc0>: attribute lookup root on __main__ failedcold-carpenter-83628
01/26/2024, 9:39 PMcold-carpenter-83628
01/26/2024, 9:40 PM@step
def instantiate_model(self):
'''
Initializes the LTV Model with the flow parameters
'''
print("Instantiating LTV Model...")
self.ltv_model = LTVModel(country=self.country)
print("Model instantiated. providing Training params")
train_params = {
'min_sample_id': self.train_min_sample_id,
'max_sample_id': self.train_max_sample_id,
'first_cohort_date': f'"{self.train_first_cohort_date}"',
'last_cohort_date': f'"{self.train_last_cohort_date}"',
'last_observation_date': f'"{self.train_last_observation_date}"'
}
self.ltv_model.train_params = train_params
print("Now the test params")
test_params = {
'min_sample_id': self.test_min_sample_id,
'max_sample_id': self.test_max_sample_id,
'first_cohort_date': f'"{self.test_first_cohort_date}"',
'last_cohort_date': f'"{self.test_last_cohort_date}"',
'last_observation_date': f'"{self.test_last_observation_date}"'
}
self.ltv_model.test_params = test_params
print("are we getting here?")
self.next(self.train_model)cold-carpenter-83628
01/26/2024, 9:41 PMshy-address-41011
01/26/2024, 9:46 PMpickleable then you will come to know only towards the end of the stepcold-carpenter-83628
01/26/2024, 9:58 PMshy-address-41011
01/26/2024, 9:58 PMshy-address-41011
01/26/2024, 9:59 PMshy-address-41011
01/26/2024, 10:03 PMcold-carpenter-83628
01/26/2024, 10:04 PMcold-carpenter-83628
01/26/2024, 10:04 PM__main__ path in spite of the fact that it is an an attribute on the flow class.shy-address-41011
01/26/2024, 10:04 PMcold-carpenter-83628
01/26/2024, 10:04 PMcold-carpenter-83628
01/26/2024, 10:05 PMshy-address-41011
01/26/2024, 10:05 PMcold-carpenter-83628
01/26/2024, 10:06 PMdry-beach-38304
01/26/2024, 10:26 PMdry-beach-38304
01/26/2024, 10:27 PMdry-beach-38304
01/26/2024, 10:28 PMcold-carpenter-83628
01/26/2024, 10:28 PMcold-carpenter-83628
01/26/2024, 10:29 PMdry-beach-38304
01/26/2024, 10:31 PMcold-carpenter-83628
01/26/2024, 10:33 PMThe problem is that when namedtuple() returns a type object, it isn't aware of the fact that it's being assigned to a class member - and thus, it tells the type object that its type name should be __main__.Bar, even though it should really be __main__.Foo.Bar.dry-beach-38304
01/26/2024, 10:38 PMcold-carpenter-83628
01/26/2024, 10:47 PMcold-carpenter-83628
01/30/2024, 6:36 PM