From 557e883bb81f1fef2ffcf37c44f21521684b665a Mon Sep 17 00:00:00 2001 From: David Schultz Date: Thu, 17 Oct 2024 15:08:41 -0500 Subject: [PATCH] input and output files need to be in order, instead of a set's random order --- iceprod/core/exe.py | 22 +++++++++++----------- tests/core/exe_test.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iceprod/core/exe.py b/iceprod/core/exe.py index a66bd950..f77d6e3b 100644 --- a/iceprod/core/exe.py +++ b/iceprod/core/exe.py @@ -150,18 +150,18 @@ def scope_env(cfg: ConfigParser, obj: dict, upperenv: Optional[Env] = None, logg """ env: Env = { 'parameters': {}, - 'input_files': set(), - 'output_files': set(), - 'upper_input_files': set(), - 'upper_output_files': set(), + 'input_files': [], + 'output_files': [], + 'upper_input_files': [], + 'upper_output_files': [], 'environment': { 'OS_ARCH': '$OS_ARCH', } } if upperenv: env['parameters'].update(upperenv['parameters']) - env['upper_input_files'] = upperenv['input_files'] | upperenv['upper_input_files'] - env['upper_output_files'] = upperenv['output_files'] | upperenv['upper_output_files'] + env['upper_input_files'] = upperenv['input_files'] + upperenv['upper_input_files'] + env['upper_output_files'] = upperenv['output_files'] + upperenv['upper_output_files'] logger = logger if logger else logging.getLogger() @@ -183,15 +183,15 @@ def scope_env(cfg: ConfigParser, obj: dict, upperenv: Optional[Env] = None, logg if d['movement'] in ('input','both'): ret = downloadData(d, cfg=cfg, logger=logger) if ret: - env['input_files'].add(ret) + env['input_files'].append(ret) if d['movement'] in ('output','both'): ret = uploadData(d, cfg=cfg, logger=logger) if ret: - env['output_files'].add(ret) + env['output_files'].append(ret) # add input and output to parseable options - cfg.config['options']['input'] = ' '.join(d.local for d in (env['input_files'] | env['upper_input_files'])) - cfg.config['options']['output'] = ' '.join(d.local for d in (env['output_files'] | env['upper_output_files'])) + cfg.config['options']['input'] = ' '.join(d.local for d in (env['input_files'] + env['upper_input_files'])) + cfg.config['options']['output'] = ' '.join(d.local for d in (env['output_files'] + env['upper_output_files'])) logging.info('input: %r', cfg.config['options']['input']) logging.info('output: %r', cfg.config['options']['output']) @@ -598,7 +598,7 @@ def toStr(a): local=filename, transfer=Transfer.TRUE, ) - env['input_files'].add(data) + env['input_files'].append(data) self.infiles.add(data) # run the module diff --git a/tests/core/exe_test.py b/tests/core/exe_test.py index 27eaac59..0c25f77c 100644 --- a/tests/core/exe_test.py +++ b/tests/core/exe_test.py @@ -67,8 +67,8 @@ def test_scope_env(): # test parsing data with iceprod.core.exe.scope_env(c, t.dataset.config['tasks'][0], env) as tenv: - assert tenv['input_files'] == {Data('https://foo.bar/baz', 'baz', Transfer.TRUE)} - assert env['input_files'] == set() + assert tenv['input_files'] == [Data('https://foo.bar/baz', 'baz', Transfer.TRUE)] + assert env['input_files'] == [] def test_download_data():