[cig-commits] commit: Add notes about database migration

Mercurial hg at geodynamics.org
Sun Jul 3 20:05:13 PDT 2011


changeset:   32:124444b75df2
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Sun Jul 03 19:45:39 2011 -0700
files:       database_migration
description:
Add notes about database migration


diff -r 13e1990eab66 -r 124444b75df2 database_migration
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/database_migration	Sun Jul 03 19:45:39 2011 -0700
@@ -0,0 +1,189 @@
+run
+
+  sqlite3 database
+
+and then paste in these commands.
+
+insert or replace into SeismoWebPortal_cluster ("id", "name", "url", "daemonCode", "lastAccess", "reportedStatus", "queueWaitTime", "ring", "order", "suFactor") values ("1", "Ranger", "http://www.tacc.utexas.edu/resources/hpc/#constellation", "ksil4d0z5jhegmyu", "2011-06-17 01:58:43.467396", "", "120", "10", "10", "1") ;
+
+--Delete CITerra
+
+delete from SeismoWebPortal_cluster where name="CITerra" ;
+
+insert or replace into SeismoWebPortal_specfem3dglobemesh ("id",
+    "name",
+    "nchunks",
+    "nproc_xi",
+    "nproc_eta",
+    "nex_xi_c",
+    "nex_eta_c",
+    "angular_width_eta",
+    "angular_width_xi",
+    "center_latitude",
+    "center_longitude",
+    "gamma_rotation_azimuth") values ("1", "Global 17s Nex=256", "6", "8", "8", "4", "4", "90", "90", "0", "0", "0") ;
+
+insert or replace into SeismoWebPortal_specfem3dglobemesh ("id",
+    "name",
+    "nchunks",
+    "nproc_xi",
+    "nproc_eta",
+    "nex_xi_c",
+    "nex_eta_c",
+    "angular_width_eta",
+    "angular_width_xi",
+    "center_latitude",
+    "center_longitude",
+    "gamma_rotation_azimuth") values ("2", "Global 19s Nex=224", "6", "4", "4", "7", "7", "90", "90", "0", "0", "0") ;
+
+insert or replace into SeismoWebPortal_specfem3dglobemesh ("id",
+    "name",
+    "nchunks",
+    "nproc_xi",
+    "nproc_eta",
+    "nex_xi_c",
+    "nex_eta_c",
+    "angular_width_eta",
+    "angular_width_xi",
+    "center_latitude",
+    "center_longitude",
+    "gamma_rotation_azimuth") values ("5", "Global 23s Nex=192", "6", "4", "4", "6", "6", "90", "90", "0", "0", "0") ;
+
+insert or replace into SeismoWebPortal_specfem3dglobemesh ("id",
+    "name",
+    "nchunks",
+    "nproc_xi",
+    "nproc_eta",
+    "nex_xi_c",
+    "nex_eta_c",
+    "angular_width_eta",
+    "angular_width_xi",
+    "center_latitude",
+    "center_longitude",
+    "gamma_rotation_azimuth") values ("7", "Global 27s Nex=160", "6", "4", "4", "5", "5", "90", "90", "0", "0", "0") ;
+
+
+To add s40rts, go into ~/www-data, run
+
+  source www-setup.sh
+  django-admin.py shell
+
+In the shell, run
+
+import SeismoWebPortal.models
+model=SeismoWebPortal.models.Specfem3DGlobeModel(name="s40rts")
+model.description="A global 3D mantle model [Ritsema et al., 2010] succeeding S20RTS with a higher resolution.  S40RTS uses transversely isotropic PREM as a background model and the 3D crustal model Crust2.0  [Bassin et al., 2000]. We use the PREM radial attenuation model when ATTENUATION is incorporated."
+model.save()
+SeismoWebPortal.models.BuiltIn.objects.create(obj=model)
+
+I had to do this with sqlite
+
+insert or replace into SeismoWebPortal_specfem3dglobemodel ("id",
+    "name",
+    "pathname",
+    "description",
+    "url") values ("28", "s40rts", "SeismoWebPortal/models/3D/s40rts.tgz", "A global 3D mantle model [Ritsema et al., 2010] succeeding S20RTS with a higher resolution.  S40RTS uses transversely isotropic PREM as a background model and the 3D crustal model Crust2.0  [Bassin et al., 2000]. We use the PREM radial attenuation model when ATTENUATION is incorporated.", "") ;
+
+and touched the file
+
+  ~/www-data/SeismoWebPortal/models/3D/s40rts.tgz
+
+Run
+
+  alter table SeismoWebPortal_specfem3dglobeparameters add column crust3D bool DEFAULT 1 ;
+
+to add "crust3D" to the parameters.  Run
+
+  alter table SeismoWebPortal_archivedrun add column SU_cost numeric(19, 10) DEFAULT -1 ;
+
+to add "SU_cost" to the archived runs.  Run
+
+  drop table SeismoWebPortal_mineosmodecatalog ;
+  drop table SeismoWebPortal_mineosmodel ;      
+  drop table SeismoWebPortal_mineosparameters ;
+
+  delete from SeismoWebPortal_archivedrun where parametersType_id=14 ;  
+
+to get rid of all of the Mineos stuff in the database, including the runs.  Run
+
+  alter table SeismoWebPortal_specfem3dglobeparameters add column model_name varchar(100) default ""
+
+to add a separate model_name parameter.
+
+import SeismoWebPortal.models as models
+
+for run in models.ArchivedRun.objects.all():
+    run.delete()  
+print models.ArchivedRun.objects.all().count()
+
+for run in models.Run.objects.all():
+    run.delete()  
+print models.Run.objects.all().count()
+
+# Delete many, but not all archived objects.
+
+for a in models.Archive.objects.all():
+    if a.objType.__str__()=="specfem3d globe parameters" or a.objType.__str__()=="mineos parameters" or a.objType.__str__()=="mineos model" or a.objType.__str__()=="mineos mode catalog":
+       a.delete()
+
+for a in models.Archive.objects.all():                     
+    if a.objType.__str__()=="specfem3d globe model":
+       if a.obj.name!="s20rts":
+          a.delete()
+
+for a in models.Archive.objects.all():                     
+    if a.objType.__str__()=="specfem3d globe mesh":
+       if a.obj.id>2 and a.obj.id!=5 and a.obj.id!=7:
+          a.delete()
+
+
+for a in models.Archive.objects.all():
+    print a.objType
+
+for job in models.Job.objects.all():
+    job.delete()  
+print models.Job.objects.all().count()
+
+for p in models.Specfem3DGlobeParameters.objects.all():
+    p.delete()
+print models.Specfem3DGlobeParameters.objects.all().count()
+
+
+
+for m in models.Specfem3DGlobeModel.objects.all():
+    if m.name!="s20rts":
+       m.delete()
+print models.Specfem3DGlobeModel.objects.all().count()
+
+for m in models.Specfem3DGlobeMesh.objects.all():
+    if m.id>2 and m.id!=5 and m.id!=7:
+       m.delete()
+print models.Specfem3DGlobeModel.objects.all().count()
+
+# Need to delete all of the builtin objects also
+
+for m in models.BuiltIn.objects.all():
+    if m.objType.name=="mineos mode catalog" or m.objType.name=="mineos model":
+       m.delete()
+    if m.objType.name=="specfem3d globe model" and m.objId!=1:
+       m.delete()
+
+
+
+for o in models.Ownership.objects.all():        
+    if o.objType.__str__().startswith("mineos"):
+       o.delete()
+
+for o in models.Ownership.objects.all():        
+    if o.objType.__str__()!="event" and o.objType.__str__()!="station list":
+        print o.objType, o.obj.name
+
+
+sqlite3 database
+
+
+insert or replace into SeismoWebPortal_specfem3dglobemodel ("id",
+    "name",
+    "pathname",
+    "description",
+    "url") values ("1", "default", "SeismoWebPortal/models/3D/default.tgz", "The earth model as provided in Specfem3D Globe", "") ;



More information about the CIG-COMMITS mailing list