Skip to content

Commit

Permalink
infer_objects() is now run outside of the main thread when data() is …
Browse files Browse the repository at this point in the history
…called to reduce main thread contention.
  • Loading branch information
zakv committed Nov 19, 2020
1 parent eaca856 commit a98a766
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lyse/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,18 @@ def handler(self, request_data):
"'get dataframe'\n 'hello'\n {'filepath': <some_h5_filepath>}")

@inmain_decorator(wait_for_return=True)
def _copy_dataframe(self):
df = app.filebox.shots_model.dataframe.copy(deep=True)
return df

def _retrieve_dataframe(self):
# infer_objects() picks fixed datatypes for columns that are compatible with
# fixed datatypes, dramatically speeding up pickling. It is called here
# rather than when updating the dataframe as calling it during updating may
# call it needlessly often, whereas it only needs to be called prior to
# sending the dataframe to a client requesting it, as we're doing now.
app.filebox.shots_model.infer_objects()
df = app.filebox.shots_model.dataframe.copy(deep=True)
df = self._copy_dataframe()
df.infer_objects()
return df

def _extract_n_sequences_from_df(self, df, n_sequences):
Expand Down

0 comments on commit a98a766

Please sign in to comment.