Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a helpful error message when subclassing and having netcdf conflict issues #240

Open
amoodie opened this issue Feb 7, 2022 · 1 comment
Assignees
Labels

Comments

@amoodie
Copy link
Member

amoodie commented Feb 7, 2022

Creating a custom subclass and using the preprocessor is complicated. Mostly, because creating the netcdf file has to be delayed until the job is assigned to a different thread (connection to netcdf is not pickle-able).

So, when you get the error

 Existing NetCDF4 output file in target output location: /.../job_000/pyDeltaRCM_output.nc

which is raised from here but actually called during the run command for the parallel job, and delivered to the user here on error, it can be pretty confusing.

I was tripped up because I forgot to pass **kwargs input to the subclass model, on to __init__ for the DeltaModel.

Two ways to help this:

  • improve the documentation: emphaize the importance of passing the kwargs in any subclass
  • raise a helpful warning about defer_output=True during creating parallel jobs, and so emphasizing again "Are you sure you passed **kwargs to DeltaModel instantiation in your subclass?"
@amoodie amoodie self-assigned this Feb 7, 2022
@amoodie
Copy link
Member Author

amoodie commented Apr 28, 2022

on the try-except for run() on the ParallelJob, could add something like

if isinstance(e, FileExistsError):
    raise FileExistsError(
        'File already exists in trying to run parallel '
        'jobs. Did you mean to set `defer_output=True` '
        'in your job configuration? '
        f'Original error is: {e}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant