gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
303 stars 99 forks source link

Headless XML generation doesn't properly handle "file" variable #3049

Closed RoiArthurB closed 3 years ago

RoiArthurB commented 3 years ago

Describe the bug XML generation file do not generate the good value for file variable

To Reproduce Simple GAML

model test

global {
    file shape_file_roads <- file("../includes/roads.shp") parameter: true;
    init {}
}

experiment test type: gui {
    parameter "Shapefile for the buildings : " var: shape_file_roads category: "GIS" ;
}

Headless generation command

$ gama-headless.sh -xml test Documents/Dev/tmp/gama-file/Sibate/models/Sibate_om2.gaml Documents/Dev/tmp/gama-file/Sibate/models/out.xml
******************************************************************
* GAMA version 1.8.1                                             *
* http://gama-platform.org                                       *
* (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> JAI/ImageIO subsystem activated
Adding object pool: Ordered Collectors
Adding object pool: Unique Collectors
Adding object pool: Unique Ordered Collectors
> GAMA: msi.gama.core                         loaded in : 1395ms
> GAMA: ummisco.gaml.extensions.maths         loaded in : 16ms
> GAMA: msi.gaml.architecture.simplebdi       loaded in : 133ms
> GAMA: ummisco.gaml.extensions.stats         loaded in : 14ms
> GAMA: msi.gama.lang.gaml                    loaded in : 5ms
> GAMA: simtools.gaml.extensions.traffic      loaded in : 40ms
> GAMA: simtools.gaml.extensions.physics      loaded in : 9ms
> GAMA: genstar.gamaplugin                    loaded in : 34ms
> GAMA: irit.gaml.extensions.database         loaded in : 18ms
> GAMA: ummisco.gama.network                  loaded in : 9ms
> GAMA: msi.gama.headless                     loaded in : 5ms
> GAMA: ummisco.gama.opengl                   loaded in : 12ms
> GAMA: msi.gaml.extensions.fipa              loaded in : 147ms
> GAMA: ummisco.gama.serialize                loaded in : 9ms
> GAMA: ummisco.gama.java2d                   loaded in : 1ms
> GAMA total load time : 1921ms
GAMA configuring and loading...
> GAMA building GAML artefacts in : 354ms
/home/roiarthurb/Documents/Dev/tmp/gama-file/Sibate/models/Sibate_om2.gaml model is being compiled...
Adding object pool: Execution Context
Adding object pool: Agent Execution Context
Parameter file saved at: /home/roiarthurb/Documents/Dev/tmp/gama-file/Sibate/models/out.xml

Output XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Experiment_plan>
    <Simulation experiment="test" finalStep="1000" id="0" seed="1.0" sourcePath="/home/roiarthurb/Documents/Dev/tmp/gama-file/Sibate/models/Sibate_om2.gaml">
        <Parameters>
            <Parameter name="Shapefile for the buildings : " type="UNDEFINED" value="file&lt;int, geometry&gt;('../includes/roads.shp')" var="shape_file_roads"/>
        </Parameters>
        <Outputs/>
    </Simulation>
</Experiment_plan>

Expected behavior The parameter value is value="file&lt;int, geometry&gt;('../includes/roads.shp')" but should be value="../includes/roads.shp"

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Workaround Fixing the XML value by hand fix the issue

romainreuillon commented 3 years ago

Dear Gama Devs,

any news about this bug? Is it hard to solve?

(One of our OpenMOLE user requires this bug to be fixed in order to explore her model)

with best regards, Romain

hqnghi88 commented 3 years ago

Hi, i try to fix it now.

hqnghi88 commented 3 years ago

i pushed a workaround. if you use gama git base , you can try now, or wait for continuous build in 5 hours.

romainreuillon commented 3 years ago

Great!

OpenMOLE uses the gama container from the docker hub. I'll wait for the continuous build end to test the fix.

hqnghi88 commented 3 years ago

OK i made the CI, please try.

romainreuillon commented 3 years ago

I just tried with the "continuous" tag of the docker hub but I run into a bug that has been corrected by @RoiArthurB

/home/reuillon/.openmole/simplet/.tmp/27e88307-7acd-47da-a563-d8db718e7f8d/container/cached/3d986e03b3388db071534279947be40619620549/fs/rootfs/_model_input_.xml (est un dossier)
romainreuillon commented 3 years ago

Is "continuous" the right tag?

hqnghi88 commented 3 years ago

yes it is. no idea what is that issue, may be @RoiArthurB can manage it.

RoiArthurB commented 3 years ago

Hi, I'm sorry I did forget to do the commit... 🙈🙈🙈 @romainreuillon I'll relaunch all the CI, it all should be ready in less than 30 minutes I think :)

