From 07365341ee7e6cd58201f08bf123af605b1b7e50 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 16 Nov 2018 09:25:26 +0100 Subject: [PATCH] Supplementary correction for pickle transmission --- examples/daSalome/test005_ADAO_scripts_for_JDC.py | 7 ++++--- .../daSalome/test006_Observers_Observation_Operator.py | 7 ++++--- .../Script_ObservationOperator_H.py | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/daSalome/test005_ADAO_scripts_for_JDC.py b/examples/daSalome/test005_ADAO_scripts_for_JDC.py index 6938bc8..e0ae6fa 100644 --- a/examples/daSalome/test005_ADAO_scripts_for_JDC.py +++ b/examples/daSalome/test005_ADAO_scripts_for_JDC.py @@ -20,8 +20,9 @@ # # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D -import numpy -import logging +import numpy, logging, codecs, pickle +def loads( data ): + return pickle.loads(codecs.decode(data.encode(), "base64")) logging.info("ComputationFunctionNode: Begin") # ============================================================================== # Input data and parameters: all is in the required input variable @@ -37,7 +38,7 @@ logging.info("ComputationFunctionNode: Begin") method = "" for param in computation["specificParameters"]: if param["name"] == "method": - method = param["value"] + method = loads(param["value"]) logging.info("ComputationFunctionNode: Found method is \'%s\'"%method) # # Recovering the current control state X diff --git a/examples/daSalome/test006_Observers_Observation_Operator.py b/examples/daSalome/test006_Observers_Observation_Operator.py index 099459d..4f81cba 100644 --- a/examples/daSalome/test006_Observers_Observation_Operator.py +++ b/examples/daSalome/test006_Observers_Observation_Operator.py @@ -20,9 +20,10 @@ # # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D -import numpy import time -import logging +import numpy, logging, codecs, pickle +def loads( data ): + return pickle.loads(codecs.decode(data.encode(), "base64")) logging.info("ComputationFunctionNode: Begin") # ============================================================================== # Input data and parameters: all is in the required input variable @@ -38,7 +39,7 @@ logging.info("ComputationFunctionNode: Begin") method = "" for param in computation["specificParameters"]: if param["name"] == "method": - method = param["value"] + method = loads(param["value"]) logging.info("ComputationFunctionNode: Found method is \'%s\'"%method) # # Recovering the current control state X diff --git a/examples/daSkeletons/External_data_definition_by_scripts/Script_ObservationOperator_H.py b/examples/daSkeletons/External_data_definition_by_scripts/Script_ObservationOperator_H.py index 2d052bb..d8009ea 100644 --- a/examples/daSkeletons/External_data_definition_by_scripts/Script_ObservationOperator_H.py +++ b/examples/daSkeletons/External_data_definition_by_scripts/Script_ObservationOperator_H.py @@ -31,7 +31,9 @@ __author__ = "Jean-Philippe ARGAUD" # ============================================================================== # import Physical_simulation_functions -import numpy, logging +import numpy, logging, codecs, pickle +def loads( data ): + return pickle.loads(codecs.decode(data.encode(), "base64")) # # ----------------------------------------------------------------------- # SALOME input data and parameters: all information are the required input @@ -47,7 +49,7 @@ import numpy, logging method = "" for param in computation["specificParameters"]: if param["name"] == "method": - method = param["value"] + method = loads(param["value"]) logging.info("ComputationFunctionNode: Found method is \'%s\'"%method) # # Loading the H operator functions from external definitions -- 2.39.2