iridl / python-maprooms

Dash maprooms and tools
0 stars 4 forks source link

Eliminate import-time data loading #126

Open remicousin opened 2 years ago

remicousin commented 2 years ago

First we eliminated import-time data loading by introducing "dummy" callbacks that ignore their inputs. Then we eliminated those by initializing the app with a layout function instead of a layout. But that approach ended up making way more db queries than expected, so we reverted to calling the layout function (and thus loading data) at import time. Need to either stop the layout function from being called so many times, or revert to using dummy callbacks.

Affects subseasonal forecast and onset maprooms.

These callbacks ignore their input. If the technique I suggested for eliminating these from the seasonal maproom works, apply it here too.

_Originally posted by @aaron-kaplan in https://github.com/iridl/python-maprooms/pull/85#discussion_r910326879_

remicousin commented 2 years ago

Note that there is also a desire to get the number of admin levels from the config file rather than 3 hard-coded functions for 3 levels. Senegal has 4 levels so it can be a case study to have that work automatically for both Ethiopia (3) and Senegal (4).

remicousin commented 2 years ago

The only ones left are those associated with the multiple admin boundaries drawing issue.

aaron-kaplan commented 2 years ago

Is this problem really solved? I think we tried calling the layout function in each request as a way of eliminating these dummy callbacks without reading data at module import time, but we had to revert that change because it caused performance problems (more db queries than expected). So now we're reading data at import time again, and might have to bring the dummy callbacks back.

remicousin commented 2 years ago

Well.... there are no more dummy callbacks. That is what I meant to convey by closing this. If we need to bring them back, it's another problem. Or the same if you wish, but I was not aware enough to link the 2 problems.