NREL / celavi

Codebase for the Circular Economy Lifecycle Assessment and VIsualization (CELAVI) modeling framework.
https://nrel.github.io/celavi/
GNU General Public License v3.0
9 stars 7 forks source link

unlink() method in diagnostic_viz has unexpected keyword argument #177

Closed tjlca closed 2 years ago

tjlca commented 2 years ago

The first run completed successfully. But plots generation at the end of first run caused some issues - statement - self.postprocess()

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy isetter(ilocs[0], value) Traceback (most recent call last): File "main.py", line 25, in Scenario(parser=PARSER) File "/lustre/eaglefs/projects/celavi/celavi/celavi/celavi/scenario.py", line 117, in init self.postprocess() File "/lustre/eaglefs/projects/celavi/celavi/celavi/celavi/scenario.py", line 519, in postprocess diagnostic_viz_counts.generate_plots() File "/lustre/eaglefs/projects/celavi/celavi/celavi/celavi/diagnostic_viz.py", line 160, in generate_plots Path(self.output_plot_filename).unlink(missing_ok=True) TypeError: unlink() got an unexpected keyword argument 'missing_ok'

rjhanes commented 2 years ago

So this isn't an issue with the YAML files; per the error code above, the problem is with line 160 in diagnostic_viz, specifically the unlink() method. The problematic keyword is hard-coded, not being read from either of the YAML files.

Looking at this stackoverflow post, this error will only be thrown if the Python version is less than 3.8. I'm running 3.8.10 locally which explains why I've never seen this before.

Has the Python version being used on Eagle been downgraded? I'm confused as to why we haven't seen this from the HPC runs in the past.

Options for resolving are: (1) Upgrade the Python version being used for HPC runs to >3.8 (2) If the Python version can't be upgraded to >3.8, then I think line 160 in diagnostic_viz can be safely commented out (locally only, for HPC runs - we want to keep that line in the repo). We revised the file naming convention a while back so unique plots are created using the scenario name and run number - so duplication/overwriting shouldn't be an issue.

tjlca commented 2 years ago

Yesterday i had an issue with the HPC. For some reason, my user disk space got filled. So I have to move all projects from the home folder to the projects folder. Currently CELAVI is located inside the CELAVI projects folder which has larger disk space.

After the shift, I had to reinstall celavi (pip install -e .) It installed fine but started throwing up this error. This may be an issue with the environment reinstallation of celavi. I will clean the environment and build it from scratch with the current version of python and hopefully this error will be resolved. Will let you know and thanks for looking into this.