Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example to test that matplotlib is not imported when netpyne/pyneuroml are #14

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified example/example.zip
Binary file not shown.
30 changes: 24 additions & 6 deletions example/example_dir/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,34 @@
"""


from netpyne import specs
from netpyne import sim
from netpyne import __version__ as version
from pyneuroml import pynml

import sys
import pkg_resources

print("Running example script to list Python packages...")
if __name__ == "__main__":
print("Running example script to list Python packages...")

with open("output.txt", "w") as f:
print(f"Python version is: {sys.version}", file=f)
print("Installed packages on NSG:", file=f)
dists = [str(d).replace(" ", "==") for d in pkg_resources.working_set]

# also check if netpyne/pyneuroml etc. cause importing matplotlib: we can't
# use matplotlib on NSG because the different mpi processes cause the same
# cache file to be read, which causes crashes
print("Checking if matplotlib loaded...")
print(f"Args are: {sys.argv}")
if sys.argv.count("-nogui") > 0:
print("nogui option found")

with open("output.txt", "w") as f:
print(f"Python version is: {sys.version}", file=f)
print("Installed packages on NSG:", file=f)
dists = [str(d).replace(" ", "==") for d in pkg_resources.working_set]
for i in dists:
print(i, file=f)
for k in sys.modules.keys():
if "matplotlib" in k:
print(f"matplotlib still loaded: {k}")

print("Done!")
print("Done!")
7 changes: 4 additions & 3 deletions example/testParam.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
toolId=OSBv2_EXPANSE_0_7_3
number_cores_=1
number_nodes_=1
tasks_per_node_=1
number_cores_=2
number_nodes_=2
tasks_per_node_=2
runtime_=0.5
nrnivmodl_o_=0
filename_=example.py
cmdlineopts_=-nogui