-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHPC_PBS_Header.py
More file actions
executable file
·71 lines (54 loc) · 2.13 KB
/
HPC_PBS_Header.py
File metadata and controls
executable file
·71 lines (54 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
'''
##################################################################
############################Preamble##############################
##################################################################
Author: Stephen A. Sefick Jr.
Last Update: 20160730
Python: Version 3.5 (Anaconda)
Purpose: This script produces a PBS header to be used with Torque/Moab qsub command. This script will prompt the user for input and write to script template.
Example usage:
Argument 1: Email for job status
e.g., [email protected]
Argument 2: Script name to write out
e.g., yourscript.sh
HPC_PBS_Header.py [email protected] yourscript.sh
##################################################################
##################################################################
##################################################################
##################################################################
#########################Example header###########################
##################################################################
#!/bin/sh
##choose queue
####PBS -q
##list - node are nodes: ppn are cpus per node: walltime=walltime
#PBS -l nodes=1:ppn=1,mem=10gb,walltime=30:00
##email
#PBS -M [email protected]
##send email abort; begin; end
#PBS -m ae
##job name
#PBS -N sra_test
##combine standard out and standard error
#PBS -j oe
##################################################################
##################################################################
##################################################################
'''
import sys
email = sys.argv[1]
output_file_name = sys.argv[2]
shebang = "#!/bin/bash"
nodes = input("number of nodes: ")
ppn = input("processors per node: ")
mem = input("memory per cpu: ")
walltime = input("Walltime (hh:mm:ss): ")
jobname = input("Job Name: ")
with open(output_file_name, "w") as out:
out.write("%s \n" % shebang)
out.write("#PBS -l nodes=%s:ppn=%s,mem=%s,walltime=%s \n" % (nodes, ppn, mem, walltime))
out.write("#PBS -M %s \n" % (email))
out.write("#PBS -m ae \n")
out.write("#PBS -N %s \n" % (jobname))
out.write("#PBS -j oe \n")