bmtool 0.5.6.2__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.
- {bmtool-0.5.6.2 → bmtool-0.5.7}/PKG-INFO +1 -1
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/SLURM.py +55 -8
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/PKG-INFO +1 -1
- {bmtool-0.5.6.2 → bmtool-0.5.7}/setup.py +1 -1
- {bmtool-0.5.6.2 → bmtool-0.5.7}/LICENSE +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/README.md +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/__init__.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/__main__.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/bmplot.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/connectors.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/debug/__init__.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/debug/commands.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/debug/debug.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/graphs.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/manage.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/plot_commands.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/singlecell.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/synapses.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/util/__init__.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/util/commands.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/util/neuron/__init__.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/util/neuron/celltuner.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool/util/util.py +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/SOURCES.txt +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/dependency_links.txt +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/entry_points.txt +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/requires.txt +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/bmtool.egg-info/top_level.txt +0 -0
- {bmtool-0.5.6.2 → bmtool-0.5.7}/setup.cfg +0 -0
@@ -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
|
-
|
22
|
-
|
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
|
-
|
289
|
-
|
290
|
-
|
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
|
|
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
|
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
|