Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions gwsumm/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def __init__(self, universe, tag='gw_summary',
logdir, '%s-%s.err' % (tag, self.logtag)))
self.set_stdout_file(os.path.join(
logdir, '%s-%s.out' % (tag, self.logtag)))
cmds.setdefault('getenv', 'True')
for key, val in cmds.items():
if hasattr(self, 'set_%s' % key.lower()):
getattr(self, 'set_%s' % key.lower())(val)
Expand Down Expand Up @@ -491,7 +490,18 @@ def main(args=None):
)
for cmd_ in args.condor_command:
(key, value) = cmd_.split('=', 1)
condorcmds[key.rstrip().lower()] = value.strip()
# TODO: the next lines either add the key-value to the condorcmds
# dictionary or they *append* the value to the existing value already
# in the condorcmds dictionary. It's not a preferred solution, but
# the reason it is done this way is because of the way the
# LIGO summary pages configuration scripts work (the echo_and_run
# command). We would need to decide if the scripts or function
# should be rewritten
if key in condorcmds:
logger.debug(f"Appending {value.strip()} to condor '{key}' value")
condorcmds[key] += f" {value.strip()}"
else:
condorcmds[key.rstrip().lower()] = value.strip()

# Use scitokens
condorcmds['use_oauth_services'] = 'scitokens'
Expand Down Expand Up @@ -532,6 +542,10 @@ def main(args=None):
if not condorcmds['environment'].endswith('"'):
condorcmds['environment'] = f"{condorcmds['environment']}\""

# Environment variables from the access point
envvars = ('DEFAULT_SEGMENT_SERVER, GWDATAFIND_SERVER, NDSSERVER, '
'CONDA_EXE')

# -- build individual gw_summary jobs -----------

globalconfig = ','.join(args.global_config)
Expand All @@ -540,12 +554,16 @@ def main(args=None):
if not args.skip_html_wrapper:
htmljob = GWSummaryJob(
'local', subdir=outdir, logdir=logdir,
tag=f'{args.file_tag}_local', **condorcmds)
tag=f'{args.file_tag}_local', **condorcmds,
getenv=envvars,
)
jobs.append(htmljob)
if not args.html_wrapper_only:
datajob = GWSummaryJob(
universe, subdir=outdir, logdir=logdir,
tag=args.file_tag, **condorcmds)
tag=args.file_tag, **condorcmds,
getenv=envvars,
)
jobs.append(datajob)

# add common command-line options
Expand Down
2 changes: 1 addition & 1 deletion gwsumm/data/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def _get_timeseries_dict(channels, segments, config=None,
if nds is None and cache is not None:
nds = False
elif nds is None:
nds = 'LIGO_DATAFIND_SERVER' not in os.environ
nds = 'GWDATAFIND_SERVER' not in os.environ

# read new data
query &= (abs(new) > 0)
Expand Down
3 changes: 3 additions & 0 deletions gwsumm/tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def test_main(tmpdir, caplog):
'--maxjobs', '5',
'--condor-timeout', '3',
'--condor-command', 'notification=false',
'--condor-command', 'environment=VAR1=VAL1',
'--condor-command', 'environment=VAR2=VAL2',
'--config-file', k1test,
'--global-config', global_,
'--nds',
Expand All @@ -69,6 +71,7 @@ def test_main(tmpdir, caplog):
# test log output
batch.main(args)
assert "Copied all INI configuration files to ./etc" in caplog.text
assert "Appending VAR2=VAL2 to condor 'environment' value" in caplog.text
assert " -- Configured HTML htmlnode job" in caplog.text
assert " -- Configured job for config {}".format(
os.path.join(outdir, "etc", os.path.basename(k1test))) in caplog.text
Expand Down
Loading