diff --git a/schema/sdss5db/targetdb/load_table/targeting_generation/README.txt b/schema/sdss5db/targetdb/load_table/targeting_generation/README.txt index cc53e918..95486893 100644 --- a/schema/sdss5db/targetdb/load_table/targeting_generation/README.txt +++ b/schema/sdss5db/targetdb/load_table/targeting_generation/README.txt @@ -22,7 +22,8 @@ sdss5db=> select * from targetdb.version where robostrategy; 190 | eta-5 | eta-5 | f | t 194 | eta-8 | eta-8 | f | t 197 | eta-9 | eta-9 | f | t -(13 rows) + 216 | theta-1 | theta-1 | f | t + (14 rows) @@ -40,7 +41,7 @@ to a list of confSummary metadata (which gives the robostrategy plan that was in Note that 'v0.5.3' targeting generation was associated with zeta-1 which was never loaded into targetdb (and so has no version_pk) -we'll create a separeate targeting_generation v0.5.epsilon-7-core-0 to handle epsilon-7-core-0 +we'll create a separate targeting_generation v0.5.epsilon-7-core-0 to handle epsilon-7-core-0 But we'll keep it in the database because we released it in DR18 @@ -56,12 +57,18 @@ pk,label,first_release 6,v1.0.2,dr20 7,v1.0.3,dr20 8,v1.0.4,dr20 +9,v1.0.5,dr20 The mapping of targeting_generation to version_pk can be extracted from rsconfig: -gawk '$1~/\[Cartons\]/ {flag=1} $1=="version" && flag==1 {printf("%-30s %8s\n",FILENAME,$3); flag=0} ' ~/SDSSV/gitwork/rsconfig/etc/robostrategy-eta-?.cfg ~/SDSSV/gitwork/rsconfig/etc/robostrategy-zeta-?.cfg +gawk '$1~/\[Cartons\]/ + {flag=1} +$1=="version" && flag==1 + {printf("%-30s %8s\n",FILENAME,$3); + flag=0;} + ' ~/SDSSV/gitwork/rsconfig/etc/robostrategy-eta-?.cfg ~/SDSSV/gitwork/rsconfig/etc/robostrategy-zeta-?.cfg etc/robostrategy-eta-3.cfg 1.0.2 etc/robostrategy-eta-4.cfg 1.0.2 @@ -69,6 +76,8 @@ etc/robostrategy-eta-5.cfg 1.0.2 etc/robostrategy-eta-6.cfg 1.0.3 etc/robostrategy-eta-7.cfg 1.0.4 etc/robostrategy-eta-8.cfg 1.0.4 +etc/robostrategy-eta-9.cfg 1.0.4 +etc/robostrategy-theta-1.cfg 1.0.5 etc/robostrategy-zeta-0.cfg 0.5.2 etc/robostrategy-zeta-1.cfg 0.5.3 etc/robostrategy-zeta-2.cfg 0.5.4 @@ -89,8 +98,8 @@ generation_pk,version_pk | notes (not added to csv) 7,192 (eta-6, v1.0.3) 8,193 (eta-7, v1.0.4) 8,194 (eta-8, v1.0.4) -8,197 (eta-9, v1.0.4???????) - +8,197 (eta-9, v1.0.4) +9,216 (theta-1, v1.0.5) # now - populating the 'targeting_generation_to_carton.csv' file @@ -120,16 +129,19 @@ sdss5db=> select * from category; \copy (select pk,label from category) TO '/home/tdwelly/SDSSV/dr19/minidb/category.psv' with CSV header DELIMITER '|' -# we can actually ignore the categorry because the carton_pk is already linked to a category_pk in targetdb!! +# we can actually ignore the category because the carton_pk is already linked to a category_pk in targetdb!! declare -A TG_PK +#TG_LIST="0.5.2 0.5.3 0.5.5 1.0.2 1.0.3 1.0.4 1.0.5" +TG_LIST="1.0.5" TG_PK["0.5.2"]="3" TG_PK["0.5.3"]="4" TG_PK["0.5.5"]="5" TG_PK["1.0.2"]="6" TG_PK["1.0.3"]="7" TG_PK["1.0.4"]="8" +TG_PK["1.0.5"]="9" TG_PK["epsilon-7-core-0"]="2" TG_PK["0.plates"]="1" @@ -138,7 +150,7 @@ RSCONFIG=~/SDSSV/gitwork/rsconfig echo "generation_pk,carton_pk,rs_stage,rs_active" > $OUTFILE -for TG in "0.5.2" "0.5.3" "0.5.5" "1.0.2" "1.0.3" "1.0.4"; do +for TG in $TG_LIST; do gawk -v tg_pk="${TG_PK[${TG}]}" \ --field-separator='|' '\ ARGIND==1 {c_p=sprintf("%s#%s", $2, $3);pk[c_p]=$1;} \ @@ -219,7 +231,7 @@ printf("%s,%s,%s,%s\n",tg_pk,$1,stage,"true");} \ cp $OUTFILE ~/SDSSV/gitwork/sdssdb/schema/sdss5db/targetdb/load_table/targeting_generation/ - +# psql -h localhost -p 7502 -U sdss_user -d sdss5db \cd /home/dwelly/SDSSV/gitwork/sdssdb/schema/sdss5db/targetdb/load_table/targeting_generation # now do a test load into sandbox (replacing targetdb with sandbox) @@ -229,6 +241,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_temp ( label TEXT, first_release TEXT ); +TRUNCATE targeting_generation_temp; \copy targeting_generation_temp FROM 'targeting_generation.csv' WITH CSV HEADER; @@ -237,6 +250,7 @@ CREATE TABLE IF NOT EXISTS sandbox.targeting_generation ( label TEXT, first_release TEXT ); +TRUNCATE sandbox.targeting_generation; INSERT INTO sandbox.targeting_generation (pk, label, first_release) SELECT * FROM targeting_generation_temp ON CONFLICT DO NOTHING; @@ -249,9 +263,11 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_to_carton_temp ( rs_stage TEXT, rs_active BOOLEAN ); +TRUNCATE targeting_generation_to_carton_temp; \copy targeting_generation_to_carton_temp FROM 'targeting_generation_to_carton.csv' WITH CSV HEADER; + CREATE TABLE IF NOT EXISTS sandbox.targeting_generation_to_carton ( generation_pk INTEGER, carton_pk INTEGER, @@ -259,6 +275,8 @@ CREATE TABLE IF NOT EXISTS sandbox.targeting_generation_to_carton ( rs_active BOOLEAN ); +TRUNCATE sandbox.targeting_generation_to_carton; + INSERT INTO sandbox.targeting_generation_to_carton (generation_pk, carton_pk, rs_stage, rs_active) SELECT * FROM targeting_generation_to_carton_temp ON CONFLICT DO NOTHING; @@ -267,6 +285,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_to_version_temp ( generation_pk INTEGER, version_pk INTEGER ); +TRUNCATE targeting_generation_to_version_temp; \copy targeting_generation_to_version_temp FROM 'targeting_generation_to_version.csv' WITH CSV HEADER; @@ -274,6 +293,7 @@ CREATE TABLE IF NOT EXISTS sandbox.targeting_generation_to_version ( generation_pk INTEGER, version_pk INTEGER ); +TRUNCATE sandbox.targeting_generation_to_version; INSERT INTO sandbox.targeting_generation_to_version (generation_pk, version_pk) SELECT * FROM targeting_generation_to_version_temp ON CONFLICT DO NOTHING; @@ -282,6 +302,16 @@ INSERT INTO sandbox.targeting_generation_to_version (generation_pk, version_pk) # do some test queries: -sdss5db=> select c.pk,c.carton,v.plan,count(*),array_agg(tg.label),min(tg.first_release) from sandbox.targeting_generation_to_carton as tg2c join carton as c on tg2c.carton_pk = c.pk join targetdb.version as v on c.version_pk = v.pk join sandbox.targeting_generation as tg on tg2c.generation_pk = tg.pk where tg.first_release <= 'dr19' group by c.pk,c.carton,v.plan order by c.pk; +sdss5db=> select c.pk,c.carton,v.plan,count(*),array_agg(tg.label),min(tg.first_release) +from sandbox.targeting_generation_to_carton as tg2c +join carton as c + on tg2c.carton_pk = c.pk +join targetdb.version as v + on c.version_pk = v.pk +join sandbox.targeting_generation as tg + on tg2c.generation_pk = tg.pk +where tg.first_release >= 'dr20' +group by c.pk,c.carton,v.plan +order by c.pk; etc etc diff --git a/schema/sdss5db/targetdb/load_table/targeting_generation/load_targeting_generation.sql b/schema/sdss5db/targetdb/load_table/targeting_generation/load_targeting_generation.sql index 04de13cd..bcd720a7 100644 --- a/schema/sdss5db/targetdb/load_table/targeting_generation/load_targeting_generation.sql +++ b/schema/sdss5db/targetdb/load_table/targeting_generation/load_targeting_generation.sql @@ -4,6 +4,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_temp ( label TEXT, first_release TEXT ); +TRUNCATE targeting_generation_temp; \copy targeting_generation_temp FROM 'targeting_generation.csv' WITH CSV HEADER; @@ -17,6 +18,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_to_carton_temp ( rs_stage TEXT, rs_active BOOLEAN ); +TRUNCATE targeting_generation_to_carton_temp; \copy targeting_generation_to_carton_temp FROM 'targeting_generation_to_carton.csv' WITH CSV HEADER; @@ -28,6 +30,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS targeting_generation_to_version_temp ( generation_pk INTEGER, version_pk INTEGER ); +TRUNCATE targeting_generation_to_version_temp; \copy targeting_generation_to_version_temp FROM 'targeting_generation_to_version.csv' WITH CSV HEADER; diff --git a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation.csv b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation.csv index 7e13421d..b3ac21ea 100644 --- a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation.csv +++ b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation.csv @@ -7,3 +7,4 @@ pk,label,first_release 6,v1.0.2,dr20 7,v1.0.3,dr20 8,v1.0.4,dr20 +9,v1.0.5,dr20 diff --git a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_carton.csv b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_carton.csv index 158e7789..23e3ba80 100644 --- a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_carton.csv +++ b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_carton.csv @@ -1241,3 +1241,286 @@ generation_pk,carton_pk,rs_stage,rs_active 1,376,plates,true 1,377,plates,true 1,378,plates,true +9,1516,srd,true +9,1515,srd,true +9,1517,srd,true +9,1508,srd,true +9,1509,srd,true +9,1510,srd,true +9,1721,srd,true +9,1511,srd,true +9,1722,srd,true +9,1555,filler,true +9,1818,filler,true +9,1499,srd,true +9,1498,srd,true +9,1717,srd,true +9,1501,srd,true +9,1500,srd,true +9,1726,srd,true +9,1362,srd,false +9,1359,srd,false +9,1360,srd,false +9,1361,srd,false +9,1363,srd,false +9,1505,srd,true +9,1719,srd,true +9,1504,srd,true +9,1727,srd,true +9,1503,srd,true +9,1729,srd,true +9,1507,srd,true +9,1720,srd,true +9,1506,srd,true +9,1728,srd,true +9,1502,srd,true +9,1718,srd,true +9,1525,srd,true +9,1526,srd,true +9,1527,srd,true +9,1662,srd,true +9,1663,srd,true +9,1528,srd,true +9,1529,srd,true +9,1800,srd,true +9,1530,srd,true +9,1531,srd,true +9,1801,srd,true +9,1532,srd,true +9,1533,srd,true +9,1802,srd,true +9,1534,srd,true +9,1535,srd,true +9,1803,srd,true +9,1536,srd,true +9,1537,srd,true +9,1804,srd,true +9,1538,srd,true +9,1539,srd,true +9,1805,srd,true +9,1540,srd,true +9,1541,srd,true +9,1806,srd,true +9,1367,srd,true +9,1368,srd,true +9,1369,srd,true +9,1632,srd,true +9,1633,srd,true +9,1659,srd,true +9,1647,srd,true +9,1648,srd,true +9,1649,srd,true +9,1667,srd,true +9,1651,srd,true +9,1652,srd,true +9,1653,srd,true +9,1668,srd,true +9,1660,srd,true +9,1554,srd,true +9,1556,srd,true +9,1557,srd,true +9,1558,srd,true +9,1559,srd,true +9,1634,srd,true +9,1624,srd,true +9,1625,srd,true +9,1665,srd,true +9,1666,srd,true +9,1402,srd,true +9,1403,srd,true +9,1566,srd,true +9,1569,srd,true +9,1568,srd,true +9,1567,srd,true +9,1661,srd,true +9,1570,srd,true +9,1799,srd,true +9,1626,srd,true +9,1627,srd,true +9,1636,srd,true +9,1637,srd,true +9,1619,srd,true +9,1620,srd,true +9,1622,srd,true +9,1621,srd,true +9,1631,srd,true +9,1595,srd,true +9,1723,srd,true +9,1725,srd,true +9,1594,srd,true +9,1810,srd,true +9,1811,srd,true +9,1573,srd,true +9,1572,srd,true +9,1734,srd,true +9,1590,srd,true +9,1586,srd,true +9,1759,srd,true +9,1591,srd,true +9,1587,srd,true +9,1760,srd,true +9,1592,filler,true +9,1588,filler,true +9,1761,filler,true +9,1593,filler,true +9,1589,filler,true +9,1762,filler,true +9,1584,srd,true +9,1578,srd,true +9,1739,srd,true +9,1581,srd,true +9,1597,srd,true +9,1736,srd,true +9,1585,filler,true +9,1579,filler,true +9,1740,filler,true +9,1582,filler,true +9,1576,filler,true +9,1737,filler,true +9,1583,srd,true +9,1577,srd,true +9,1738,srd,true +9,1580,srd,true +9,1574,srd,true +9,1735,srd,true +9,1638,filler,true +9,1657,srd,true +9,1658,srd,true +9,1615,srd,false +9,1616,srd,false +9,1613,srd,false +9,1614,srd,false +9,1611,srd,false +9,1612,srd,false +9,1565,srd,true +9,1561,srd,true +9,1562,srd,true +9,1378,srd,true +9,1732,srd,true +9,1807,srd,true +9,1813,srd,true +9,1809,srd,true +9,1599,filler,true +9,1601,filler,true +9,1598,srd,true +9,1600,srd,true +9,1644,srd,true +9,1645,srd,true +9,1772,srd,true +9,1778,srd,true +9,1777,srd,true +9,1776,srd,true +9,1771,srd,true +9,1775,srd,true +9,1774,srd,true +9,1773,srd,true +9,1267,srd,true +9,1469,srd,true +9,1268,srd,true +9,1470,srd,true +9,1273,srd,true +9,1468,srd,true +9,1271,srd,true +9,1462,srd,true +9,1272,srd,true +9,1463,srd,true +9,1276,srd,true +9,1464,srd,true +9,1308,srd,true +9,1465,srd,true +9,1412,srd,true +9,1471,srd,true +9,1278,srd,true +9,1472,srd,true +9,1279,srd,true +9,1473,srd,true +9,1280,srd,true +9,1474,srd,true +9,1274,srd,true +9,1466,srd,true +9,1275,srd,true +9,1467,srd,true +9,1320,open,true +9,1321,open,true +9,1289,open,true +9,1322,open,true +9,1323,open,true +9,1324,open,true +9,1290,open,true +9,1325,open,true +9,1326,open,false +9,1291,open,true +9,1292,open,true +9,1344,open,true +9,1327,open,true +9,1328,open,true +9,1293,open,true +9,1329,open,true +9,1358,open,true +9,1330,filler,true +9,1331,filler,true +9,1332,open,true +9,1333,open,true +9,1334,open,true +9,1335,open,true +9,1336,open,true +9,1337,open,true +9,1338,open,true +9,1339,open,true +9,1340,open,true +9,1707,open,true +9,1698,open,true +9,1694,open,true +9,1695,open,true +9,1669,open,true +9,1670,open,true +9,1671,open,true +9,1672,open,true +9,1673,open,true +9,1674,open,true +9,1675,open,true +9,1676,open,true +9,1677,open,true +9,1678,open,true +9,1692,open,true +9,1679,open,true +9,1690,open,true +9,1691,open,true +9,1680,open,true +9,1681,open,true +9,1682,open,true +9,1683,open,true +9,1684,open,true +9,1685,open,true +9,1686,open,true +9,1687,open,true +9,1816,open,true +9,1817,open,true +9,1699,open,true +9,1700,open,true +9,1814,open,true +9,1815,open,true +9,1704,open,true +9,1708,open,true +9,1714,open,true +9,1709,open,true +9,1712,open,true +9,1711,open,true +9,1701,open,true +9,1702,open,true +9,1398,none,false +9,1399,none,false +9,1097,srd,true +9,1098,srd,true +9,1095,srd,true +9,1108,srd,true +9,1096,srd,true +9,1371,srd,true +9,1374,srd,true +9,1370,srd,true +9,1263,srd,true +9,1475,srd,true +9,1375,srd,true +9,1376,srd,true +9,1372,srd,true +9,1377,none,false diff --git a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_version.csv b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_version.csv index c106af43..bc0c995c 100644 --- a/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_version.csv +++ b/schema/sdss5db/targetdb/load_table/targeting_generation/targeting_generation_to_version.csv @@ -9,4 +9,5 @@ generation_pk,version_pk 7,192 8,193 8,194 -8,197 \ No newline at end of file +8,197 +9,216 \ No newline at end of file