Skip to content

New issue with cosmosis campaign env varialbes #130

@jessmuir

Description

@jessmuir

I recently updated cosmosis to version 3.8 and have encountered a new error when using env variables with cosmosis campaign.

The yml and ini files I'm working with ran ok before I updated cosmosis. Unfortunately I'm not sure what the previous version was before I updated to 3.8, so I'm not sure exactly what change interfered with this.

My setup is that I have an ini files specifying a pipeline, where a 2pt_like module definition includes the line

%include scale_cuts/${SCALE_CUTS_FILE}

That bash varialbe is specified in a run definition in the campaign file, using

  # Fiducial 3x2pt lcdm data run.
  - name: 32pt_lcdm_fidsimy6
    base: ini_files/main_32pt.ini
    params:
    - pipeline.fast_slow = T
    - sampler = polychord
    env:
      # setting these here have the same effect as
      # defining bash variables in an job submission script
      DATA_VECTOR : sim_baseline_32_lcdm.fits
      SCALE_CUTS_FILE : scale_cut_file.ini

When run cosmosis-campaign, either attempting to do a test run or looking at available runs using cosmosis-campaign -l, I get the error:

(/Users/jmuir/workspace/cosmosis3/env) y6simruns$ cosmosis-campaign -l campaign_sim_xlens.yml
Traceback (most recent call last):
  File "/Users/jmuir/workspace/cosmosis3/env/bin/cosmosis-campaign", line 4, in <module>
    cosmosis.campaign.main(args)
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 816, in main
    runs, _ = parse_yaml_run_file(args.run_config)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 608, in parse_yaml_run_file
    inc_runs, inc_comps = parse_yaml_run_file(include_file)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 625, in parse_yaml_run_file
    runs[name] = build_run(name, run_dict, runs, components, output_dir, submission_info, output_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 417, in build_run
    params = Inifile(run_info["base"], print_include_messages=False, no_expand_vars=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/runtime/config.py", line 136, in __init__
    self.read(filename)
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/configparser.py", line 713, in read
    self._read(fp, filename)
  File "/Users/jmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/runtime/config.py", line 66, in _read
    raise ValueError(f"Tried to include non-existent file {filename}")
ValueError: Tried to include non-existent file scale_cuts/${SCALE_CUTS_FILE}

Perhaps a recent update to ini file parsing changed this behavior? As I said, this setup didn't cause problems before yesterday when I updated cosmosis?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions