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
Dump and restore Stochastic Event Set #1300
Conversation
This branch should be refreshed |
Just refreshed |
The first thing that I do not like is that now a regular user gets the error: psycopg2.ProgrammingError: must be superuser to COPY to or from a file It should be possible to avoid that by using psycopg2 copy_expert functionality |
@@ -60,7 +59,7 @@ def _tuplestr(tup): | |||
class Copier(object): | |||
""" | |||
Small wrapper around a psycopg2 cursor, which a .copy method | |||
writing directly to .gz files. It remembers the copied filenames, | |||
writing directly to csv files. It remembers the copied filenames, | |||
which are stored in the attribute .filenames. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason why we are not generating .gz files? This makes a lot of difference in terms of disk space occupation. Notice that this tool is intended to be used even for large outputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This work is experimental. So, I did not want to add too many feature. I prefer at this moment to let the user zip or not zip the result. however, I see where you are coming from. Therefore, I have added a ticket https://bugs.launchpad.net/oq-engine/+bug/1248584
I have just addressed all the raised issues, including the permission ones (by using copy_expert as you suggested). Could you give it a look again? |
There is still something not working: $ bin/openquake --restore-hazard-calculation /tmp |
I get this error: Traceback (most recent call last): The fix is to change engine/settings.py and set the port to '5432' instead of ''. How comes it works on your machine? |
Then I get another error: |
help=("Restore a hazard calculation from a dump. " | ||
"Only SES outputs currently supported"), | ||
metavar=('DUMP_DIR')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After yesterday discussion, I think we should change the names to --save-hazard-calculation and --load-hazard-calculation. Paul and Matteo like those names better. Also restore_hazards.py and dump_hazards.py could be renamed.
I have renamed dump/restore -> save/load. I have added a proper migration script to fix permission problems. |
Notice that there is still the issue with the port number in engine/settings.py. Moreover I cannot dump Miriam's computation: $ bin/openquake --shc 1 /tmp/ You should also refresh the branch from master. |
I have just fixed the issue with inputs having ground motion fields. I can't reproduce the problem you are experiencing (the one related to the settings.py). GMFs are currently unsupported, so now we skip processing them and warn the user properly. |
Hey Michele, look at the latest commit. I have also added support for gzip. |
I have an issue with the ALTER TABLE locking the original tables, but it is not a problem when loading a calculation on an user computer (there is a single user there) and the approach can be revised later on, when this feature will be used in the platform. So LGTM for now. |
Dump and restore Stochastic Event Set
Addresses https://bugs.launchpad.net/oq-engine/+bug/1247665
Additionally, I have changed the database permissions such that
oq_admin
is able to create temporary tables (used for the dump/restore workflow).For a clean diff, #1298 should land first