Commit 89eddd49 authored by Ronan Trepos's avatar Ronan Trepos
Browse files

add siwaa recipe

parent bdb543e4
## build the docker image
docker build -t rtrepos/azodyn_test container
## list images
docker images
## run image
docker run rtrepos/azodyn_test ls
docker run -it rtrepos/azodyn_test R #ouvre session R
### push image on docker hub
docker login
docker push rtrepos/azodyn_test:latest
## run image with climate outside
cp ../AZODYN/data/Breteniere_1991_2018.csv Breteniere_1991_2018_test.csv
docker run -v $PWD:/work rtrepos/azodyn_test /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R /work/file_input.csv /work/file_outputs.csv > razodyn.txt"
# with singularity
cp ../AZODYN/data/Breteniere_1991_2018.csv Breteniere_1991_2018_test.csv
singularity exec --cleanenv -B $PWD:/work docker://rtrepos/azodyn_test:latest /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R /work/file_input.csv /work/file_outputs.csv > /work/razodyn.txt"
singularity exec docker://rtrepos/azodyn_test:latest /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R file_input.csv file_outputs.csv 3"
FROM debian:buster-slim
RUN env \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
curl git libxml2-dev libboost-dev make cmake pkg-config g++ gfortran asciidoctor ruby-asciidoctor ninja-build libopenmpi-dev libopenmpi3 zip unzip\
r-base\
&& rm -rf /var/lib/apt/lists/*
ENV VLE_HOME=/data
WORKDIR /data
RUN mkdir /data/pkgs-2.0
RUN git clone https://github.com/vle-forge/vle.git \
&& cd vle \
&& git checkout tags/v2.0.2 -b v2.0.2 \
&& mkdir build \
&& cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_CVLE=ON -DWITH_GVLE=OFF \
&& ninja \
&& ninja install \
&& vle-2.0 --restart \
&& ctest --output-on-failure \
&& rm -fr build
RUN R --vanilla -e 'install.packages("RUnit", repos="http://cran.us.r-project.org")'
RUN git clone https://github.com/vle-forge/rvle.git \
&& cd rvle \
&& git checkout origin/master2.0 -b v2.0
RUN tar cfz rvle.tar.gz rvle \
&& rm -rf rvle
RUN R CMD INSTALL rvle.tar.gz
RUN git clone https://github.com/vle-forge/packages.git \
&& cd packages \
&& git checkout master
RUN cd packages \
&& vle -P vle.reader clean rclean configure build \
&& vle -P vle.tester clean rclean configure build \
&& vle -P vle.discrete-time clean rclean configure build \
&& vle -P vle.recursive clean rclean configure build
RUN git clone https://forgemia.inra.fr/record/RECORD.git \
&& cd RECORD \
&& git checkout master
RUN cd RECORD/pkgs \
&& vle -P record.meteo clean rclean configure build \
&& vle -P record.meteo_test clean rclean configure build test\
&& vle -P vle.discrete-time.generic clean rclean configure build
RUN git clone https://forgemia.inra.fr/record/azodyn.git \
&& cd azodyn \
&& git checkout -b siwaa origin/siwaa \
&& vle -P AZODYN configure build
WORKDIR /work
cPlant.coef_tot_a;condClimate.meteo_file
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
1.25;Breteniere_1991_2018_test.csv
1.5;Breteniere_1991_2018_test.csv
1.0;Breteniere_1991_2018_test.csv
id;path;integration
"LAI";"view/AzodynPea:PlantGrowthPea.LAI";"all"
<tool id="razodyn" name="razodyn" version="1.0.0">
<description></description>
<requirements>
<container type="singularity">docker://rtrepos/azodyn_test:latest</container>
</requirements>
<command detect_errors="aggressive">
cp ${input_meteo} /data/pkgs-2.0/AZODYN/data/;
Rscript --verbose razodyn.R ${file_input} ${file_outputs} > ${razodyn_log}";
zip ${razodyn_results} razodyn_results_*;
</command>
<inputs>
<param name="input_meteo" type="data" format="csv" label="input meteo"/>
<param name="file_input" type="data" format="csv" label="azodyn inputs"/>
<param name="file_outputs" type="data" format="csv" label="azodyn outputs"/>
</inputs>
<outputs>
<data format="zip" name="razodyn_results" />
<data format="txt" name="razodyn_log" />
</outputs>
<help>
razodyn help
</help>
</tool>
##
# Rscript --verbose razodyn.R file_input.csv file_outputs.csv 3 > razodyn.txt
##
print(Sys.info())
Sys.setenv(VLE_HOME = "/data")
args=(commandArgs(TRUE))
file_define = "file_define.csv";
file_propagate = "file_propagate.csv";
file_replicate = "file_replicate.csv";
file_input = args[1];
## mycond1.myport1;mycond2.myport2;;mycond3.myport3
# 2.5;coucou;4
# 2.6;bye;1
# 2.4;pffff;6
file_output = args[2];
##id of output, path, integration, aggregation_replicate, aggregation_input, replicate_quantile, time1, obs1, time2, obs2, ...
#myid1;myview/atomic.Port1;"last";"quantile";"all";0.2;123;0.5;138;0.8
nbslots = as.integer(args[3])
##
library(rvle)
source(paste(sep="", Sys.getenv("VLE_HOME"),"/pkgs-2.0/vle.recursive/R/vle.recursive.R"))
print(paste("getwd:",getwd()))
print(paste("dir(getwd()):",dir(getwd())))
f = vle.recursive.init(pkg="AZODYN", file="AzodynPea.vpz")
vle.recursive.configSimulation(f, config_parallel_nb_slots=3, config_parallel_rm_files=TRUE,
config_parallel_type="cvle", config_parallel_spawn=F, working_dir=getwd(), expe_log=6);
inputs = vle.recursive.parseSim(file_sim=file_input, rvle_handle=f, skip=0)
vle.recursive.configPropagate(f, propagate="condClimate.PkgName", value="")
outs = read.table(file_output, sep=";",header=T, stringsAsFactors=F)
for (i in 1:nrow(outs)) {
vle.recursive.configOutput(rvle_handle=f, id=outs$id[i], path=outs$path[i],
integration=outs$integration[i])
}
res = vle.recursive.simulate(f)
for (i in 1:nrow(outs)) {
write.table(res[[outs$id[i]]], file=paste(sep="", 'razodyn_results_',outs$id[i],'.txt'),
row.names=F, col.names=F, sep=";")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment