Commit 3bfe6334 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Flow Processor. Disable parallel computing on Windows.

Pandarallel does not work on Windows...
parent 0928fb8c
Pipeline #116802 passed with stages
in 2 minutes and 17 seconds
......@@ -7,7 +7,8 @@ import datetime
import pandas as pd
import numpy as np
import typing
from pandarallel import pandarallel
if os.name != "nt":
from pandarallel import pandarallel
from cfatools.logreader.dataset import DatasetReader
from cfatools.processor import iceblock
......@@ -314,6 +315,7 @@ def get_arrival_df(encoder_df: pd.DataFrame,
pd.DataFrame
Dataframe with arrival datetime at needle and Picarro.
"""
print(os.name)
if dataset is not None:
pkl_filename = os.path.join(dataset.binary_base_path, "arrival.pkl")
else:
......@@ -469,7 +471,7 @@ def get_tubing_volume_dict(filepath: str,
return volume_dict
def get_datetime_out(datetime_in_series: pd.Series, mlmin_series: pd.Series, tube_volume_ml: float, parallel: bool = True) -> pd.Series:
def get_datetime_out(datetime_in_series: pd.Series, mlmin_series: pd.Series, tube_volume_ml: float, parallel: bool = False) -> pd.Series:
"""Get the date/time the fluid reaches the end of the tube.
Considering a tube whose internal volume is ``tube_volume_ml``, in which flows a fluid as variable flow rates
......@@ -488,7 +490,7 @@ def get_datetime_out(datetime_in_series: pd.Series, mlmin_series: pd.Series, tub
parallel: bool
If ``True`` the datetime_out computation will be parallelized, which is faster 2-3x faster for big
``datetime_in`` Series but make debugging more complicated. Should be enabled in production disabled while
debugging.
debugging. /!\ Not available on Windows!
Returns
-------
......@@ -506,6 +508,8 @@ def get_datetime_out(datetime_in_series: pd.Series, mlmin_series: pd.Series, tub
datetime_in_series = datetime_in_series[datetime_in_series >= mlmin_df["ml_cumul"].dropna().index[0]]
if parallel:
if os.name == "nt":
raise ValueError("It is not possible to use this parallel computing option on Windows.")
pandarallel.initialize()
datetime_out = datetime_in_series.parallel_apply(__get_single_datetime_out__, args=(mlmin_df, tube_volume_ml))
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment