return std::list<std::string>();
}
+py2cpp::PyPtr PyStudyFunction::createEmptySample()const
+{
+ py2cpp::PyPtr sample;
+ py2cpp::PyFunction fnCreateEmptySample;
+ fnCreateEmptySample.loadExp(_pyObject, "CreateEmptySample");
+ sample = fnCreateEmptySample();
+ return sample;
+}
+
}
virtual std::string errors()const;
virtual bool isValid()const;
virtual std::list<std::string> datafiles()const;
+ py2cpp::PyPtr createEmptySample()const;
friend PyObject * py2cpp::toPy(const PyStudyFunction& jp);
private:
py2cpp::PyPtr _pyObject;
template <class ...Ts>
YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
-/*!
- * A python sample object is created and it contains input and output names of
- * variables. It also contains input values, but output values and errors are
- * not copied.
- */
-template <class ...Ts>
-YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample);
-
/*!
* Fetch output values and errors from the python objet.
* The c++ sample should already contain the names of variables when this
return check;
}
-template <class ...Ts>
-YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample)
-{
- py2cpp::PyFunction sampleConstructor;
- sampleConstructor.loadExp("pydefx", "Sample");
- py2cpp::PyPtr result = sampleConstructor(sample.allInputNames(),
- sample.allOutputNames());
-
- py2cpp::PyFunction setInputValues;
- setInputValues.loadExp(result, "setInputValues");
- setInputValues(inputToPy(sample));
-
- return result;
-}
-
template <class ...Ts>
YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
{
{
try
{
- py2cpp::PyPtr pySample = createPySample(sample);
+ py2cpp::PyPtr pySample = fnScript.createEmptySample();
+ py2cpp::PyFunction setInputValues;
+ setInputValues.loadExp(pySample, "setInputValues");
+ setInputValues(inputToPy(_sample));
+
py2cpp::PyFunction pyFn;
pyFn.loadExp(_pyStudy, "createNewJob");
pyFn(fnScript, pySample, params);
{
try
{
- py2cpp::PyPtr pySample = createPySample(_sample);
+ py2cpp::PyPtr pySample = fnScript.createEmptySample();
+ py2cpp::PyFunction setInputValues;
+ setInputValues.loadExp(pySample, "setInputValues");
+ setInputValues(inputToPy(_sample));
+
py2cpp::PyFunction pyFn;
pyFn.loadExp(_pyStudy, "createNewJob");
pyFn(fnScript, pySample, params);
import os
myParams = pydefx.Parameters()
-myParams.configureResource("eole")
+myParams.configureResource("gaia")
#myParams.createResultDirectory("/tmp")
myParams.nb_branches = 4
myParams.salome_parameters.resource_required.nb_proc = 1