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

Remove hard-coded keys from production DFP #607

Merged
4 commits merged into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _get_or_create_dataframe_from_s3_batch(
output_df: pd.DataFrame = pd.concat(dfs)

# Finally sort by timestamp and then reset the index
output_df.sort_values(by=["timestamp"], inplace=True)
output_df.sort_values(by=[self._config.ae.timestamp_column_name], inplace=True)

output_df.reset_index(drop=True, inplace=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def on_data(self, message: MultiAEMessage):
"Epochs": model.lr_decay.state_dict().get("last_epoch", "unknown"),
"Learning rate": model.lr,
"Batch size": model.batch_size,
"Start Epoch": message.get_meta("timestamp").min(),
"End Epoch": message.get_meta("timestamp").max(),
"Start Epoch": message.get_meta(self._config.ae.timestamp_column_name).min(),
"End Epoch": message.get_meta(self._config.ae.timestamp_column_name).max(),
"Log Count": message.mess_count,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def append_dataframe(self, incoming_df: pd.DataFrame) -> bool:
# row_hashes = pd.util.hash_pandas_object(incoming_df)

# Filter the incoming df by epochs later than the current max_epoch
filtered_df = incoming_df[incoming_df["timestamp"] > self.max_epoch]
filtered_df = incoming_df[incoming_df[self.timestamp_column] > self.max_epoch]

if (len(filtered_df) == 0):
# We have nothing new to add. Double check that we fit within the window
before_history = incoming_df[incoming_df["timestamp"] < self.min_epoch]
before_history = incoming_df[incoming_df[self.timestamp_column] < self.min_epoch]

return len(before_history) == 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ def extract_users(self, message: cudf.DataFrame):

if (self._include_individual):

split_dataframes.update(
{username: user_df
for username, user_df in message.groupby("username", sort=False)})
split_dataframes.update({
username: user_df
for username,
user_df in message.groupby(self._config.ae.userid_column_name, sort=False)
})

output_messages: typing.List[DFPMessageMeta] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,16 @@ def run_pipeline(train_users,
groupby_column=config.ae.userid_column_name),
CustomColumn(name="locincrement",
dtype=int,
process_column_fn=partial(create_increment_col, column_name="location")),
process_column_fn=partial(create_increment_col,
column_name="location",
groupby_column=config.ae.userid_column_name,
timestamp_column=config.ae.timestamp_column_name)),
CustomColumn(name="appincrement",
dtype=int,
process_column_fn=partial(create_increment_col, column_name="appDisplayName")),
process_column_fn=partial(create_increment_col,
column_name="appDisplayName",
groupby_column=config.ae.userid_column_name,
timestamp_column=config.ae.timestamp_column_name))
]

preprocess_schema = DataFrameInputSchema(column_info=preprocess_column_info, preserve_columns=["_batch_id"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ def run_pipeline(train_users,
groupby_column=config.ae.userid_column_name),
CustomColumn(name="locincrement",
dtype=int,
process_column_fn=partial(create_increment_col, column_name="location")),
process_column_fn=partial(create_increment_col,
column_name="location",
groupby_column=config.ae.userid_column_name,
timestamp_column=config.ae.timestamp_column_name))
]

preprocess_schema = DataFrameInputSchema(column_info=preprocess_column_info, preserve_columns=["_batch_id"])
Expand Down