RoiArthurB commented 3 years ago

Issue fixed with the continuous version :

$ docker run --rm -ti -v $PWD/Sibate:/sibate gamaplatform/gama:continuous -xml Sibate_MAP_and_charts /sibate/models/Sibate_om.gaml /sibate/input.xml

******************************************************************
* GAMA version 1.8.1                                             *
* http://gama-platform.org                                       *
* (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners                *
******************************************************************
> JAI/ImageIO subsystem activated
Nov 19, 2020 4:10:27 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Adding object pool: Ordered Collectors
Adding object pool: Unique Collectors
Adding object pool: Unique Ordered Collectors
> GAMA: msi.gama.core                         loaded in : 2049ms
> GAMA: ummisco.gama.serialize                loaded in : 7ms
> GAMA: msi.gaml.extensions.fipa              loaded in : 25ms
> GAMA: simtools.gaml.extensions.traffic      loaded in : 43ms
> GAMA: ummisco.gama.java2d                   loaded in : 2ms
> GAMA: ummisco.gama.network                  loaded in : 9ms
> GAMA: msi.gama.lang.gaml                    loaded in : 7ms
> GAMA: simtools.gaml.extensions.physics      loaded in : 11ms
> GAMA: ummisco.gaml.extensions.stats         loaded in : 17ms
> GAMA: irit.gaml.extensions.database         loaded in : 28ms
> GAMA: ummisco.gaml.extensions.maths         loaded in : 16ms
> GAMA: msi.gaml.architecture.simplebdi       loaded in : 135ms
> GAMA: ummisco.gama.opengl                   loaded in : 11ms
> GAMA: msi.gama.headless                     loaded in : 4ms
> GAMA total load time : 2432ms
GAMA configuring and loading...
> GAMA building GAML artefacts in : 287ms
/sibate/models/Sibate_om.gaml model is being compiled...
Adding object pool: Execution Context
Adding object pool: Agent Execution Context
Parameter file saved at: /sibate/input.xml

With this output :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Experiment_plan>
    <Simulation experiment="Sibate_MAP_and_charts" finalStep="1000" id="0" seed="1.0" sourcePath="/sibate/models/Sibate_om.gaml">
        <Parameters>
            <Parameter name="Shapefile for the buildings : " type="UNDEFINED" value="../includes/Sibate_urba_86_95.shp" var="shape_file_buildings"/>
            <Parameter name="Shapefile for the roads : " type="UNDEFINED" value="../includes/Sibate_roads.shp" var="shape_file_roads"/>
            <Parameter name="Shapefile for the safe filings: " type="UNDEFINED" value="../includes/Sibate_safe_filings.shp" var="shape_file_backfills"/>
            <Parameter name="Date : " type="UNDEFINED" value="1985-01-01 00:00:00" var="current_day"/>
            <Parameter name="End of run (one month=1440 cycles, 6 months=8640, 10 years : 175200) :" type="INT" value="175200" var="end_of_run"/>
            <Parameter name="date of securing the southern backfill, 6 years : 105120 cycles (1991 for instance):" type="INT" value="105120" var="date_backfill2"/>
            <Parameter name="date of securing the west backfill, 10 years after 1985 : 175200 cycles) : " type="INT" value="175200" var="date_backfill1"/>
            <Parameter name="demography ? " type="BOOLEAN" value="true" var="demograph"/>
            <Parameter name="% of players : " type="INT" value="5" var="percent_players"/>
            <Parameter name="% children who are exposed to the backfill : " type="INT" value="10" var="percent_expochild_backfill_0"/>
            <Parameter name="% children who contaminate : " type="INT" value="20" var="percent_expochild_contamine"/>
            <Parameter name="% of people exposed to contaminated children : " type="INT" value="10" var="percent_expo_to_child"/>
            <Parameter name="% workers working outside the area  :" type="INT" value="10" var="percent_workers_outside_area"/>
            <Parameter name="% workers who are invited : " type="INT" value="20" var="pourcent_guests"/>
            <Parameter name="Nb of carts (transport of materials) : " type="INT" value="10" var="nb_carts"/>
            <Parameter name="Nb of trucks (private and professional) : " type="INT" value="5" var="nb_trucks"/>
            <Parameter name="Nb of private trucks : " type="INT" value="1" var="nb_private_trucks"/>
            <Parameter name="% of people exposed to trucks : " type="INT" value="10" var="percent_expo_to_trucks"/>
            <Parameter name="Duration of contamination of materials (one day = 48) : " type="INT" value="48" var="material_contamination_duration"/>
            <Parameter name="% of people exposed to household materials : " type="INT" value="10" var="percent_expo_to_material"/>
            <Parameter name="distance home_safe-filings (meters) : " type="INT" value="150" var="distance_safe_filings"/>
            <Parameter name="distance walking_retirees (meters) : " type="INT" value="150" var="distance_walking_retirees"/>
            <Parameter name="Agent_size (display) : " type="INT" value="1" var="agent_size"/>
        </Parameters>
        <Outputs>
            <Output framerate="1" id="0" name="cycle : "/>
            <Output framerate="1" id="1" name="hour : "/>
            <Output framerate="1" id="2" name="day : "/>
            <Output framerate="1" id="3" name="nb children : "/>
            <Output framerate="1" id="4" name="nb workers : "/>
            <Output framerate="1" id="5" name="nb retirees : "/>
            <Output framerate="1" id="6" name="Nb of children near backfill1 : "/>
            <Output framerate="1" id="7" name="Nb of players near backfill1 : "/>
            <Output framerate="1" id="8" name="Nb of children near backfill2 : "/>
            <Output framerate="1" id="9" name="Nb of players near backfill2 : "/>
            <Output framerate="1" id="10" name="Nb exposed persons: "/>
            <Output framerate="1" id="11" name="Nb exposed workers: "/>
            <Output framerate="1" id="12" name="Nb exposed retirees: "/>
            <Output framerate="1" id="13" name="Nb exposed children: "/>
            <Output framerate="1" id="14" name="Nb persons exposures due to backfill: "/>
            <Output framerate="1" id="15" name="Nb persons exposures due to trucks: "/>
            <Output framerate="1" id="16" name="Nb persons exposures due to children: "/>
            <Output framerate="1" id="17" name="Nb persons exposures due to materials_cart: "/>
            <Output framerate="1" id="18" name="Nb persons exposures due to materials_truck: "/>
            <Output framerate="1" id="19" name="Nb children who contaminate :"/>
            <Output framerate="1" id="20" name="MAP_Sibate"/>
            <Output framerate="1" id="21" name="exposed_persons"/>
            <Output framerate="1" id="22" name="exposure_causes"/>
            <Output framerate="1" id="23" name="exposure_causes_exposed_persons_pourcent"/>
            <Output framerate="1" id="24" name="exposure_causes_exposed_persons_nb"/>
            <Output framerate="1" id="25" name="exposure_intensity"/>
            <Output framerate="1" id="26" name="nb_exposures"/>
            <Output framerate="1" id="27" name="demography"/>
        </Outputs>
    </Simulation>
</Experiment_plan>