diff --git a/lisa/__init__.py b/lisa/__init__.py index 2990da167d084bbe0ab5e6673db81bca8abd2eb3..ccb42e0379df1974cd8701645f9ddc102ae5d724 100644 --- a/lisa/__init__.py +++ b/lisa/__init__.py @@ -40,4 +40,8 @@ warnings.filterwarnings( module=r'__main__', ) +# Work around the warnings reported here: +# https://github.com/pola-rs/polars/issues/20000 +os.environ.setdefault('POLARS_ALLOW_FORKING_THREAD', '1') + # vim :set tabstop=4 shiftwidth=4 textwidth=80 expandtab diff --git a/lisa/analysis/tasks.py b/lisa/analysis/tasks.py index d8328eefd8a3d045357c9d98f1bd448409078b7e..86f8036e3c5478bd1adbe6775bd55eec1cfad80b 100644 --- a/lisa/analysis/tasks.py +++ b/lisa/analysis/tasks.py @@ -320,8 +320,12 @@ class TasksAnalysis(TraceAnalysisBase): df = df.collect() def finalize(df, key_col): + assert len(df.columns) == 2 # Aggregate the values for each key and convert to python types - return dict(df.rows_by_key(key_col)) + return { + key: [x[0] for x in values] + for key, values in df.rows_by_key(key_col).items() + } name_to_pid = finalize(df, 'name') pid_to_name = finalize(df, 'pid') diff --git a/lisa/trace.py b/lisa/trace.py index 5c27f66cb98d894bd444b5041f85bbfb5e5c0012..bf0110ec5e73ebc4040cc76b936daa1b5f254744 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -283,10 +283,14 @@ def _logical_plan_update_paths(plan, update_path): else: return paths + # The location is based on the version of polars, since the + # JSON format is unstable. locs = [ ['paths'], - # Since polars 1.7.0, paths are stored in a new location - ['sources', 'sources', 'Paths'] + # 1.8.1 + ['sources', 'Paths'], + # 1.7.0 + ['sources', 'sources', 'Paths'], ] for loc in locs: try: diff --git a/setup.py b/setup.py index 07f03ee9c436eadea051ddab9ec485a9ab2d4800..4ee661f2cdfca1733eafbb603f6a02318f26dec6 100755 --- a/setup.py +++ b/setup.py @@ -137,8 +137,11 @@ if __name__ == "__main__": "panel", "colorcet", # Avoid: - # polars 1.7.0: https://github.com/pola-rs/polars/issues/18719 - "polars >= 1.0.0, < 2.0.0, < 1.7.0", + # polars 1.7.0, 1.7.1: https://github.com/pola-rs/polars/issues/18719 + # Require: + # polars >= 1.15.0: https://github.com/pola-rs/polars/issues/19994 + # polars >= 1.16.0: https://github.com/pola-rs/polars/issues/20000 + "polars >= 1.16.0, < 2.0.0", # Pandas >= 1.0.0 has support for new nullable dtypes # Pandas 1.2.0 has broken barplots: # https://github.com/pandas-dev/pandas/issues/38947 diff --git a/tests/test_trace.py b/tests/test_trace.py index 78699612a67cc06f5d381148029026fefc1488ef..e6ed30ee0a407185fee6bbc96c279c2e1c26cfe1 100644 --- a/tests/test_trace.py +++ b/tests/test_trace.py @@ -154,8 +154,8 @@ class TraceTestCase(StorageTestCase): for x in (pid, name, task_id, task_id2, task_id3, task_id_tuple): assert self.trace.ana.tasks.get_task_id(x) == task_id - with pytest.raises(ValueError): - for x in ('sh', 'sshd', 1639, 1642, 1702, 1717, 1718): + for x in ('sh', 'sshd'): + with pytest.raises(ValueError): self.trace.ana.tasks.get_task_id(x) def test_get_task_name_pids(self):