diff --git a/CHANGES.txt b/CHANGES.txt index 267f559d466f5727850a2efb5f488a95929c0cbd..f1c406183a2df062a6d7bdc64f3a400a3e57fd1d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,7 @@ Global * Added 'getconfig' tool to generate clean config files from 'update' scripts * Added 'editexp' tool to edit the config file for a given 'update' script +* Added 'upexp' tool to run the 'update' script for a given config file Templates --------- diff --git a/doc/mkexp.fodt b/doc/mkexp.fodt index 216eb887b10fb30f2317847f67c0f9fae4846741..d17aad166670cb7d540232a23cede8b31ec422d2 100644 --- a/doc/mkexp.fodt +++ b/doc/mkexp.fodt @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> - <office:meta><meta:creation-date>2015-01-05T17:44:27.618344249</meta:creation-date><dc:title>Make Experiments!</dc:title><meta:editing-duration>P12DT2H46M17S</meta:editing-duration><meta:editing-cycles>154</meta:editing-cycles><meta:generator>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</meta:generator><meta:initial-creator>Karl-Hermann Wieners</meta:initial-creator><dc:date>2019-06-28T15:49:17.339284683</dc:date><dc:creator>Karl-Hermann Wieners</dc:creator><meta:printed-by>Karl-Hermann Wieners</meta:printed-by><meta:print-date>2015-01-20T10:55:48.576690105</meta:print-date><dc:subject>Run-script generation for earth system models</dc:subject><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="31" meta:paragraph-count="572" meta:word-count="7920" meta:character-count="50457" meta:non-whitespace-character-count="42712"/><meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:title="A4" xlink:href="../../../../../../home/m221078/.config/libreoffice/4/user/template/A4.ott" meta:date="2015-01-05T17:44:27.463210655"/></office:meta> + <office:meta><meta:creation-date>2015-01-05T17:44:27.618344249</meta:creation-date><dc:title>Make Experiments!</dc:title><meta:editing-duration>P12DT2H54M25S</meta:editing-duration><meta:editing-cycles>155</meta:editing-cycles><meta:generator>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</meta:generator><meta:initial-creator>Karl-Hermann Wieners</meta:initial-creator><dc:date>2019-06-28T16:01:24.843267451</dc:date><dc:creator>Karl-Hermann Wieners</dc:creator><meta:printed-by>Karl-Hermann Wieners</meta:printed-by><meta:print-date>2015-01-20T10:55:48.576690105</meta:print-date><dc:subject>Run-script generation for earth system models</dc:subject><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="31" meta:paragraph-count="574" meta:word-count="7947" meta:character-count="50647" meta:non-whitespace-character-count="42877"/><meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:title="A4" xlink:href="../../../../../../home/m221078/.config/libreoffice/4/user/template/A4.ott" meta:date="2015-01-05T17:44:27.463210655"/></office:meta> <office:settings> <config:config-item-set config:name="ooo:view-settings"> - <config:config-item config:name="ViewAreaTop" config:type="long">268393</config:config-item> + <config:config-item config:name="ViewAreaTop" config:type="long">268534</config:config-item> <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item> <config:config-item config:name="ViewAreaWidth" config:type="long">26654</config:config-item> <config:config-item config:name="ViewAreaHeight" config:type="long">14025</config:config-item> @@ -13,12 +13,12 @@ <config:config-item-map-indexed config:name="Views"> <config:config-item-map-entry> <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> - <config:config-item config:name="ViewLeft" config:type="long">6560</config:config-item> - <config:config-item config:name="ViewTop" config:type="long">274565</config:config-item> + <config:config-item config:name="ViewLeft" config:type="long">8042</config:config-item> + <config:config-item config:name="ViewTop" config:type="long">276712</config:config-item> <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item> - <config:config-item config:name="VisibleTop" config:type="long">268393</config:config-item> + <config:config-item config:name="VisibleTop" config:type="long">268534</config:config-item> <config:config-item config:name="VisibleRight" config:type="long">26652</config:config-item> - <config:config-item config:name="VisibleBottom" config:type="long">282416</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="long">282557</config:config-item> <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> <config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item> <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item> @@ -41,7 +41,7 @@ <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrinterSetup" config:type="base64Binary">swH+/0hQLU9mZmljZWpldC00NjIwLXNlcmllcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpIUC1PZmZpY2VqZXQtNDYyMC1zZXJpZXMAAAAWAAMA0AAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9SFAtT2ZmaWNlamV0LTQ2MjAtc2VyaWVzCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luZGFqdXN0bWVudD0wLDAsMCwwCmNvbG9yZGVwdGg9MjQKcHNsZXZlbD0wCnBkZmRldmljZT0xCmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4RGF0YQpJbnB1dFNsb3Q6QXV0bwBQYWdlU2l6ZTpMZXR0ZXIAABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3du</config:config-item> + <config:config-item config:name="PrinterSetup" config:type="base64Binary">swH+/0hQLU9mZmljZWpldC00NjIwLXNlcmllcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpIUC1PZmZpY2VqZXQtNDYyMC1zZXJpZXMAAAAWAAMA0AAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9SFAtT2ZmaWNlamV0LTQ2MjAtc2VyaWVzCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luZGFqdXN0bWVudD0wLDAsMCwwCmNvbG9yZGVwdGg9MjQKcHNsZXZlbD0wCnBkZmRldmljZT0xCmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4RGF0YQpQYWdlU2l6ZTpMZXR0ZXIASW5wdXRTbG90OkF1dG8AABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3du</config:config-item> <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item> <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/> <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item> @@ -92,7 +92,7 @@ <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item> <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> - <config:config-item config:name="Rsid" config:type="int">16894052</config:config-item> + <config:config-item config:name="Rsid" config:type="int">17006124</config:config-item> <config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item> <config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">false</config:config-item> <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item> @@ -1354,6 +1354,15 @@ <style:style style:name="P312" style:family="paragraph" style:parent-style-name="Heading_20_3"> <style:text-properties officeooo:rsid="00c6886f" officeooo:paragraph-rsid="00c6886f"/> </style:style> + <style:style style:name="P313" style:family="paragraph" style:parent-style-name="List_20_Contents"> + <style:text-properties officeooo:paragraph-rsid="00fe6ad2"/> + </style:style> + <style:style style:name="P314" style:family="paragraph" style:parent-style-name="List_20_Contents"> + <style:text-properties officeooo:rsid="01037e2c" officeooo:paragraph-rsid="01037e2c"/> + </style:style> + <style:style style:name="P315" style:family="paragraph" style:parent-style-name="Preformatted_20_List_20_Heading"> + <style:text-properties officeooo:paragraph-rsid="01037e2c"/> + </style:style> <style:style style:name="T1" style:family="text"> <style:text-properties officeooo:rsid="000be205"/> </style:style> @@ -2167,6 +2176,9 @@ <style:style style:name="T271" style:family="text"> <style:text-properties officeooo:rsid="0101c864"/> </style:style> + <style:style style:name="T272" style:family="text"> + <style:text-properties officeooo:rsid="01037e2c"/> + </style:style> <style:style style:name="Sect1" style:family="section"> <style:section-properties style:editable="false"> <style:columns fo:column-count="1" fo:column-gap="0cm"/> @@ -2214,7 +2226,7 @@ <office:master-styles> <style:master-page style:name="Standard" style:page-layout-name="pm1"> <style:footer> - <text:p text:style-name="Footer"><text:page-number text:select-page="current">10</text:page-number><text:tab/><text:tab/><text:modification-date style:data-style-name="N84">2019-06-28</text:modification-date>, <text:modification-time style:data-style-name="N41">15:49:17</text:modification-time></text:p> + <text:p text:style-name="Footer"><text:page-number text:select-page="current">10</text:page-number><text:tab/><text:tab/><text:modification-date style:data-style-name="N84">2019-06-28</text:modification-date>, <text:modification-time style:data-style-name="N41">16:01:25</text:modification-time></text:p> </style:footer> </style:master-page> <style:master-page style:name="First_20_Page" style:display-name="First Page" style:page-layout-name="pm2" style:next-style-name="Standard"/> @@ -2492,10 +2504,12 @@ <text:p text:style-name="P225"><text:span text:style-name="T252">Replicates all data </text:span>of an experiment <text:span text:style-name="T251">to a new experiment name; also updates text files by rewriting references to the old name</text:span>.</text:p> <text:p text:style-name="P247"><text:span text:style-name="T261">du</text:span>exp <text:span text:style-name="T24">file</text:span><text:span text:style-name="T206">.config</text:span><text:span text:style-name="T70"> [</text:span><text:span text:style-name="T24">name</text:span><text:span text:style-name="T70">=</text:span><text:span text:style-name="T24">value ...</text:span><text:span text:style-name="T70">]</text:span></text:p> <text:p text:style-name="P229"><text:span text:style-name="T111">Shows disk usage for all data that has been created by</text:span><text:span text:style-name="T70"> </text:span><text:span text:style-name="T111">an</text:span><text:span text:style-name="T70"> experiment.</text:span></text:p> - <text:p text:style-name="P248"><text:soft-page-break/>edit<text:span text:style-name="T271">exp</text:span> [<text:span text:style-name="Variable">file</text:span>]</text:p> + <text:p text:style-name="P315"><text:soft-page-break/><text:span text:style-name="T272">upexp </text:span><text:span text:style-name="Variable"><text:span text:style-name="T272">file</text:span></text:span><text:span text:style-name="T272">.config </text:span><text:span text:style-name="T70">[</text:span><text:span text:style-name="Variable">name</text:span><text:span text:style-name="T70">=</text:span><text:span text:style-name="Variable">value</text:span><text:span text:style-name="Variable"><text:span text:style-name="T24"> ...</text:span></text:span><text:span text:style-name="T70">]</text:span></text:p> + <text:p text:style-name="P314"><text:span text:style-name="T51">Update generated scripts for the given experiment with the same mkexp version, environment and command line, as saved in the corresponding 'update' script.</text:span></text:p> + <text:p text:style-name="P248">edit<text:span text:style-name="T271">exp</text:span> [<text:span text:style-name="Variable">file</text:span>]</text:p> <text:p text:style-name="P230">Reads <text:span text:style-name="T270">the</text:span> update script <text:span text:style-name="Variable">file</text:span> ('update' by default) and <text:span text:style-name="T270">launches a program to edit the </text:span>corresponding config file. <text:span text:style-name="T270">The program is taken from the environment variables 'VISUAL' or 'EDITOR' if defined, otherwise </text:span><text:span text:style-name="T42">vi</text:span><text:span text:style-name="T270"> is launched.</text:span></text:p> <text:p text:style-name="P246"><text:span text:style-name="T269">getconfig</text:span> <text:span text:style-name="T269">[</text:span><text:span text:style-name="Variable">file</text:span><text:span text:style-name="T206">]</text:span></text:p> - <text:p text:style-name="P230">Documentation tool for experiments that were created using command line assignments. Reads an update script file ('update' by default) and prints the corresponding config file with command line settings from the update script included.</text:p> + <text:p text:style-name="P230">Documentation tool for experiments that were created using command line assignments. Reads <text:span text:style-name="T272">the</text:span> update script <text:span text:style-name="Variable">file</text:span> ('update' by default) and prints the corresponding config file with command line settings from the update script included.</text:p> <text:h text:style-name="P288" text:outline-level="2"><text:bookmark-start text:name="__RefHeading__2534_1114405012"/><text:span text:style-name="T162">F</text:span>ormat of .config files<text:bookmark-end text:name="__RefHeading__2534_1114405012"/></text:h> <text:p text:style-name="P15">The .config files are simple text files containing a dictionary of variables with their respective values. They may be structured using sections and comments. <text:span text:style-name="T157">For reading these files, </text:span><text:span text:style-name="T12">mkexp</text:span><text:span text:style-name="T157"> uses the </text:span><text:span text:style-name="T12">configobj</text:span><text:span text:style-name="T157"> Python library. All settings found in the .config files are handled as Python variables internally.</text:span></text:p> <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__1669_1438093122"/>Variables<text:bookmark-end text:name="__RefHeading__1669_1438093122"/></text:h> @@ -2506,8 +2520,8 @@ <text:p text:style-name="P20">Comma separated values are taken to be a list of string values. Thus</text:p> <text:p text:style-name="Preformatted_20_Text">PATH = /bin, /usr/bin, /usr/local/bin</text:p> <text:p text:style-name="P21">will set PATH to ['/bin', '/usr/bin', '/usr/local/bin'].</text:p> - <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2536_1114405012"/>Sections<text:bookmark-end text:name="__RefHeading__2536_1114405012"/></text:h> - <text:p text:style-name="P22">Variable assignments may be contained in <text:span text:style-name="T9">sections</text:span><text:span text:style-name="T51">. They </text:span><text:span text:style-name="T53">group</text:span><text:span text:style-name="T51"> a set of variables that may be treated </text:span><text:span text:style-name="T90">in a way </text:span><text:span text:style-name="T51">different fro</text:span><text:span text:style-name="T90">m</text:span><text:span text:style-name="T51"> the global variables. Sections are created by a section name on a line by itself, enclosed by brackets. Any variables defined later in </text:span><text:soft-page-break/><text:span text:style-name="T51">the .config file belong to this section:</text:span></text:p> + <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2536_1114405012"/><text:soft-page-break/>Sections<text:bookmark-end text:name="__RefHeading__2536_1114405012"/></text:h> + <text:p text:style-name="P22">Variable assignments may be contained in <text:span text:style-name="T9">sections</text:span><text:span text:style-name="T51">. They </text:span><text:span text:style-name="T53">group</text:span><text:span text:style-name="T51"> a set of variables that may be treated </text:span><text:span text:style-name="T90">in a way </text:span><text:span text:style-name="T51">different fro</text:span><text:span text:style-name="T90">m</text:span><text:span text:style-name="T51"> the global variables. Sections are created by a section name on a line by itself, enclosed by brackets. Any variables defined later in the .config file belong to this section:</text:span></text:p> <text:p text:style-name="P126">[section1]</text:p> <text:p text:style-name="P126"><text:s text:c="4"/>description = This is the first section</text:p> <text:p text:style-name="P22">will be stored as a dictionary section1 with section1['description'] set to 'This is the first section'.</text:p> @@ -2524,10 +2538,10 @@ <text:p text:style-name="P23">Note that indentation may be used to make the file more legible but is completely ignored when the file is loaded. The number of brackets is the only way to define the level of a section. This means that all variables in a section must be defined before any subsections. Otherwise, the variable <text:s/>would be<text:span text:style-name="T161">long</text:span> to the respective subsection.</text:p> <text:p text:style-name="P22">Fortran scholars will also want to note that names are case-sensitive, i.e. the variable 'NAME' is quite different from 'name'. Usually, setups use upper-case names for global variables and lower-case names for sections and their variables.</text:p> <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2538_1114405012"/>Special <text:span text:style-name="T199">v</text:span>ariables <text:span text:style-name="T199">and sections</text:span><text:bookmark-end text:name="__RefHeading__2538_1114405012"/></text:h> - <text:p text:style-name="P39"><text:span text:style-name="T51">There are a number of special variables that influence the way </text:span>mkexp<text:span text:style-name="T51"> works. They must be present in one of the .config files, unless noted otherwise below. </text:span><text:span text:style-name="T55">They are listed here for a first overview. Their exact meaning is explained in more detail in the upcoming sections.</text:span></text:p> + <text:p text:style-name="P39"><text:span text:style-name="T51">There are a number of special variables that influence the way </text:span>mkexp<text:span text:style-name="T51"> works. They must be present in one of the .config files, unless noted otherwise below. </text:span><text:span text:style-name="T55">They are </text:span><text:soft-page-break/><text:span text:style-name="T55">listed here for a first overview. Their exact meaning is explained in more detail in the upcoming sections.</text:span></text:p> <text:p text:style-name="P40"><text:span text:style-name="T55">T</text:span><text:span text:style-name="T51">he first set of variables is usually defined in the model setup:</text:span></text:p> <text:p text:style-name="P169">SCRIPT_DIR</text:p> - <text:p text:style-name="P183"><text:soft-page-break/><text:span text:style-name="T54">D</text:span><text:span text:style-name="T51">irectory where the generated job descriptions are stored. This directory and its parents are created by </text:span><text:span text:style-name="T9">mkexp</text:span><text:span text:style-name="T51"> if they do not exist.</text:span></text:p> + <text:p text:style-name="P183"><text:span text:style-name="T54">D</text:span><text:span text:style-name="T51">irectory where the generated job descriptions are stored. This directory and its parents are created by </text:span><text:span text:style-name="T9">mkexp</text:span><text:span text:style-name="T51"> if they do not exist.</text:span></text:p> <text:p text:style-name="P170">WORK_DIR</text:p> <text:p text:style-name="P186">Directory where the experiment is run. The jobs will use this for providing input data and configuration files needed for model execution. This directory and its parents are created if they do not exist.</text:p> <text:p text:style-name="P171">DATA_DIR</text:p> @@ -2546,8 +2560,8 @@ <text:p text:style-name="P180">EXP_ID (<text:span text:style-name="T9">optional</text:span>)</text:p> <text:p text:style-name="P201">Name of the experiment to be created. If not set, this will be set to the base name of the user's .config file, e.g. 'joe1234' in the introductory example. All job description files will carry this as the first part of their name. For almost all model setups, this will be used in the definitions of SCRIPT_DIR, WORK_DIR, and DATA_DIR.</text:p> <text:p text:style-name="P168">EXP_DESCRIPTION <text:span text:style-name="T180">(</text:span><text:span text:style-name="T16">optional</text:span><text:span text:style-name="T180">)</text:span></text:p> - <text:p text:style-name="P187">Extensive description of the experiment to be created. If not set, this will contain all text in the header comment of the user's .config file. The leading comment characters, <text:span text:style-name="T266">as well as </text:span>leading and trailing empty lines <text:span text:style-name="T266">or comment boilerplate </text:span>are removed. Note that <text:span text:style-name="T223">both header comment and </text:span>EXP_DESCRIPTION may reference any other global variable defined in the experiment configuration <text:span text:style-name="T223">(see section </text:span><text:span text:style-name="T223"><text:bookmark-ref text:reference-format="chapter" text:ref-name="__RefHeading__2540_1114405012">2.3.4</text:bookmark-ref></text:span><text:span text:style-name="T223">)</text:span>.</text:p> - <text:p text:style-name="P187"><text:soft-page-break/>The contents of this variable is written to a 'README' file in SCRIPT_DIR.</text:p> + <text:p text:style-name="P187">Extensive description of the experiment to be created. If not set, this will contain <text:soft-page-break/>all text in the header comment of the user's .config file. The leading comment characters, <text:span text:style-name="T266">as well as </text:span>leading and trailing empty lines <text:span text:style-name="T266">or comment boilerplate </text:span>are removed. Note that <text:span text:style-name="T223">both header comment and </text:span>EXP_DESCRIPTION may reference any other global variable defined in the experiment configuration <text:span text:style-name="T223">(see section </text:span><text:span text:style-name="T223"><text:bookmark-ref text:reference-format="chapter" text:ref-name="__RefHeading__2540_1114405012">2.3.4</text:bookmark-ref></text:span><text:span text:style-name="T223">)</text:span>.</text:p> + <text:p text:style-name="P187">The contents of this variable is written to a 'README' file in SCRIPT_DIR.</text:p> <text:p text:style-name="P38"><text:span text:style-name="T51">Another set of variables is automatically added to the job specific experiment configuration. </text:span><text:span text:style-name="T66">These are considered read-only</text:span><text:span text:style-name="T51"> </text:span><text:span text:style-name="T59">and may not be altered</text:span><text:span text:style-name="T51">.</text:span></text:p> <text:p text:style-name="P167">JOB</text:p> <text:p text:style-name="P184">A dictionary of system settings pertaining to the current job.</text:p> @@ -2566,12 +2580,12 @@ <text:p text:style-name="P216">All input files that are needed for an experiment and <text:span text:style-name="T234">information</text:span> to provide them go into this section. <text:span text:style-name="T234">See section </text:span><text:span text:style-name="T234"><text:bookmark-ref text:reference-format="chapter" text:ref-name="__RefHeading__2831_1132221942">2.10</text:bookmark-ref></text:span><text:span text:style-name="T234">, '</text:span><text:span text:style-name="T234"><text:bookmark-ref text:reference-format="text" text:ref-name="__RefHeading__2831_1132221942">Defining input files for an experiment</text:bookmark-ref></text:span><text:span text:style-name="T234">'.</text:span></text:p> <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2540_1114405012"/>Variable interpolation<text:bookmark-end text:name="__RefHeading__2540_1114405012"/></text:h> <text:p text:style-name="P72">The value of a .config variable may reference the value of another variable by prefixing its name with <text:span text:style-name="T213">a </text:span>dollar sign. <text:span text:style-name="T213">This is called </text:span><text:span text:style-name="T26">interpolation</text:span><text:span text:style-name="T77"> of variables. E.g.</text:span></text:p> - <text:p text:style-name="P154"># joe1234.config</text:p> + <text:p text:style-name="P154"><text:soft-page-break/># joe1234.config</text:p> <text:p text:style-name="P160">WORK_ROOT = /scratch/joe</text:p> <text:p text:style-name="Preformatted_20_Text">WORK_DIR = $WORK_ROOT/experiments/<text:span text:style-name="T214">$EXP_ID</text:span></text:p> <text:p text:style-name="P74">will set 'WORK_DIR' to '/scratch/joe/experiments/joe1234'.</text:p> <text:p text:style-name="P73">Interpolation only works for variables of the current section or its ancestor sections.</text:p> - <text:p text:style-name="Preformatted_20_Text"><text:soft-page-break/>[ensembles] </text:p> + <text:p text:style-name="Preformatted_20_Text">[ensembles] </text:p> <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/>size = 42 </text:p> <text:p text:style-name="Preformatted_20_Text">[jobs] </text:p> <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/>ensemble_size = $size </text:p> @@ -2592,10 +2606,10 @@ <text:p text:style-name="P76">While interpolation looks a lot like in shell scripts, there is a major difference: interpolation is – as in Makefiles – only evaluated when the final value is written or passed on. This has the advantage that the model setup may define settings based on variables that are only defined later in the user setup.</text:p> <text:p text:style-name="P157"># model setup</text:p> <text:p text:style-name="P249"><text:span text:style-name="T216">MODEL</text:span>_<text:span text:style-name="T216">DIR</text:span> = $HOME/<text:span text:style-name="T216">$MODEL_SUBDIR</text:span></text:p> - <text:p text:style-name="P158"># user setup</text:p> + <text:p text:style-name="P158"><text:soft-page-break/># user setup</text:p> <text:p text:style-name="P158">MODEL_SUBDIR = echam</text:p> <text:p text:style-name="P77">Here, as the model setup is read before the user setup, 'MODEL_SUBDIR' is not set when 'MODEL_ROOT' is defined. <text:span text:style-name="T217">This works, because i</text:span>nterpolation of 'MODEL_ROOT's value is postponed until all levels of setup have been read.</text:p> - <text:p text:style-name="P77"><text:soft-page-break/>The disadvantage is that there may be no incremental adding of values to a given variable because this would cause circular dependencies. Imagine</text:p> + <text:p text:style-name="P77">The disadvantage is that there may be no incremental adding of values to a given variable because this would cause circular dependencies. Imagine</text:p> <text:p text:style-name="Preformatted_20_Text">SUBMODELS = $SUBMODELS jsbach</text:p> <text:p text:style-name="P78">When <text:span text:style-name="T9">mkexp</text:span> tries to evaluate 'SUBMODELS', it sees that it needs to do an interpolation; but to do this interpolation, 'SUBMODELS' would need to have been evaluated already! So this results in</text:p> <text:p text:style-name="Preformatted_20_Text">Oops: interpolation loop detected in value "SUBMODELS" while reading key 'SUBMODELS'</text:p> @@ -2609,8 +2623,8 @@ <text:p text:style-name="P250">DATE_<text:span text:style-name="T225">LIST</text:span> = eval($DATE_<text:span text:style-name="T226">STRING</text:span>) # becomes a 3 element list</text:p> <text:p text:style-name="P235">variable<text:span text:style-name="T51"> = </text:span><text:span text:style-name="T135">read(</text:span>file_name<text:span text:style-name="T135">)</text:span></text:p> <text:p text:style-name="P205"><text:span text:style-name="T51">Read the contents of the file </text:span>file_name<text:span text:style-name="T51"> and assign its contents to </text:span>variable<text:span text:style-name="T51"> as a string.</text:span></text:p> - <text:p text:style-name="P236"><text:span text:style-name="T27">variable</text:span><text:span text:style-name="T79"> = </text:span><text:span text:style-name="T137">split_date(</text:span><text:span text:style-name="T27">timestamp</text:span><text:span text:style-name="T137">)</text:span></text:p> - <text:p text:style-name="P213"><text:span text:style-name="T218">T</text:span>ake <text:span text:style-name="T9">timestamp</text:span><text:span text:style-name="T51"> and split it into a list of numerical date/time elements. </text:span><text:span text:style-name="T9">tim</text:span><text:span text:style-name="T28">e</text:span><text:span text:style-name="T9">stamp</text:span><text:span text:style-name="T51"> </text:span><text:span text:style-name="T80">must have </text:span><text:span text:style-name="T51">an ISO-like format (date elements separated by '-'; 'T' or space as date/time separator; time elements separated by ':</text:span><text:span text:style-name="T80">'; </text:span><text:span text:style-name="T51">trailing time elements </text:span><text:span text:style-name="T81">and their separators </text:span><text:span text:style-name="T80">are optional</text:span><text:span text:style-name="T51">; time zone indicator is not supported). </text:span><text:span text:style-name="T93">Unlike ISO, </text:span><text:span text:style-name="T31">split_date</text:span><text:span text:style-name="T93"> also</text:span><text:span text:style-name="T51"> </text:span><text:span text:style-name="T93">allows the date to be in the form YYYYMMDD</text:span><text:span text:style-name="T51">. </text:span><text:span text:style-name="T81">Unset </text:span><text:soft-page-break/><text:span text:style-name="T81">fields default to zero.</text:span></text:p> + <text:p text:style-name="P236"><text:soft-page-break/><text:span text:style-name="T27">variable</text:span><text:span text:style-name="T79"> = </text:span><text:span text:style-name="T137">split_date(</text:span><text:span text:style-name="T27">timestamp</text:span><text:span text:style-name="T137">)</text:span></text:p> + <text:p text:style-name="P213"><text:span text:style-name="T218">T</text:span>ake <text:span text:style-name="T9">timestamp</text:span><text:span text:style-name="T51"> and split it into a list of numerical date/time elements. </text:span><text:span text:style-name="T9">tim</text:span><text:span text:style-name="T28">e</text:span><text:span text:style-name="T9">stamp</text:span><text:span text:style-name="T51"> </text:span><text:span text:style-name="T80">must have </text:span><text:span text:style-name="T51">an ISO-like format (date elements separated by '-'; 'T' or space as date/time separator; time elements separated by ':</text:span><text:span text:style-name="T80">'; </text:span><text:span text:style-name="T51">trailing time elements </text:span><text:span text:style-name="T81">and their separators </text:span><text:span text:style-name="T80">are optional</text:span><text:span text:style-name="T51">; time zone indicator is not supported). </text:span><text:span text:style-name="T93">Unlike ISO, </text:span><text:span text:style-name="T31">split_date</text:span><text:span text:style-name="T93"> also</text:span><text:span text:style-name="T51"> </text:span><text:span text:style-name="T93">allows the date to be in the form YYYYMMDD</text:span><text:span text:style-name="T51">. </text:span><text:span text:style-name="T81">Unset fields default to zero.</text:span></text:p> <text:p text:style-name="P237"><text:span text:style-name="T9">variable</text:span><text:span text:style-name="T51"> = </text:span><text:span text:style-name="T135">sec2time(</text:span><text:span text:style-name="T9">second_of_day</text:span><text:span text:style-name="T135">)</text:span></text:p> <text:p text:style-name="P197">Take integer <text:span text:style-name="T9">second_of_day</text:span> (from 0 to 86399) and return the corresponding time stamp as string of the form HH:MM:SS.</text:p> <text:p text:style-name="P238"><text:span text:style-name="T9">variable</text:span> = '<text:span text:style-name="T143">add_years</text:span>(<text:span text:style-name="T9">datestamp</text:span>, <text:span text:style-name="T9">offset</text:span>)'</text:p> @@ -2622,10 +2636,10 @@ <text:p text:style-name="P24">The expansion of .tmpl files into the job description uses the <text:span text:style-name="T9">Jinja</text:span> Python library. It provides a default set of facilities that can be used to expand any textual template. The proposed default syntax was slightly customized to fit the needs of <text:span text:style-name="T9">mkexp</text:span>.</text:p> <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2548_1114405012"/>Placeholders<text:bookmark-end text:name="__RefHeading__2548_1114405012"/></text:h> <text:p text:style-name="P25">The simplest interaction in a template is replacing a template's placeholder by a value from a .config file. <text:span text:style-name="T163">Any name enclosed by '%{' and '}' is taken to be a configuration variable, like in the snippets below:</text:span></text:p> - <text:p text:style-name="Preformatted_20_Text">#! /bin/ksh</text:p> + <text:p text:style-name="Preformatted_20_Text"><text:soft-page-break/>#! /bin/ksh</text:p> <text:p text:style-name="Preformatted_20_Text"><text:span text:style-name="T164">#</text:span> This script was <text:span text:style-name="T164">crea</text:span>ted by %{NAME}</text:p> <text:p text:style-name="P33">Here, the placehol<text:span text:style-name="T208">d</text:span>er requests the 'NAME' variable which was set to 'Joe User' in the example .config file <text:span text:style-name="T208">of section </text:span><text:span text:style-name="T208"><text:bookmark-ref text:reference-format="chapter" text:ref-name="__RefHeading__1669_1438093122">2.3.1</text:bookmark-ref></text:span>. This value is now looked up in the <text:span text:style-name="T208">configuration</text:span> and used to textually replace the placeholder expression, yield<text:span text:style-name="T208">ing</text:span> the final text:</text:p> - <text:p text:style-name="P123"><text:soft-page-break/>#! /bin/ksh</text:p> + <text:p text:style-name="P123">#! /bin/ksh</text:p> <text:p text:style-name="P122"><text:span text:style-name="T165"># </text:span>This script was <text:span text:style-name="T165">crea</text:span>ted by <text:span text:style-name="T163">Joe User</text:span></text:p> <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading__2550_1114405012"/><text:span text:style-name="T167">V</text:span>ariables in sections<text:bookmark-end text:name="__RefHeading__2550_1114405012"/></text:h> <text:p text:style-name="P26">To request a variable within a section, simply prepend the section name to the variable name, using '.' as separator, as in</text:p> @@ -2647,9 +2661,9 @@ <text:p text:style-name="P125">LIST_SUBLIST=%{PATH[1:3]}</text:p> <text:p text:style-name="Preformatted_20_Text">FILTERED_STRING=%{NAME | <text:span text:style-name="T167">lower()} <text:s/># is 'joe user'</text:span></text:p> <text:p text:style-name="P92">The last example allows for <text:span text:style-name="T179">a </text:span>number of predefined filters instead of 'lower'. These are described in the <text:span text:style-name="T9">Jinja</text:span> documentation (List of Builtin Filters). <text:span text:style-name="T241">Besides, </text:span><text:span text:style-name="T9">mkexp</text:span> defines <text:s/><text:span text:style-name="T244">a number of </text:span>additional filters:</text:p> - <text:p text:style-name="P240">split<text:span text:style-name="T173">(</text:span><text:span text:style-name="T46">s</text:span><text:span text:style-name="T138">, </text:span><text:span text:style-name="T46">m</text:span><text:span text:style-name="T138">=-1)</text:span></text:p> + <text:p text:style-name="P240"><text:soft-page-break/>split<text:span text:style-name="T173">(</text:span><text:span text:style-name="T46">s</text:span><text:span text:style-name="T138">, </text:span><text:span text:style-name="T46">m</text:span><text:span text:style-name="T138">=-1)</text:span></text:p> <text:p text:style-name="P198">cuts <text:span text:style-name="T243">the input </text:span>string <text:span text:style-name="T243">at all occurrences of </text:span><text:span text:style-name="T34">s</text:span><text:span text:style-name="T243">, returning</text:span> a list of substrings. <text:span text:style-name="T242">If </text:span><text:span text:style-name="T33">m</text:span><text:span text:style-name="T242"> is positive or zero, it cuts only at the first </text:span><text:span text:style-name="T33">m</text:span><text:span text:style-name="T242"> occurrences; the last element contains the remaining substring:</text:span></text:p> - <text:p text:style-name="Preformatted_20_Text_20_Indented"><text:soft-page-break/>%{ 'A B C' | <text:span text:style-name="T143">split</text:span><text:span text:style-name="T173">(' ') }<text:tab/><text:tab/>→</text:span><text:span text:style-name="T176"> </text:span><text:span text:style-name="T175">['A', 'B', 'C']</text:span></text:p> + <text:p text:style-name="Preformatted_20_Text_20_Indented">%{ 'A B C' | <text:span text:style-name="T143">split</text:span><text:span text:style-name="T173">(' ') }<text:tab/><text:tab/>→</text:span><text:span text:style-name="T176"> </text:span><text:span text:style-name="T175">['A', 'B', 'C']</text:span></text:p> <text:p text:style-name="P253"><text:span text:style-name="T175">%{ 'A B C' | split(' ', </text:span><text:span text:style-name="T153">1</text:span><text:span text:style-name="T175">) } <text:tab/></text:span><text:span text:style-name="T176">→ </text:span><text:span text:style-name="T175">['A', </text:span><text:span text:style-name="T153">'B C'</text:span><text:span text:style-name="T175">]</text:span></text:p> <text:p text:style-name="P217"/> <text:p text:style-name="P119">filter<text:span text:style-name="T173">()</text:span></text:p> diff --git a/doc/mkexp.pdf b/doc/mkexp.pdf index a2ed246874f833138aaf7dc1914585c9881a3611..fc8fcbe074b8740b1494931510b4cd8ed4129ec8 100644 Binary files a/doc/mkexp.pdf and b/doc/mkexp.pdf differ diff --git a/setup.py b/setup.py index c21bcbeedce9584251337c5b76846e041b8b5162..d4cc8c0205b148986177ceb8ffae84802107e564 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( author_email = 'karl-hermann.wieners@mpimet.mpg.de', url = 'http://code.mpimet.mpg.de/projects/esmenv', py_modules = ['_version', 'configobj', 'validate', 'feedback', 'expargparse', 'expconfig', 'files', 'package_info', 'update'], - scripts = ['mkexp', 'getexp', 'rmexp', 'diffexp', 'diffpath', 'cpexp', 'cppath', 'duexp', 'getconfig', 'editexp'], + scripts = ['mkexp', 'getexp', 'rmexp', 'diffexp', 'diffpath', 'cpexp', 'cppath', 'duexp', 'getconfig', 'editexp', 'upexp'], data_files = [('share/doc/'+package_info.name, ['doc/mkexp.pdf', 'mkexp.bash'])], platforms = ['Posix'], license = 'LICENSE.txt', diff --git a/upexp b/upexp new file mode 100755 index 0000000000000000000000000000000000000000..377346a3bd282e0351f7ca1a8ebd0c99c8f742db --- /dev/null +++ b/upexp @@ -0,0 +1,23 @@ +#! /bin/sh +# +# Update experiment setups using config information. +# +# $Id$ +# + +PROGRAM=`basename $0` +BINDIR=`dirname $0` +PATH="$BINDIR:$PATH" + +die () { + echo "$@" >&2 + exit 1 +} + +[ "x$1" = x ] && die "Oops: invalid number of parameters +Usage: $PROGRAM config_file [key=value...]" + +SCRIPT_DIR=`getexp -k SCRIPT_DIR "$@"` || exit $? + +cd "$SCRIPT_DIR" +exec ./update