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 check for existing file so it will default to downloading only if the file doesn't exist. #75

Open
Tylores opened this issue Mar 26, 2024 · 4 comments

Comments

@Tylores
Copy link

Tylores commented Mar 26, 2024

        if config.existing_feeder_file is None:
            if self._use_smartds:
                self._feeder_file = os.path.join("opendss", "Master.dss")
                self.download_data("oedi-data-lake", update_loadshape_location=True)
            elif not self._use_smartds and not self._user_uploads_model:
                self._feeder_file = os.path.join("opendss", "master.dss")
                self.download_data("gadal")
            else:
                # User should have uploaded model using endpoint
                raise Exception("Set existing_feeder_file when uploading data")
        else:
            self._feeder_file = config.existing_feeder_file
@josephmckinsey
Copy link
Contributor

If I'm understanding the suggestion, it would be something like if not _feeder_file.exists(): self.download_data(...)?

@Tylores
Copy link
Author

Tylores commented Mar 26, 2024

This is what I used to do and what was going to add the the issue, but got side tracked.

        if config.existing_feeder_file is None:
            if self._use_smartds:
                self._feeder_file = os.path.join("opendss", "Master.dss")
                self.download_data(
                    "oedi-data-lake", update_loadshape_location=True)
            else:
                self._feeder_file = os.path.join("opendss", "master.dss")
                self.download_data("gadal")
        elif not os.path.exists(config.existing_feeder_file):
            if self._use_smartds:
                self._feeder_file = os.path.join("opendss", "Master.dss")
                self.download_data(
                    "oedi-data-lake", update_loadshape_location=True)
            else:
                self._feeder_file = os.path.join("opendss", "master.dss")
                self.download_data("gadal")
        else:
            self._feeder_file = config.existing_feeder_file

@josephmckinsey
Copy link
Contributor

Ah, so existing_feeder_file would be more like feeder_file_cache?

@Tylores
Copy link
Author

Tylores commented Mar 26, 2024 via email

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

No branches or pull requests

2 participants