Skip to content

Commit aababf8

Browse files
author
William Majoros
committed
update
1 parent 6797821 commit aababf8

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

ConfigFile.py

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# configFile=ConfigFile(filename)
1717
# value=configFile.lookup(key)
1818
# value=configFile.lookupOrDie(key)
19+
# list=configFile.lookupList(key,sep=", ")
1920
# Private methods:
2021
# self.load(filename)
2122
######################################################################
@@ -28,6 +29,11 @@ def __init__(self,filename):
2829
self.hash={}
2930
self.load(filename)
3031

32+
def lookupList(self,key,sep=", "):
33+
value=self.lookup(key)
34+
if(value is None): return value
35+
return value.split(sep)
36+
3137
def lookup(self,key):
3238
return self.hash[key]
3339

MatrixMarket.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# nextLine : string
2424
# Instance Methods:
2525
# MatrixMarket(filename)
26-
# nextGroup(self,colIndex)
26+
# nextGroup(self,colIndex) # returns array of records
2727
# getHeader()
2828
# Class Methods:
2929
# allGroups=loadFile(filename,colIndex)
@@ -65,7 +65,8 @@ def nextGroup(self,colIndex):
6565
if(len(fields)==0): return None
6666
if(prevID is None): prevID=int(fields[colIndex])
6767
if(colIndex>len(fields)-1):
68-
raise Exception("colIndex=",colIndex,"len(fields)=",len(fields))
68+
raise Exception("colIndex=",colIndex,"len(fields)=",
69+
len(fields))
6970
thisID=int(fields[colIndex])
7071
if(thisID!=prevID):
7172
self.nextLine=line

Pipe.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@
1212

1313
#=========================================================================
1414
# Attributes:
15-
# iter
15+
# iter = iterator for the subprocess lines
16+
# p = subprocess
1617
# Instance Methods:
1718
# pipe=Pipe(command)
1819
# line=pipe.readline()
20+
# close()
1921
# Class Methods:
2022
# output=Pipe.run(command)
2123
#=========================================================================
2224
class Pipe:
2325
"""Pipe reads output from a shell command"""
2426
def __init__(self,cmd):
25-
p=subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True,
27+
self.p=subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True,
2628
stderr=subprocess.STDOUT)
27-
self.iter=iter(p.stdout.readline, b'')
29+
self.iter=iter(self.p.stdout.readline, b'')
2830

31+
def close(self):
32+
self.p.terminate()
33+
2934
def readline(self):
3035
line=next(self.iter,None)
3136
if(line is None): return None

SlurmWriter.py

-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def writeArrayScript(self,slurmDir,jobName,maxParallel,moreSBATCH=""):
8888
"#",
8989
"#SBATCH --get-user-env",
9090
"#SBATCH -J "+jobName,
91-
"#SBATCH -A "+jobName,
9291
"#SBATCH -o "+slurmDir+"/outputs/%a.output",
9392
"#SBATCH -e "+slurmDir+"/outputs/%a.output",
9493
"#SBATCH --array=1-"+str(numJobs)+"%"+str(maxParallel),
@@ -115,7 +114,6 @@ def writeScript(self,slurmFile,outFile,jobName,command,moreSBATCH=""):
115114
"#",
116115
"#SBATCH --get-user-env",
117116
"#SBATCH -J "+jobName,
118-
"#SBATCH -A "+jobName,
119117
"#SBATCH -o "+outFile,
120118
"#SBATCH -e "+outFile,
121119
queue+moreSBATCH+"#",

template.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
#=========================================================================
3-
# Copyright (C)William H. Majoros (bmajoros@alumni.duke.edu)
3+
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
4+
# License (GPL) version 3, as described at www.opensource.org.
5+
# Copyright (C)2021 William H. Majoros <bmajoros@alumni.duke.edu>
46
#=========================================================================
57
from __future__ import (absolute_import, division, print_function,
68
unicode_literals, generators, nested_scopes, with_statement)

0 commit comments

Comments
 (0)