GreenScheduler / cats

CATS: the Climate-Aware Task Scheduler :cat2: :tiger2: :leopard:
https://greenscheduler.github.io/cats/
MIT License
47 stars 7 forks source link

Handle absence of parameter files gracefully or provide sensible defaults #76

Closed abhidg closed 2 months ago

abhidg commented 3 months ago

Currently, cats works fine if run from the git checkout as it finds config.yml and fixed_parameters.yml. When run out of tree, for example by using a pipx install, cats fails as it does not find parameter files.

Steps to reproduce:

$ cd <directory where cats is cloned>
$ pipx install .
$ cd <any other directory>
$ cats -d 5 --loc OX1 --jobinfo=cpus=2,gpus=0,memory=8,partition=CPU_partition
WARNING:root:config file not found
Traceback (most recent call last):
  File "/Users/abhidg/.local/bin/cats", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/__init__.py", line 285, in main
    args.jobinfo, expected_partition_names=config["partitions"].keys()
                                           ~~~~~~^^^^^^^^^^^^^^
KeyError: 'partitions'

Expected output:

cats should show a user-friendly error in this case and suggest a config file.

Other points:

If the fixed_parameters.yaml file is fixed and non-configurable by the user, then it makes sense to inline it in the carbonFootprint module. Data files can be installed through pyproject.toml, but this may not be needed for this use case.

abhidg commented 2 months ago

fixed_parameters.yaml is not used anymore