diff --git a/gwsumm/batch.py b/gwsumm/batch.py index 356f8ab9..4dba5a18 100644 --- a/gwsumm/batch.py +++ b/gwsumm/batch.py @@ -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) @@ -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' @@ -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) @@ -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 diff --git a/gwsumm/data/timeseries.py b/gwsumm/data/timeseries.py index fa970e4d..6d03ac0e 100644 --- a/gwsumm/data/timeseries.py +++ b/gwsumm/data/timeseries.py @@ -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) diff --git a/gwsumm/tests/test_batch.py b/gwsumm/tests/test_batch.py index 2ee9caf0..653d083d 100644 --- a/gwsumm/tests/test_batch.py +++ b/gwsumm/tests/test_batch.py @@ -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', @@ -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