def run(self): try: self.stdout = NeuronEngine.compile_modfiles(self.modelpath) except sp.CalledProcessError as err: self.stderr = err.output self.returncode = err.returncode inform('Error compiling modfiles:', self.stderr, indent=2) with working_dir(dirname(self.modelpath)): inform("Running %s on %s..." % (self.name, self.modelpath), indent=1) p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) cmd = '''\ %s ''' % ('\n'.join(self.extra_pars)) if sys.version_info[0]==3: c = dedent(cmd).encode() else: c = dedent(cmd) stdout, stderr = p.communicate(c) # with open('/tmp/omv_test.nrn.stdout', 'w') as f: # f.write(stdout) self.stdout = str(stdout.decode()) self.stderr = str(stderr.decode()) inform("OUT: %s"% self.stdout, verbosity=1, indent=2) inform("ERR: %s"% self.stderr, verbosity=1, indent=2) inform("returncode: [%s]"% p.returncode, verbosity=1, indent=2) self.returncode = p.returncode if self.returncode != 0: raise EngineExecutionError
def run(self): try: self.stdout = NeuronEngine.compile_modfiles(self.modelpath) except sp.CalledProcessError as err: self.stderr = err.output self.returncode = err.returncode inform('Error compiling modfiles:', self.stderr, indent=2) with working_dir(dirname(self.modelpath)): inform("Running %s on %s..." % (self.name, self.modelpath), indent=1) p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) cmd = '''\ %s ''' % ('\n'.join(self.extra_pars)) stdout, stderr = p.communicate(dedent(cmd)) # with open('/tmp/omv_test.nrn.stdout', 'w') as f: # f.write(stdout) self.stdout = stdout self.stderr = stderr inform("OUT: ", stdout, verbosity=1, indent=2) inform("ERR: ", stderr, verbosity=1, indent=2) inform("returncode: ", p.returncode, verbosity=1, indent=2) self.returncode = p.returncode if self.returncode is not 0: raise EngineExecutionError
def run(self): try: self.stdout = NeuronEngine.compile_modfiles(self.modelpath) except sp.CalledProcessError as err: self.stderr = err.output self.returncode = err.returncode inform('Error compiling modfiles:', self.stderr, indent=2) try: inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1) self.stdout = check_output(['python', self.modelpath, 'neuron'], cwd=os.path.dirname(self.modelpath)) self.returncode = 0 except sp.CalledProcessError as err: self.returncode = err.returncode self.stdout = err.output raise EngineExecutionError except Exception as err: inform("Another error with running %s: " % self.name, err, indent=1) self.returncode = -1 self.stdout = "???"
def run(self): try: self.stdout = NeuronEngine.compile_modfiles(self.modelpath) except sp.CalledProcessError as err: self.stderr = err.output self.returncode = err.returncode inform('Error compiling modfiles:', self.stderr, indent=2) try: inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1) self.stdout = check_output(['python', self.modelpath, 'neuron'], cwd=os.path.dirname(self.modelpath)) self.returncode = 0 except sp.CalledProcessError as err: self.returncode = err.returncode self.stdout = err.output raise EngineExecutionError except Exception as err: inform("Another error with running %s: "%self.name, err, indent=1) self.returncode = -1 self.stdout = "???"