From: Ovidiu Mircescu Date: Thu, 21 Feb 2019 12:57:54 +0000 (+0100) Subject: Output variable names imposed by the study function. X-Git-Tag: V9_3_0rc1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a9cec43aadee6728c7affdfa666308bc6528bbb4;p=tools%2Fydefx.git Output variable names imposed by the study function. PyStudyFunction is now full python. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dd3a80..2bd80fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,30 +29,14 @@ SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the IF(EXISTS ${CONFIGURATION_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") INCLUDE(SalomeMacros) + INCLUDE(SalomeSetupPlatform) ELSE() MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !" ) ENDIF() -SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to Salome KERNEL") -IF( EXISTS ${KERNEL_ROOT_DIR} ) - LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") -ELSE() - MESSAGE(FATAL_ERROR "We absolutely need Salome KERNEL, please define KERNEL_ROOT_DIR") -ENDIF() -FIND_PACKAGE(SalomeKERNEL REQUIRED) -ADD_DEFINITIONS(${KERNEL_DEFINITIONS} ) -INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS}) - -SET(YACS_ROOT_DIR $ENV{YACS_ROOT_DIR} CACHE PATH "Path to Salome YACS") -IF( EXISTS ${YACS_ROOT_DIR} ) - LIST(APPEND CMAKE_MODULE_PATH "${YACS_ROOT_DIR}/salome_adm/cmake_files") -ELSE() - MESSAGE(FATAL_ERROR "We absolutely need Salome YACS, please define YACS_ROOT_DIR") -ENDIF() -FIND_PACKAGE(SalomeYACS REQUIRED) -ADD_DEFINITIONS(${YACS_DEFINITIONS}) -INCLUDE_DIRECTORIES(${YACS_INCLUDE_DIRS}) +FIND_PACKAGE(SalomePythonInterp REQUIRED) +FIND_PACKAGE(SalomePythonLibs REQUIRED) SET(PY2CPP_ROOT_DIR $ENV{PY2CPP_ROOT_DIR} CACHE PATH "Path to py2cpp") IF( EXISTS ${PY2CPP_ROOT_DIR} ) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 601a254..b5e28c0 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -16,8 +16,14 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -ADD_DEFINITIONS(${YACS_DEFINITIONS}) -INCLUDE_DIRECTORIES(${YACS_INCLUDE_DIRS}) + +INCLUDE_DIRECTORIES( + ${PYTHON_INCLUDE_DIR} +) + +ADD_DEFINITIONS( + ${PYTHON_DEFINITIONS} +) SET(ydefx_SOURCES PyStudyFunction.cxx @@ -40,8 +46,8 @@ SET(ydefx_HEADERS ) SET(ydefx_LINK - py2yacslib py2cpp + ${PYTHON_LIBRARIES} ) ADD_LIBRARY(ydefx ${ydefx_SOURCES}) diff --git a/src/cpp/JobParametersProxy.hxx b/src/cpp/JobParametersProxy.hxx index b0b5038..285bfd0 100644 --- a/src/cpp/JobParametersProxy.hxx +++ b/src/cpp/JobParametersProxy.hxx @@ -18,21 +18,10 @@ // #ifndef YDEFX_JOBPARAMETERSPROXY_H #define YDEFX_JOBPARAMETERSPROXY_H -#include #include #include #include - -namespace ydefx -{ -class JobParametersProxy; -} -namespace py2cpp -{ -PyObject * toPy(const ydefx::JobParametersProxy& jp); -} - -#include +#include "PyConversions.hxx" namespace ydefx { diff --git a/src/cpp/PyStudyFunction.cxx b/src/cpp/PyStudyFunction.cxx index 60ac11f..96dedc2 100644 --- a/src/cpp/PyStudyFunction.cxx +++ b/src/cpp/PyStudyFunction.cxx @@ -19,79 +19,93 @@ #include "PyStudyFunction.hxx" #include #include -#include +#include + +PyObject * py2cpp::toPy(const ydefx::PyStudyFunction& studyFn) +{ + PyObject * result = studyFn._pyObject.get(); + Py_IncRef(result); + return result; +} namespace ydefx { PyStudyFunction::PyStudyFunction() -: _content() -, _input() -, _output() -, _errors() +: _pyObject(nullptr) { - _errors.push_back("Function \"_exec\" not found!"); + py2cpp::PyFunction objConstructor; + objConstructor.loadExp("pydefx", "PyScript"); + _pyObject = objConstructor(); } PyStudyFunction::~PyStudyFunction(){} void PyStudyFunction::loadFile(const std::string& path) { - std::ifstream infile(path.c_str()); - std::stringstream buffer; - buffer << infile.rdbuf(); - loadString(buffer.str()); + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "loadFile"); + pyFn(path); } void PyStudyFunction::loadString(const std::string& value) { - _content = value; - _input.clear(); - _output.clear(); - _errors.clear(); - // TODO: use py2yacs - Py2yacs p2y; - p2y.load(value); - if(p2y.getGlobalErrors().size() == 0) - { - const std::list& fn_prop = p2y.getFunctionProperties(); - std::list::const_iterator prop_it = fn_prop.begin(); - while(prop_it != fn_prop.end() && prop_it->_name != "_exec") - ++ prop_it; - if(prop_it != fn_prop.end() && prop_it->_errors.empty()) - { - for(const std::string& name: prop_it->_input_ports) - _input.push_back(name); - for(const std::string& name: prop_it->_output_ports) - _output.push_back(name); - } - } - // TODO: deal with the errors + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "loadString"); + pyFn(value); } void PyStudyFunction::save(const std::string& path) { - std::ofstream outfile(path.c_str()); - outfile << _content; + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "saveFile"); + pyFn(path); +} + +std::string PyStudyFunction::content()const +{ + std::string result; + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "content"); + py2cpp::pyResult(result) = pyFn(); + return result; +} + +std::list PyStudyFunction::inputNames()const +{ + std::list result; + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "getInputNames"); + py2cpp::pyResult(result) = pyFn(); + return result; } -const std::string& PyStudyFunction::content()const +std::list PyStudyFunction::outputNames()const { - return _content; + std::list result; + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "getOutputNames"); + py2cpp::pyResult(result) = pyFn(); + return result; } -const std::list& PyStudyFunction::inputNames()const +std::string PyStudyFunction::errors()const { - return _input; + std::string result; + py2cpp::PyFunction pyFn; + pyFn.loadExp(_pyObject, "getErrors"); + py2cpp::pyResult(result) = pyFn(); + return result; } -const std::list& PyStudyFunction::outputNames()const +bool PyStudyFunction::isValid()const { - return _output; + std::string err = errors(); + return err.empty(); } -const std::list& PyStudyFunction::errors()const +std::list PyStudyFunction::datafiles()const { - return _errors; + return std::list(); } } diff --git a/src/cpp/PyStudyFunction.hxx b/src/cpp/PyStudyFunction.hxx index ed9371d..df6dcdd 100644 --- a/src/cpp/PyStudyFunction.hxx +++ b/src/cpp/PyStudyFunction.hxx @@ -19,6 +19,8 @@ #ifndef YDEFX_PYSTUDYFUNCTION_H #define YDEFX_PYSTUDYFUNCTION_H #include "StudyFunction.hxx" +#include "PyConversions.hxx" + namespace ydefx { class PyStudyFunction : StudyFunction @@ -29,15 +31,15 @@ public: virtual void loadFile(const std::string& path); virtual void loadString(const std::string&); virtual void save(const std::string& path); - virtual const std::string& content()const; - virtual const std::list& inputNames()const; - virtual const std::list& outputNames()const; - virtual const std::list& errors()const; + virtual std::string content()const; + virtual std::list inputNames()const; + virtual std::list outputNames()const; + virtual std::string errors()const; + virtual bool isValid()const; + virtual std::list datafiles()const; + friend PyObject * py2cpp::toPy(const PyStudyFunction& jp); private: - std::string _content; - std::list _input; - std::list _output; - std::list _errors; + py2cpp::PyPtr _pyObject; }; } #endif // YDEFX_PYSTUDYFUNCTION_H diff --git a/src/cpp/StudyFunction.hxx b/src/cpp/StudyFunction.hxx index ab76b96..5654b3a 100644 --- a/src/cpp/StudyFunction.hxx +++ b/src/cpp/StudyFunction.hxx @@ -30,11 +30,12 @@ public: virtual void loadFile(const std::string& path)=0; virtual void loadString(const std::string&)=0; virtual void save(const std::string& path)=0; - virtual const std::string& content()const=0; - virtual const std::list& inputNames()const=0; - virtual const std::list& outputNames()const=0; - virtual const std::list& errors()const=0; - std::list datafiles; + virtual std::string content()const=0; + virtual std::list inputNames()const=0; + virtual std::list outputNames()const=0; + virtual std::string errors()const=0; + virtual std::list datafiles()const=0; + virtual bool isValid()const=0; }; } #endif // YDEFX_STUDYFUNCTION_H diff --git a/src/cpp/TMonoPyJob.hxx b/src/cpp/TMonoPyJob.hxx index ce0741c..9206c9b 100644 --- a/src/cpp/TMonoPyJob.hxx +++ b/src/cpp/TMonoPyJob.hxx @@ -45,7 +45,7 @@ public: py2cpp::PyPtr pySample = createPySample(sample); py2cpp::PyFunction pyFn; pyFn.loadExp(_pyStudy, "createNewJob"); - pyFn(fnScript.content(), pySample, params); + pyFn(fnScript, pySample, params); } catch(std::exception& e) { diff --git a/src/cpp/Test/StudyGeneralTest.cxx b/src/cpp/Test/StudyGeneralTest.cxx index fe9ad81..49e25e4 100644 --- a/src/cpp/Test/StudyGeneralTest.cxx +++ b/src/cpp/Test/StudyGeneralTest.cxx @@ -49,7 +49,7 @@ void SampleTest::fullStudy() ydefx::PyStudyFunction studyFunction; studyFunction.loadString(pyScript); - CPPUNIT_ASSERT(studyFunction.errors().empty()); + CPPUNIT_ASSERT(studyFunction.isValid()); const std::list& inputs = studyFunction.inputNames(); CPPUNIT_ASSERT(std::find(inputs.begin(), inputs.end(), "a")!=inputs.end()); CPPUNIT_ASSERT(std::find(inputs.begin(), inputs.end(), "b")!=inputs.end()); @@ -58,8 +58,8 @@ void SampleTest::fullStudy() != outputs.end()); ydefx::Sample sample; - std::vector a_vals = {1.1, 2.2, 3.4, 5.5}; - std::vector b_vals = {2.2, 4.4, 6.8, 11}; + std::vector a_vals = {1.1, 4.4, 9, 4}; + std::vector b_vals = {1.1, 2.2, 3, 1}; sample.inputs().set("a", a_vals); sample.inputs().set("b", b_vals); sample.outputs().addName("d"); @@ -87,7 +87,7 @@ void SampleTest::fullStudy() ok = myJob->fetch(); CPPUNIT_ASSERT(ok); CPPUNIT_ASSERT(myJob->lastError().empty()); - std::vector expectedResult = {0.5, 0.5, 0.5, 0.5}; + std::vector expectedResult = {1,2,3,4}; const std::vector& result = sample.outputs().get("d"); CPPUNIT_ASSERT(expectedResult == result); delete myJob; diff --git a/src/cpp/Test/StudyRestartTest.cxx b/src/cpp/Test/StudyRestartTest.cxx index 4ec2642..b4bc4f9 100644 --- a/src/cpp/Test/StudyRestartTest.cxx +++ b/src/cpp/Test/StudyRestartTest.cxx @@ -19,6 +19,8 @@ #include "StudyRestartTest.hxx" #include "../Launcher.hxx" // possible conflict with KERNEL/Launcher/Launcher.hxx #include +#include +#include void SampleTest::setUp() { @@ -32,6 +34,11 @@ void SampleTest::cleanUp() { } +/* + * There are some limitations when you reconnect to a job launched on a resource + * which does not have a batch manager. The state of the reconnected job will + * always be "ERROR" and it is not possible to know when it is finished. + */ void SampleTest::studyTest() { Py_Initialize(); @@ -60,12 +67,21 @@ void SampleTest::studyTest() delete myJob; ydefx::Job* restoredJob = l.connectJob(jobDump, sample); + // On localhost you cannot completely reconnect the job because there is no + // batch manager. The job will be in the state "ERROR" but you can fetch the + // results anyway. CPPUNIT_ASSERT(restoredJob); CPPUNIT_ASSERT(l.lastError().empty()); + // This "wait" will end instantly because of the "ERROR" state. bool ok = restoredJob->wait(); CPPUNIT_ASSERT(ok); double progress = restoredJob->progress(); - CPPUNIT_ASSERT(progress == 1.0); + // We can check the progress in order to know if the job is done, but we + // cannot detect if the job finished in error. + if(progress < 1.0) + std::this_thread::sleep_for(std::chrono::seconds(10)); + double progress2 = restoredJob->progress(); + CPPUNIT_ASSERT(progress <= progress2); ok = restoredJob->fetch(); CPPUNIT_ASSERT(ok); std::vector expectedResult = {0.5, 0.5, 0.5, 0.5}; diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index ed7f9a6..62bfc34 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -30,7 +30,14 @@ #) SET(CMAKE_AUTOMOC ON) -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/cpp) +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/cpp + ${PYTHON_INCLUDE_DIR} +) + +ADD_DEFINITIONS( + ${PYTHON_DEFINITIONS} +) SET(YDEFX_SOURCES ResourceWidget.cxx diff --git a/src/gui/ParamsConfig.cxx b/src/gui/ParamsConfig.cxx index 2987da4..3dbaa32 100644 --- a/src/gui/ParamsConfig.cxx +++ b/src/gui/ParamsConfig.cxx @@ -22,6 +22,7 @@ ParamsConfigWidget::ParamsConfigWidget(ydefx::JobParametersProxy& model, QWidget* parent) : QScrollArea(parent) , _model(model) +, _extraEdit(nullptr) { QWidget* mainWidget = new QWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(); diff --git a/src/gui/PathsConfig.cxx b/src/gui/PathsConfig.cxx index 02dcee5..951fc94 100644 --- a/src/gui/PathsConfig.cxx +++ b/src/gui/PathsConfig.cxx @@ -22,6 +22,9 @@ PathsConfigWidget::PathsConfigWidget(ydefx::JobParametersProxy& model, QWidget* parent) : QScrollArea(parent) , _model(model) +, _localdirEdit(nullptr) +, _inputFilesList(nullptr) +, _removeInputFilesButton(nullptr) { QWidget* mainWidget = new QWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(); diff --git a/src/pydefx/pyscript.py b/src/pydefx/pyscript.py index 48480a6..a302913 100644 --- a/src/pydefx/pyscript.py +++ b/src/pydefx/pyscript.py @@ -18,6 +18,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # from . import sample +import py2yacs class PyScriptException(Exception): pass @@ -25,13 +26,19 @@ class PyScriptException(Exception): class PyScript: def __init__(self): self.script = "" + self.properties, self.errors = py2yacs.get_properties(self.script) def loadFile(self,path): with open(path, "r") as f: self.script = f.read() + self.properties, self.errors = py2yacs.get_properties(self.script) def loadString(self, script): self.script = script + self.properties, self.errors = py2yacs.get_properties(self.script) + + def content(self): + return self.script def saveFile(self, path): with open(path, "w") as f: @@ -48,40 +55,56 @@ class PyScript: print(f.errors) # list of py2yacs errors in the function print(f.imports) # list of import statements in the function """ - import py2yacs return py2yacs.get_properties(self.script) - def getFunctionProperties(self, fname): + def getFunctionProperties(self, fname = "_exec"): """ Properties of the _exec function: - fn_properties, errors = myscript.getExecProperties("_exec") + fn_properties = myscript.getFunctionProperties() fn_properties.name : "_exec" fn_properties.inputs : list of input variable names fn_properties.outputs : list of output variable names fn_properties.errors : list of py2yacs errors in the function fn_properties.imports : list of import statements in the function - errors : list of syntax errors in the script fn_properties is None if the "_exec" function does not exist. """ - functions,errors = self.getAllProperties() - fn_properties = next((f for f in functions if f.name == fname), None) - return fn_properties, errors + fn_properties = next((f for f in self.properties if f.name == fname), None) + return fn_properties + + def getOutputNames(self, fname = "_exec"): + errorsText = self.getErrors(fname) + if len(errorsText) > 0: + raise PyScriptException(errorsText) + fnProperties = self.getFunctionProperties(fname) + return fnProperties.outputs + + def getInputNames(self, fname = "_exec"): + errorsText = self.getErrors(fname) + if len(errorsText) > 0: + raise PyScriptException(errorsText) + fnProperties = self.getFunctionProperties(fname) + return fnProperties.inputs + + def getErrors(self, fname = "_exec"): + error_string = "" + if len(self.errors) > 0: + error_string = "global errors:\n" + error_string += '\n'.join(errors) + else: + properties = self.getFunctionProperties(fname) + if properties is None: + error_string += "Function {} not found in the script!".format(fname) + else: + error_string += '\n'.join(properties.errors) + return error_string def CreateEmptySample(self): """ Create a sample with input and output variable names set. """ fn = "_exec" - fn_properties, errors = self.getFunctionProperties(fn) + errors = self.getErrors(fn) if len(errors) > 0: - error_string = "global errors:\n" - error_string += '\n'.join(errors) - raise PyScriptException(error_string) - if fn_properties is None: - raise PyScriptException("Function {} not found!".format(fn)) - if len(fn_properties.errors) > 0: - error_string = "Errors in function {}:\n".format(fn) - error_string += '\n'.join(fn_properties.errors) - raise PyScriptException(error_string) + raise PyScriptException(errors) + fn_properties = self.getFunctionProperties(fn) return sample.Sample(fn_properties.inputs, fn_properties.outputs) - diff --git a/src/pydefx/pystudy.py b/src/pydefx/pystudy.py index 7b22f72..deb9a0d 100644 --- a/src/pydefx/pystudy.py +++ b/src/pydefx/pystudy.py @@ -36,7 +36,7 @@ def prepareDirectoryForLaunch(sample, result_directory, nb_branches, script, sample : Sample type result_directory : path to a result working directory. nb_branches : int - script : string + script : script / pyscript type return: extra_in_files: list of files to add to salome_parameters.in_files yacs_schema_path: path to the yacs schema (xml file). @@ -44,7 +44,8 @@ def prepareDirectoryForLaunch(sample, result_directory, nb_branches, script, if sampleManager is None: sampleManager = defaultSampleManager() # export sample to result_directory - inputFiles = sampleManager.prepareRun(sample, result_directory) + inputFiles = sampleManager.prepareRun(script, sample, result_directory) + # export nbbranches configpath = os.path.join(result_directory, "idefixconfig.json") dicconfig = {} @@ -55,7 +56,7 @@ def prepareDirectoryForLaunch(sample, result_directory, nb_branches, script, json.dump(dicconfig, f, indent=2) studypath = os.path.join(result_directory, "idefixstudy.py") with open(studypath, "w") as f: - f.write(script) + f.write(script.script) # find generic schema filename = inspect.getframeinfo(inspect.currentframe()).filename install_directory = pathlib.Path(filename).resolve().parent @@ -77,7 +78,7 @@ class PyStudy: def createNewJob(self, script, sample, params, sampleManager=None): """ Create a new job out of those parameters: - script : string + script : script / pyscript type sample : sample to be evaluated (Sample class) params : job submission parameters (Parameters class) The result directory will contain all the files needed for a launch and a diff --git a/src/pydefx/samplecsvmanager.py b/src/pydefx/samplecsvmanager.py index 2730b80..d626b40 100644 --- a/src/pydefx/samplecsvmanager.py +++ b/src/pydefx/samplecsvmanager.py @@ -28,9 +28,13 @@ class SampleManager: def __init__(self): pass - def prepareRun(self, sample, directory): + def prepareRun(self, script, sample, directory): """ Create a dump of the sample in the given directory. + script: PyScript object. + sample: Sample object. + directory: path to a local working directory where all the working files are + copied. This directory should be already created. Return a list of files to add to the input files list of the job. """ datapath = os.path.join(directory, SampleIterator.DATAFILE) @@ -40,10 +44,10 @@ class SampleManager: quoting=csv.QUOTE_NONNUMERIC ) writer.writeheader() writer.writerows(sample.inputIterator()) - + outnamespath = os.path.join(directory, SampleIterator.OUTPUTNAMESFILE) with open(outnamespath, 'w') as outputfile: - for v in sample.getOutputNames(): + for v in script.getOutputNames(): outputfile.write(v+'\n') filename = inspect.getframeinfo(inspect.currentframe()).filename install_directory = pathlib.Path(filename).resolve().parent diff --git a/src/pyexample/scenario.py b/src/pyexample/scenario.py index a7b1ed4..41a20cd 100644 --- a/src/pyexample/scenario.py +++ b/src/pyexample/scenario.py @@ -2,9 +2,10 @@ import pydefx import os -myParams = pydefx.Parameters(resource="localhost",nb_branches=2); -#wd = os.path.join(myParams.salome_parameters.work_directory, "minifixtest") -#myParams.salome_parameters.local_directory = "/toto/titi/tata" +myParams = pydefx.Parameters(); +myParams.configureResource("localhost") +myParams.createResultDirectory("/tmp") +myParams.nb_branches = 2 myScript = pydefx.PyScript() myScript.loadFile("scenario_study.py") @@ -17,5 +18,6 @@ mySample.setInputValues({ "x":[0.1, 0.2, 0.3, 0.4, 0.5], "y":[1.0, 2.0, 3.0, 4.0, 5.0], "z":["a", "b", "c", "d", "e"]}) -myStudy = pydefx.PyStudy(myScript.script, mySample, myParams) -myStudy.run() +myStudy = pydefx.PyStudy() +myStudy.createNewJob(myScript, mySample, myParams) +myStudy.launch() diff --git a/src/pyexample/temposcen.py b/src/pyexample/temposcen.py index 71d2f9f..573739f 100644 --- a/src/pyexample/temposcen.py +++ b/src/pyexample/temposcen.py @@ -29,7 +29,7 @@ myParams = myStudy.createDefaultParameters(resource="localhost"); wd = os.path.join(myParams.salome_parameters.work_directory, "minifixtest") myParams.salome_parameters.work_directory = wd -myStudy.createNewJob(myScript.script, mySample, myParams) +myStudy.createNewJob(myScript, mySample, myParams) myStudy.launch() print(myStudy.getJobState()) diff --git a/src/pyexample/tests1.py b/src/pyexample/tests1.py index 78cb03f..e2d5676 100644 --- a/src/pyexample/tests1.py +++ b/src/pyexample/tests1.py @@ -18,7 +18,7 @@ mydata = {"a":[1.1, 2.2, 3.4, 5.5], mySample.setInputValues(mydata) myStudy = pydefx.PyStudy() -myStudy.createNewJob(myScript.script, mySample, myParams) +myStudy.createNewJob(myScript, mySample, myParams) print(myStudy.getProgress()) myStudy.launch() print(myStudy.getJobState()) diff --git a/src/pyexample/tests2.py b/src/pyexample/tests2.py index 829e421..7e22413 100644 --- a/src/pyexample/tests2.py +++ b/src/pyexample/tests2.py @@ -18,7 +18,7 @@ mydata = {"a":[1.1, 2.2, 3.4, 5.5], mySample.setInputValues(mydata) myStudy = pydefx.PyStudy() -myStudy.createNewJob(myScript.script, mySample, myParams) +myStudy.createNewJob(myScript, mySample, myParams) myStudy.launch() strdmp= myStudy.dump()