Closed missyschoenbaum closed 7 years ago
I am having a legacy save issue. I could be that I am failing to get a status message, as I was using Texas and it is large.
Steps to recreate - Created new scenario when to Project panel, selected Import NAADSM Legacy Scenario Page to upload appeared I selected my parameter and pop files I hit apply, which then becomes inactive
So, it is not clear what my status is here - I could see it would take a long time to load Texas, but don't have any clue what is happening.
Another possibility for weirdness here - I am using xml straight from an SC run, not an export from NAADSM. I don't know if they would be different.
Definitely worth looking into in the next sprint. I'd say there's a 90% chance it's working but there's no progress bar implemented and the import is so huge it could take > 30 minutes. If that's the case then it can be fixed with progress bar and better xml2sqlite performance, which we've been talking about.
I did pull up an empty scenario and load Texas, because I wanted to see how labels looked. It loaded in 31 minutes or less. I wasn't watching it closely, so I didn't capture the exact time.
Also, just the fact that it loads Texas and doesn't take down the app is an accomplishment!
In my mind, there's a big difference between importing a population from within an existing blank scenario and importing NAADSM XML (which requires population). Are you saying you were able to pull in all your old parameters? If so, that's an impressive stress test, even if it is slow.
No, I didn't get it to work on the legacy import screen. I just made a new scenario and pulled in the population only. I asked Michelle about her legacy import, and she was successful so I think we have more of a progress bar problem than an import problem.
This is definitely a good place for a progress bar. Though progress bars are one of those things that are WAAAAY harder than you would think they should be: http://xkcd.com/612/ http://xkcd.com/1425/
@ndh2 Hi Neil, this seems to be the closest issue to our hangouts discussions on XML2SQLite performance. We did some profiling on the import process and it is indeed dog slow for non-trivial cases.
sqlite "commit" method takes up over 85% of the total time. That means that waiting and performing on database modifications is essentially the entire problem. I have a fully parameterized example from Shaun with 2,727 units in it. Unit import (using bulk create already) takes a couple seconds. Parameter import takes upwards of 30 minutes on the same file. Essentially, bulk create needs to be used to build the parameter models in batch starting around xml2sqlite.py:400.
There's good news. I think that Relational and Probability Functions account for the bulk of all parameter content. If you can write a bulk create that sweeps through Functions and creates all of them first, that covers most all of your dependencies. Then you can go back through and probably build the rest of the models normally. At least Functions will be the biggest bang for your buck in terms of development time.
Related: #459 and #576
@ndh2 I seem to be getting the same error message every time I try to Import NAADSM Legacy Scenario. This is in Beta 3.3.5.13. Any ideas what could be wrong?
@josiahseaman or @tjmahlin? The above looks to me like a file missing from a Bootstrap theme.
Going to be posting some notes on bulk create to this thread. (No replies needed — just me thinking out loud.)
The script makes heavy use of create_no_duplicates, which calls get_or_create, which does an automatic save. So I will probably need to write a no-save version of get_or_create.
Question: does the "get" part of "get_or_create" examine in-memory objects (created but not yet saved to DB)?
Answer: get_or_create() is a database call that doesn't know about unsaved objects or unsaved changes. I suppose you could make your own warehouse of in-memory objects to check.
Commit dbdde3c provides a decent speedup for scenarios that are heavy on histogram or piecewise type PDFs.
Missy needs to test with Texas again. @lkholmstrom can test with a scenario heavy on histogram or piecewise type pdfs. This may be solved, as I have Texas up and running at the moment.
I have successfully loaded Texas again from scratch. I say we call this one good for now.
for RC5.2 build Steps to recreate open app select Open Select Import NAADSM Legacy Scenario Use the Choose File button to select a parameter file Use the Choose File button to select a population file: have image - Image may insert at the bottom
Select the Save changes button
get big yellow errror ValueError at /app/ImportScenario/ The view ADSMSettings.views.import_naadsm_scenario didn't return an HttpResponse object. It returned None instead. Request Method: POST Request URL: http://127.0.0.1:8000/app/ImportScenario/ Django Version: 1.7.1 Exception Type: ValueError Exception Value:
The view ADSMSettings.views.import_naadsm_scenario didn't return an HttpResponse object. It returned None instead. Exception Location: C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\django\core\handlers\base.py in get_response, line 130 Python Executable: C:\Users\meschoenbaum\Desktop\ADSM_4_10\adsm.exe Python Version: 3.4.2 Python Path:
['C:\Users\meschoenbaum\Desktop\ADSM_4_10\adsm.exe', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\adsm.zip', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\library.zip', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\src', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\DLLs', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\plat-win', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\lib-tk', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\bin', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Scripts', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\cx_Freeze-4.3.4-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\numpy-1.9.1-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\pip-1.5.6-py3.4.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\pywin32-219-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_4_10\src'] Server time: Mon, 13 Apr 2015 16:05:56 +0000
Environment:
Request Method: POST Request URL: http://127.0.0.1:8000/app/ImportScenario/
Django Version: 1.7.1 Python Version: 3.4.2 Installed Applications: ('ScenarioCreator', 'Results', 'ADSMSettings', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'floppyforms', 'crispy_forms', 'productionserver') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'ADSMSettings.disable.DisableCSRF')
Traceback: File "C:\Users\meschoenbaum\Desktop\ADSM_4_10\Lib\site-packages\django\core\handlers\base.py" in get_response
Exception Type: ValueError at /app/ImportScenario/ Exception Value: The view ADSMSettings.views.import_naadsm_scenario didn't return an HttpResponse object. It returned None instead. population_xml
<InMemoryUploadedFile: oldnaadsmpop.xml (text/xml)> parameters_xml
<InMemoryUploadedFile: oldnaadsm.xml (text/xml)>
wsgi.multiprocess
<_io.TextIOWrapper name='False wsgi.input
<cherrypy.wsgiserver.wsgiserver3.KnownLengthRFile object at 0x00000000095C1E48> HTTPACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/_;q=0.8' wsgi.errors