Skip to content

Commit eaa9686

Browse files
committed
fixes wip
1 parent 6dc1526 commit eaa9686

3 files changed

Lines changed: 26 additions & 5 deletions

File tree

netpyne_ui/mod_utils.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def is_loaded_mechanisms():
2626
return True
2727

2828

29-
def compileModMechFiles(compileMod, modFolder):
29+
def loadModMechFiles(compileMod, modFolder, forceRecompile=False):
3030
# Create Symbolic link
3131
if compileMod:
3232
modPath = os.path.join(str(modFolder), "x86_64")
@@ -39,6 +39,21 @@ def compileModMechFiles(compileMod, modFolder):
3939
os.chdir('..')
4040

4141
try:
42-
neuron.load_mechanisms(str(modFolder))
43-
except:
44-
raise
42+
owd = os.getcwd()
43+
modPath = os.path.join(str(modFolder), "x86_64")
44+
45+
if os.path.exists(modPath):
46+
if forceRecompile:
47+
shutil.rmtree(modPath)
48+
return
49+
50+
os.chdir(modFolder)
51+
subprocess.call(["nrnivmodl"])
52+
os.chdir('..')
53+
54+
try:
55+
neuron.load_mechanisms(str(modFolder))
56+
except:
57+
raise
58+
finally:
59+
os.chdir(owd)

netpyne_ui/netpyne_geppetto.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,12 @@ def importModel(self, modelParameters):
509509
# TODO: this must be integrated into the general lifecycle of "model change -> simulate"
510510
# Shouldn't be specific to Import
511511
sim.clearAll()
512-
512+
try:
513+
loadModMechFiles(modelParameters['compileMod'], modelParameters['modFolder'], modelParameters.get("forceRecompile", True))
514+
except Exception:
515+
message = "Error while importing/compiling mods"
516+
logging.exception(message)
517+
return utils.getJSONError(message, sys.exc_info())
513518
try:
514519
# Get Current dir
515520
owd = os.getcwd()

webapp/redux/middleware/middleware.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ export default (store) => (next) => (action) => {
392392
modFolder: 'mod',
393393
loadMod: false,
394394
compileMod: false,
395+
forceRecompile: false,
395396

396397
netParamsPath: '.',
397398
netParamsModuleName: tutName,

0 commit comments

Comments
 (0)