bmtool 0.5.6.1__tar.gz → 0.5.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {bmtool-0.5.6.1 → bmtool-0.5.7}/PKG-INFO +1 -1
  2. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/SLURM.py +55 -8
  3. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/synapses.py +17 -1
  4. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/PKG-INFO +1 -1
  5. {bmtool-0.5.6.1 → bmtool-0.5.7}/setup.py +1 -1
  6. {bmtool-0.5.6.1 → bmtool-0.5.7}/LICENSE +0 -0
  7. {bmtool-0.5.6.1 → bmtool-0.5.7}/README.md +0 -0
  8. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/__init__.py +0 -0
  9. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/__main__.py +0 -0
  10. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/bmplot.py +0 -0
  11. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/connectors.py +0 -0
  12. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/debug/__init__.py +0 -0
  13. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/debug/commands.py +0 -0
  14. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/debug/debug.py +0 -0
  15. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/graphs.py +0 -0
  16. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/manage.py +0 -0
  17. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/plot_commands.py +0 -0
  18. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/singlecell.py +0 -0
  19. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/util/__init__.py +0 -0
  20. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/util/commands.py +0 -0
  21. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/util/neuron/__init__.py +0 -0
  22. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/util/neuron/celltuner.py +0 -0
  23. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool/util/util.py +0 -0
  24. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/SOURCES.txt +0 -0
  25. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/dependency_links.txt +0 -0
  26. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/entry_points.txt +0 -0
  27. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/requires.txt +0 -0
  28. {bmtool-0.5.6.1 → bmtool-0.5.7}/bmtool.egg-info/top_level.txt +0 -0
  29. {bmtool-0.5.6.1 → bmtool-0.5.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.5.6.1
3
+ Version: 0.5.7
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -2,6 +2,7 @@ import time
2
2
  import os
3
3
  import subprocess
4
4
  import json
5
+ import requests
5
6
 
6
7
 
7
8
  def check_job_status(job_id):
@@ -18,9 +19,9 @@ def check_job_status(job_id):
18
19
  result = subprocess.run(['scontrol', 'show', 'job', job_id], capture_output=True, text=True)
19
20
  if result.returncode != 0:
20
21
  # this check is not needed if check_interval is less than 5 min (~300 seconds)
21
- #if 'slurm_load_jobs error: Invalid job id specified' in result.stderr:
22
- # return 'COMPLETED' # Treat invalid job ID as completed because scontrol expires and removed job info when done.
23
- raise Exception(f"Error checking job status: {result.stderr}")
22
+ if 'slurm_load_jobs error: Invalid job id specified' in result.stderr:
23
+ return 'COMPLETED' # Treat invalid job ID as completed because scontrol expires and removed job info when done.
24
+ #raise Exception(f"Error checking job status: {result.stderr}")
24
25
 
25
26
  job_state = None
26
27
  for line in result.stdout.split('\n'):
@@ -57,6 +58,20 @@ def submit_job(script_path):
57
58
  return job_id
58
59
 
59
60
 
61
+ def send_teams_message(webhook,message):
62
+ # Message payload
63
+ message = {
64
+ "text": f"{message}"
65
+ }
66
+
67
+ # Send POST request to trigger the flow
68
+ response = requests.post(
69
+ webhook,
70
+ json=message, # Using 'json' instead of 'data' for automatic serialization
71
+ headers={'Content-Type': 'application/json'}
72
+ )
73
+
74
+
60
75
  class seedSweep:
61
76
  def __init__(self, json_file_path, param_name):
62
77
  """
@@ -239,6 +254,25 @@ export OUTPUT_DIR={case_output_dir}
239
254
  if status not in self.status_list:
240
255
  return False
241
256
  return True
257
+
258
+ def check_block_completed(self):
259
+ # Implement this method to check if all jobs are completed
260
+ # This should return True only if all jobs are in the COMPLETED state
261
+ for job_id in self.job_ids:
262
+ status = check_job_status(job_id)
263
+ if status != 'COMPLETED': # can add PENDING here for debugging NOT FOR ACTUALLY USING IT
264
+ return False
265
+ return True
266
+
267
+
268
+ def check_block_running(self):
269
+ # Implement this method to check if all jobs are completed
270
+ # This should return True only if all jobs are in the COMPLETED state
271
+ for job_id in self.job_ids:
272
+ status = check_job_status(job_id)
273
+ if status != 'RUNNING': #
274
+ return False
275
+ return True
242
276
 
243
277
 
244
278
  class SequentialBlockRunner:
@@ -251,11 +285,12 @@ class SequentialBlockRunner:
251
285
  param_values (list): List of values for the parameter to be modified.
252
286
  """
253
287
 
254
- def __init__(self, blocks, json_editor=None, param_values=None, check_interval=200):
288
+ def __init__(self, blocks, json_editor=None, param_values=None, check_interval=200,webhook=None):
255
289
  self.blocks = blocks
256
290
  self.json_editor = json_editor
257
291
  self.param_values = param_values
258
292
  self.check_interval = check_interval
293
+ self.webhook = webhook
259
294
 
260
295
  def submit_blocks_sequentially(self):
261
296
  """
@@ -283,12 +318,24 @@ class SequentialBlockRunner:
283
318
  # Submit the block
284
319
  print(f"Submitting block: {block.block_name}", flush=True)
285
320
  block.submit_block()
286
-
321
+ if self.webhook:
322
+ message = f"SIMULATION UPDATE: Block {i} has been submitted! There are {(len(self.blocks)-1)-i} left to be submitted"
323
+ send_teams_message(self.webhook,message)
324
+
325
+ time.sleep(self.check_interval)
287
326
  # Wait for the block to complete
288
- while not block.check_block_status():
289
- print(f"Waiting for block {block.block_name} to complete...", flush=True)
290
- time.sleep(self.check_interval)
327
+ if i == len(self.blocks): # we want to wait for the last block to be completed not just running
328
+ while not block.check_block_completed():
329
+ print(f"Waiting for the last block {i} to complete...")
330
+ time.sleep(self.check_interval)
331
+ else: # Not the last block so if job is running lets start a new one (checks status list)
332
+ while not block.check_block_status():
333
+ print(f"Waiting for block {i} to complete...")
334
+ time.sleep(self.check_interval)
291
335
 
292
336
  print(f"Block {block.block_name} completed.", flush=True)
293
337
  print("All blocks are done!",flush=True)
338
+ if self.webhook:
339
+ message = "SIMULATION UPDATE: Simulation are Done!"
340
+ send_teams_message(self.webhook,message)
294
341
 
@@ -55,10 +55,26 @@ class SynapseTuner:
55
55
  self.other_vars_to_record = other_vars_to_record
56
56
 
57
57
  if slider_vars:
58
- self.slider_vars = {key: value for key, value in self.synaptic_props.items() if key in slider_vars} # filters dict to have only the entries that have a key in the sliders var
58
+ # Start by filtering based on keys in slider_vars
59
+ self.slider_vars = {key: value for key, value in self.synaptic_props.items() if key in slider_vars}
60
+ # Iterate over slider_vars and check for missing keys in self.synaptic_props
61
+ for key in slider_vars:
62
+ # If the key is missing from synaptic_props, get the value using getattr
63
+ if key not in self.synaptic_props:
64
+ try:
65
+ # Get the alternative value from getattr dynamically
66
+ self.set_up_cell()
67
+ self.set_up_synapse()
68
+ value = getattr(self.syn,key)
69
+ print(value)
70
+ self.slider_vars[key] = value
71
+ except AttributeError as e:
72
+ print(f"Error accessing '{key}' in syn {self.syn}: {e}")
73
+
59
74
  else:
60
75
  self.slider_vars = self.synaptic_props
61
76
 
77
+
62
78
  h.tstop = general_settings['tstart'] + general_settings['tdur']
63
79
  h.dt = general_settings['dt'] # Time step (resolution) of the simulation in ms
64
80
  h.steps_per_ms = 1 / h.dt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.5.6.1
3
+ Version: 0.5.7
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name="bmtool",
9
- version='0.5.6.1',
9
+ version='0.5.7',
10
10
  author="Neural Engineering Laboratory at the University of Missouri",
11
11
  author_email="gregglickert@mail.missouri.edu",
12
12
  description="BMTool",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes