NREL / buildstockbatch

Other
20 stars 13 forks source link

Create a check for HPC commands (e.g., eagle, kestrel) that is based on the HPC you are using BSB within #427

Open whiphi92 opened 5 months ago

whiphi92 commented 5 months ago

It would be a luxury to have a check on buildstock commands dependent on which HPC you are using. That is to say, a command like buildstock_eagle will not run if you are logged into Kestrel.

This is not high priority, but would be a nice thing to have for us users who still have the muscle memory of typing buildstock_eagle.

rajeee commented 5 months ago

For reference, the current behavior when using buildstock_eagle in kestrel is this:

(bsb_dev) [radhikar@kl1 project_national]$ buildstock_eagle --validateonly national_baseline.yml 

     _ __         _     __,              _ __
    ( /  )    o  //   /(    _/_       / ( /  )     _/_    /
     /--< , ,,  // __/  `.  /  __ _, /<  /--< __,  /  _, /
    /___/(_/_(_(/_(_/_(___)(__(_)(__/ |_/___/(_/(_(__(__/ /_
      Executing BuildStock projects with grace since 2018

Starting BSB Jan 2
INFO:2024-01-24 10:54:35:buildstockbatch.base:Base Validation Successful
Traceback (most recent call last):
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 91, in validate_apptainer_image_hpc
    cls.get_apptainer_image(
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 124, in get_apptainer_image
    raise RuntimeError(f"Could not find apptainer image: {' or '.join(map(str, image_paths))}")
RuntimeError: Could not find apptainer image: /shared-projects/buildstock/singularity_images/OpenStudio-3.7.0.d5269793f1-Apptainer.sif or /shared-projects/buildstock/singularity_images/OpenStudio-3.7.0.d5269793f1-Singularity.simg

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/radhikar/my_bsb_envs/bsb_dev/bin/buildstock_eagle", line 8, in <module>
    sys.exit(eagle_cli())
             ^^^^^^^^^^^
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 834, in eagle_cli
    user_cli(EagleBatch, argv)
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 895, in user_cli
    Batch.validate_project(project_filename)
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 763, in validate_project
    super(cls, cls).validate_project(project_file)
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 83, in validate_project
    cls.validate_apptainer_image_hpc(project_file)
  File "/home/radhikar/buildstockbatch/buildstockbatch/hpc.py", line 97, in validate_apptainer_image_hpc
    raise ValidationError(str(err))
buildstockbatch.exc.ValidationError: Could not find apptainer image: /shared-projects/buildstock/singularity_images/OpenStudio-3.7.0.d5269793f1-Apptainer.sif or /shared-projects/buildstock/singularity_images/OpenStudio-3.7.0.d5269793f1-Singularity.simg