mitrefireline / simharness

An open-source Reinforcement Learning (RL) harness written in Python to work with SimFire for training agents to fight wildfires on real data.
https://fireline.mitre.org
Apache License 2.0
13 stars 1 forks source link

Type object 'FireSimulation' has no attribute 'supported_attributes' #5

Closed Nebreg3 closed 6 months ago

Nebreg3 commented 7 months ago

When running the code (with temporaly solution from Issue4 added) an exception appears. This is the complete log:

2024-04-18 23:14:51,301 WARNING deprecation.py:50 -- DeprecationWarning: `DirectStepOptimizer` has been deprecated. This will raise an error in the future!
/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/pydantic/_internal/_config.py:321: UserWarning: Valid config keys have changed in V2:
* 'allow_mutation' has been removed
  warnings.warn(message, UserWarning)
2024-04-18 23:14:53,219 WARNING deprecation.py:50 -- DeprecationWarning: `build_tf_policy` has been deprecated. This will raise an error in the future!
2024-04-18 23:14:53,223 WARNING deprecation.py:50 -- DeprecationWarning: `build_policy_class` has been deprecated. This will raise an error in the future!
2024-04-18 23:14:56,383 INFO worker.py:1612 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
2024-04-18 23:14:57,264 INFO main.py:296 -- Configuration files for this job can be found at /home/userlinux/Documents/simharness-dev/nfs/lslab2/fireline/simharness/experiments/2024-04-18_23-14-53/hydra_output.
2024-04-18 23:14:57,278 INFO layers.py:81 -- Saving LandFire data to: /home/userlinux/.simfire/landfire/2019/lf_120.52193_36.09493_120.47563370366066_36.04863370366067
Submitting job...                                                                                                                                                                 
Job submitted! Processing layers... ⏱️                                                                                                                                             
Checking status of job again in 5 seconds... 💤                                                                                                                                   
Most recent message is `US_200F13_19`                                                                                                                                             
Checking status of job again in 10 seconds... 💤                                                                                                                                  
Most recent message is `US_200F13_19`                                                                                                                                             
Checking status of job again in 15 seconds... 💤                                                                                                                                  
Most recent message is `Entering getISinfo()`                                                                                                                                     
Checking status of job again in 20 seconds... 💤                                                                                                                                  
Most recent message is `US_ELEV2020`                                                                                                                                              
Checking status of job again in 25 seconds... 💤                                                                                                                                  
Most recent message is `Start creating geotif`                                                                                                                                    
Checking status of job again in 30 seconds... 💤                                                                                                                                  
Most recent message is `Start creating geotif`                                                                                                                                    
Checking status of job again in 35 seconds... 💤                                                                                                                                  
Most recent message is `Start creating geotif`                                                                                                                                    
Checking status of job again in 40 seconds... 💤                                                                                                                                  
Most recent message is `Start creating geotif`                                                                                                                                    
Checking status of job again in 45 seconds... 💤                                                                                                                                  
Job complete! Getting path to .zip file... 🙏                                                                                                                                     
Downloading data as .zip file... 🤞                                                                                                                                               
Data written successfully to /home/userlinux/.simfire/landfire/2019/lf_120.52193_36.09493_120.47563370366066_36.04863370366067/lf_120.52193_36.09493_120.47563370366066_36.04863370366067.zip! 🎉
Job Status: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ [Total Duration: 03:53]
2024-04-18 23:18:51,016 INFO layers.py:81 -- Saving LandFire data to: /home/userlinux/.simfire/landfire/2019/lf_120.52193_36.09493_120.47563370366066_36.04863370366067
2024-04-18 23:18:51,204 INFO layers.py:81 -- Saving LandFire data to: /home/userlinux/.simfire/landfire/2019/lf_120.52193_36.09493_120.47563370366066_36.04863370366067
**Error executing job with overrides: []**
Traceback (most recent call last):
  File "/home/userlinux/Documents/simharness-dev/main.py", line 324, in <module>
    main()
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)

> File "/home/userlinux/Documents/simharness-dev/main.py", line 299, in main
>     algo_cfg = _build_algo_cfg(cfg)
>   File "/home/userlinux/Documents/simharness-dev/main.py", line 223, in _build_algo_cfg
>     env_settings, eval_settings, debug_settings, explor_cfg = _instantiate_config(cfg)
>   File "/home/userlinux/Documents/simharness-dev/main.py", line 207, in _instantiate_config
>     env_cls = getattr(import_module(env_module), env_cls)

  File "/home/userlinux/anaconda3/envs/sf/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed

> File "/home/userlinux/Documents/simharness-dev/simharness2/environments/__init__.py", line 1, in <module>
>     from simharness2.environments.fire_harness import (
>   File "/home/userlinux/Documents/simharness-dev/simharness2/environments/fire_harness.py", line 35, in <module>
>     SIMFIRE_ATTRIBUTES = FireSimulation.supported_attributes()
> AttributeError: type object 'FireSimulation' has no attribute 'supported_attributes'
afennelly-mitre commented 6 months ago

Hey @Nestor-UVE, the issue you are experiencing is actually related to simfire, not simharness. The FireSimulation class is defined here in the simfire repository.

The issue you are experiencing is related to code updates not being found in your environment's current version of simfire - I presume you have simfire <= 1.5.7. This commit in simfire adds the supported_attributes attribute.

afennelly-mitre commented 6 months ago

To resolve the issue you are experiencing, please update simfire to the latest version, or at the least, to version 1.5.8. This can be done with pip, but update the command below depending on your virtual environment setup:

pip install -U simfire
afennelly-mitre commented 6 months ago

This issue has been resolved by the updates to requirements.txt in commit https://github.com/mitrefireline/simharness/commit/56f92bd55aa2ac88a3bc29a9279ec4e77e44b5ac. Please update your virtual environment and let us know if you have any other issues, comments, concerns, questions, etc!

@Nestor-UVE, thank you for your patience while we got our fixes merged!