Commit ec7067f5 authored by Ronan Trepos's avatar Ronan Trepos
Browse files

update siwaa

parent e7bd4add
## build the docker image
docker build -t rtrepos/azodyn_test container
docker build -t rtrepos/azodyn_pea:test container
## list images
......@@ -9,35 +9,39 @@ docker images
## run image
docker run rtrepos/azodyn_test ls
docker run rtrepos/azodyn_pea:test ls
docker run -it rtrepos/azodyn_test R #ouvre session R
docker run -it rtrepos/azodyn_pea:test R #ouvre session R
### push image on docker hub
docker login
docker push rtrepos/azodyn_test:latest
# pusher pour la production
docker push rtrepos/azodyn_pea:prod
#pusher pour les test (avec planemo)
docker push rtrepos/azodyn_pea:test
## 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"
docker run -v $PWD:/work rtrepos/azodyn_pea /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R /work/file_input.csv /work/file_output.csv 3 > 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 --cleanenv -B $PWD:/work docker://rtrepos/azodyn_pea:prod /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R /work/file_input.csv /work/file_output.csv 3 > /work/razodyn.txt"
# with singularity without mounted PWD
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"
singularity exec docker://rtrepos/azodyn_pea:test /bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R file_input.csv file_output.csv 5"
####planemo
cd galaxy_tools ;
planemo serve --job_config_file ./job_conf.xml tools_AZODYN.xml
planemo serve --job_config_file ../job_conf.xml tools_AZODYN.xml
## publish on toolshed
......
FROM debian:buster-slim
RUN env \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
......@@ -11,7 +12,7 @@ ENV VLE_HOME=/data
WORKDIR /data
RUN git clone https://github.com/rtrepos/vle.git \
&& cd vle \
&& cd vle \
&& git checkout origin/manager -b manager \
&& mkdir build \
&& cd build \
......@@ -23,6 +24,9 @@ RUN git clone https://github.com/rtrepos/vle.git \
&& rm -fr build
RUN R --vanilla -e 'install.packages("RUnit", repos="http://cran.us.r-project.org")'
RUN R --vanilla -e 'install.packages("ggplot2", repos="http://cran.us.r-project.org")'
RUN R --vanilla -e 'install.packages("gridExtra", repos="http://cran.us.r-project.org")'
RUN R --vanilla -e 'install.packages("reshape2", repos="http://cran.us.r-project.org")'
RUN git clone https://github.com/rtrepos/rvle.git \
&& cd rvle \
......@@ -52,7 +56,7 @@ RUN cd RECORD/pkgs \
&& vle -P vle.discrete-time.generic clean rclean configure build
RUN git clone https://forgemia.inra.fr/record/azodyn.git \
&& cd azodyn \
&& cd azodyn \
&& git checkout origin/siwaa -b siwaa \
&& vle -P AZODYN configure build
......
id;path;integration
"LAI";"view/AzodynPea:PlantGrowthPea.LAI";"all"
categories: [AgroEcosystems]
description: Azodyn simulations tool
name: razodyn
description: AzodynPea experiment plan simulation
name: azodyn_pea
owner: siwaa
<macros>
<xml name="slurm_task_account">
<section name="slurmadv" title="Advanced Options for Slurm" expanded="false">
<param name="account" type="text" value="record" label="Slurm account name" />
<param name="ntasks" type="integer" value="5" min="5" max="5" label="Slurm number of tasks" />
</section>
</xml>
<xml name="slurm_account">
<section name="slurmadv" title="Advanced Options for Slurm" expanded="false">
<param name="account" type="text" value="record" label="Slurm account name" />
</section>
</xml>
</macros>
<tool id="razodyn" name="razodyn" version="1.0.0">
<tool id="AzodynPea" name="AzodynPea experiment plan simulation" version="1.0.0">
<description></description>
<requirements>
<container type="singularity">docker://rtrepos/azodyn_test:latest</container>
<container type="singularity">docker://rtrepos/azodyn_pea:prod</container>
</requirements>
<command detect_errors="aggressive">
unzip ${input_meteo};
/bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R ${file_input} ${file_outputs} 3";
zip temp_results.zip razodyn_results_*.txt;
cp temp_results.zip ${razodyn_results};
/bin/bash -c "Rscript --verbose /data/azodyn/siwaa_recipe/razodyn.R ${file_input} ${file_outputs} 5";
zip temp_results.zip azodyn_plot.png azodyn_results_*.txt;
cp temp_results.zip ${azodyn_results};
</command>
<macros>
<import>siwaa_macros.xml</import>
</macros>
<inputs>
<param name="input_meteo" type="data" format="zip" label="input meteo (zip file)"/>
<param name="file_input" type="data" format="csv" label="azodyn inputs"/>
<param name="file_outputs" type="data" format="csv" label="azodyn outputs"/>
<expand macro="slurm_task_account" />
</inputs>
<outputs>
<data format="zip" name="razodyn_results" />
<data format="zip" name="azodyn_results" />
</outputs>
<help>
razodyn help
input meteo zip containing eg:
==============================
meteo1.csv and meteo2.csv
AZODYN inputs eg:
=================
cPlant.coef_tot_a;condClimate.meteo_file
1.25;meteo1.csv
1.5;meteo1.csv
1.0;meteo2.csv
1.25;meteo2.csv
AZODYN outputs eg:
==================
id;path;integration
"LAI";"view/AzodynPea:PlantGrowthPea.LAI";"all"
</help>
</tool>
##
# Rscript --verbose razodyn.R file_input.csv file_outputs.csv 3 > razodyn.txt
# Rscript --verbose razodyn.R file_input.csv file_output.csv 5 > 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 = "file_input.csv";
file_input = "file_input.csv";
file_output = "file_output.csv";
nbslots = 5
###config from args
args=(commandArgs(TRUE))
file_input = as.character(args[1]);
## mycond1.myport1;mycond2.myport2;;mycond3.myport3
# # mycond1.myport1;mycond2.myport2;;mycond3.myport3
# 2.5;coucou;4
# 2.6;bye;1
# 2.4;pffff;6
#file_output = "file_outputs.csv";
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 = 3
# #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)
......@@ -35,10 +38,9 @@ f = rvle.open("AzodynPea.vpz", "AZODYN")
rvle.set_log_level(f, 7);
rvle.plan_config(f, parallel_nb_slots=nbslots, parallel_rm_files=TRUE,
parallel_type="cvle", parallel_spawn=F,
generate_hostfile=TRUE,
working_dir=getwd());
rvle.plan_config(vleObj=f, parallel_option = "mpi", nb_slots = nbslots,
simulation_spawn = F, rm_MPI_files = T,
generate_MPI_host = T, working_dir = getwd());
inputs = rvleExp.parseSim(file_sim=file_input, vleObj=f, skip=0)
......@@ -49,9 +51,16 @@ for (i in 1:nrow(outs)) {
rvle.plan_output(vleObj=f, id=outs$id[i], path=outs$path[i],
integration=outs$integration[i])
}
res = rvle.plan_run(f)
for (i in 1:nrow(outs)) {
write.table(res[[outs$id[i]]], file=paste(sep="", 'razodyn_results_',outs$id[i],'.txt'),
write.table(res[[outs$id[i]]], file=paste(sep="", 'azodyn_results_',outs$id[i],'.txt'),
row.names=F, col.names=F, sep=";")
}
png(filename="azodyn_plot.png", width = 1000, height = 1000)
rvleExp.plot(res)
dev.off()
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