Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'brianl/v1_18_bosco' into v1_18_bosco
Browse files Browse the repository at this point in the history
  • Loading branch information
djw8605 committed Aug 28, 2017
2 parents 4a8fef9 + 34b3d11 commit 2dd6a31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/scripts/blah.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

class BlahConfigParser(RawConfigParser, object):

def __init__(self, path='/etc/blah.config'):
def __init__(self, path='/etc/blah.config', defaults=None):
# RawConfigParser requires ini-style [section headers] but since
# blah.config is also used as a shell script we need to fake one
self.header = 'blahp'
with open(path) as f:
config = f.read()
vfile = StringIO(u'[%s]\n%s' % (self.header, config))

super(BlahConfigParser, self).__init__()
super(BlahConfigParser, self).__init__(defaults=defaults)
# TODO: readfp() is replaced by read_file() in Python 3.2+
self.readfp(vfile)

Expand Down
7 changes: 3 additions & 4 deletions src/scripts/pbs_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def qstat(jobid=""):
starttime = time.time()
log("Starting qstat.")
command = (qstat_bin, '-f')
if config.has_option('pbs_pro') and config.get('pbs_pro').lower() != 'yes':
if config.get('pbs_pro').lower() != 'yes':
command += ('-1',) # -1 conflicts with -f in PBS Pro
if jobid:
command += (jobid,)
Expand Down Expand Up @@ -358,8 +358,6 @@ def get_qstat_location():
if _qstat_location_cache != None:
return _qstat_location_cache

if not (config.has_option('pbs_binpath') and config.get('pbs_binpath')):
config.set('pbs_binpath', '/usr/bin')
cmd = 'echo "%s/%s"' % (config.get('pbs_binpath'), 'qstat')

child_stdout = os.popen(cmd)
Expand Down Expand Up @@ -528,7 +526,8 @@ def main():
jobid = jobid_arg.split("/")[-1].split(".")[0]

global config
config = blah.BlahConfigParser()
config = blah.BlahConfigParser(defaults={'pbs_pro': 'no',
'pbs_binpath': '/usr/bin'})

log("Checking cache for jobid %s" % jobid)
cache_contents = None
Expand Down
4 changes: 1 addition & 3 deletions src/scripts/slurm_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ def get_slurm_location(program):
if _slurm_location_cache != None:
return os.path.join(_slurm_location_cache, program)

if not (config.has_option('slurm_binpath') and config.get('slurm_binpath')):
config.set('slurm_binpath', '/usr/bin')
cmd = 'echo "%s/%s"' % (config.get('slurm_binpath'), 'scontrol')

child_stdout = os.popen(cmd)
Expand Down Expand Up @@ -499,7 +497,7 @@ def main():
jobid = jobid_arg.split("/")[-1].split(".")[0]

global config
config = blah.BlahConfigParser()
config = blah.BlahConfigParser(defaults={'slurm_binpath': '/usr/bin'})

log("Checking cache for jobid %s" % jobid)
cache_contents = None
Expand Down

0 comments on commit 2dd6a31

Please sign in to comment.