slurmthat 0.0.1__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.
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.4
2
+ Name: slurmthat
3
+ Version: 0.0.1
4
+ Requires-Dist: os
@@ -0,0 +1,48 @@
1
+ # slurmthat
2
+ #TJ in development
3
+
4
+ Group 21, CodeAstro 2026
5
+
6
+ This package creates and submits an sbatch .sh file on a user-inputed computer/computing system.
7
+
8
+ #Example of a bash script to launch a job
9
+
10
+ #!/bin/bash
11
+
12
+ #SBATCH --account=arcc
13
+
14
+ #SBATCH --qos=debug
15
+
16
+ #SBATCH --time=0-00:10:00
17
+
18
+ #SBATCH --nodes=1
19
+
20
+ #SBATCH --ntasks=24
21
+
22
+ #SBATCH --cpus-per-task=4
23
+
24
+ #SBATCH --mem-per-cpu=2G
25
+
26
+ #SBATCH --mail-user=cowboyjoe@uwyo.edu
27
+
28
+ #SBATCH --mail-type=BEGIN,END,FAIL
29
+
30
+ #SBATCH --get-user-env
31
+
32
+ export OMP_PROC_BIND=true
33
+
34
+ export OMP_PLACES=threads
35
+
36
+ export OMP_NUM_THREADS=32
37
+
38
+ module load miniconda3
39
+
40
+ module load gcc/14.2.0
41
+
42
+ srun echo "Start Job Process"
43
+
44
+ srun hostname
45
+
46
+ srun sleep 30
47
+ srun --cpu-bind=cores check-hybrid.gnu.pm
48
+ srun echo "End Job Process"
@@ -0,0 +1,11 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "slurmthat"
7
+ version = "0.0.1"
8
+
9
+ dependencies = [
10
+ "os",
11
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,70 @@
1
+ import os
2
+
3
+ class job:
4
+
5
+ def __init__(self, HPC=None, email=None, dir=None, job=None, partition=None,
6
+ account=None):
7
+ self.HPC = HPC
8
+ self.account = account
9
+ self.email = email
10
+ self.dir = dir
11
+ self.job = job
12
+ self.partition = partition
13
+ if self.dir is None:
14
+ self.dir = os.getcwd()
15
+ self.filename = os.path.join(self.dir, self.job + ".sh")
16
+
17
+ def write(self, fail=False, start=False, finish=False, out_file=None,
18
+ err_file=None, time=32, cpus=10, nodes=1, memory=48):
19
+ sh_filename = self.filename
20
+
21
+ with open(sh_filename, 'w') as f:
22
+ f.write('#!/bin/bash\n')
23
+ if self.account is not None:
24
+ f.write(f'#SBATCH --account={self.account}\n')
25
+ if self.email is not None:
26
+ f.write(f'#SBATCH --mail-user={self.email}\n')
27
+ f.write(f'#SBATCH --job-name={self.job}\n')
28
+ if self.partition is not None:
29
+ f.write(f'#SBATCH -p {self.partition}\n')
30
+
31
+ if fail and finish and start:
32
+ f.write('#SBATCH --mail-type=FAIL,END,BEGIN\n')
33
+ elif fail and start:
34
+ f.write('#SBATCH --mail-type=FAIL,BEGIN\n')
35
+ elif fail and finish:
36
+ f.write('#SBATCH --mail-type=FAIL,END\n')
37
+ elif start and finish:
38
+ f.write('#SBATCH --mail-type=BEGIN,END\n')
39
+ elif fail:
40
+ f.write('#SBATCH --mail-type=FAIL\n')
41
+ elif start:
42
+ f.write('#SBATCH --mail-type=BEGIN\n')
43
+ elif finish:
44
+ f.write('#SBATCH --mail-type=END\n')
45
+ if out_file is None:
46
+ out_file = f'{sh_filename.split('.sh')[0]}.out'
47
+ f.write(f'#SBATCH --output={out_file}\n')
48
+ if err_file is None:
49
+ err_file = f'{sh_filename.split('.sh')[0]}.err'
50
+ f.write(f'#SBATCH --error={err_file}\n')
51
+ f.write(f'''
52
+ #SBATCH --time={time}:00:00
53
+ #SBATCH --mem={memory}G
54
+ #SBATCH --cpus-per-task={cpus}
55
+ #SBATCH --nodes={nodes}\n
56
+ ''')
57
+ print(f'wrote .sh file to {sh_filename}')
58
+ return sh_filename
59
+ def add_line(self, line):
60
+ with open(self.filename, 'a') as f:
61
+ f.write(f'{line}\n')
62
+
63
+
64
+
65
+ def run(self, conda=None):
66
+ if conda is not None:
67
+ with open(self.filename, 'a') as f:
68
+ f.write('source ~/.bashrc\n')
69
+ f.write(f'conda activate {conda}\n')
70
+ os.system(f'sbatch {self.filename}')
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.4
2
+ Name: slurmthat
3
+ Version: 0.0.1
4
+ Requires-Dist: os
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ slurm.py
4
+ slurmthat.egg-info/PKG-INFO
5
+ slurmthat.egg-info/SOURCES.txt
6
+ slurmthat.egg-info/dependency_links.txt
7
+ slurmthat.egg-info/requires.txt
8
+ slurmthat.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ slurm