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

update table columns/variables after a table has been modified #129

Open
stefancoe opened this issue Mar 5, 2018 · 2 comments
Open

update table columns/variables after a table has been modified #129

stefancoe opened this issue Mar 5, 2018 · 2 comments
Assignees

Comments

@stefancoe
Copy link
Contributor

For example, new households have been added to the households table as a result of relocation/transition. Those households go through hlcm and now have new building_ids. The columns that are added to the household table in variables_households.py do not get updated automatically. It seems like the clear_cached method on the table takes care of this. We probably want to clear the entire cache at the end of each simulation year to make sure that tables/columns/variables get updated. Also, sometimes this needs to happen within a simulation year so that the correct data is used for a subsequent step, such as wplcm.

@stefancoe stefancoe self-assigned this Mar 5, 2018
@hanase
Copy link
Collaborator

hanase commented Mar 6, 2018

Unfortunately, unlike opus, orca does not have a variable dependency tree that would be automatically updated depending on the specific change. One possibility is to set the cache argument to False, in which case that variable would be always recomputed. But that increases the run time.
If using the clear_cached method, I would even run it after each model (or group of related models). Maybe it would be worth thinking if it should be a responsibility of the model to cleanup after itself. E.g. each model could get a logical argument, say cleanup, and if it is True, it would call the clear_cached method.

@stefancoe
Copy link
Contributor Author

Yes- without knowing the dependency tree, it's hard to know which tables need to be updated. Plus, since additional dependencies could happen to support other models, it's impossible to know about dependencies that are not currently in place. So, the entire cache may have to be cleared often, which may mean its better to turn caching off. I'll add orca.clear_cached() to all models that change at least one table for now.

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