# HG changeset patch # User siwaa # Date 1722621796 0 # Node ID 986f43279bcafed16491322fc59c2341bb5cc025 planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/use/-/tree/gama/GAMA_HEADLESS_LEGACY/galaxy-tools/gama_legacy_run commit 14769577c04bcb2781b2d240f1f57a2342169cce-dirty diff -r 000000000000 -r 986f43279bca gama_legacy_run.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gama_legacy_run.xml Fri Aug 02 18:03:16 2024 +0000 @@ -0,0 +1,87 @@ + + + tool running an experiment plan XML file associated with a GAML file (GAMA Headless Legacy mode) + + + + + oras://registry.forgemia.inra.fr/nathalie.rousse/use/gama_headless:e45168638437055475beeaa614611cb315a56fca + + + + + + exp/RUN.txt; + rm -fr exp/outputs/.workspace*; + zip -r tmp_result exp; + mv tmp_result.zip ${result_zip}; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 986f43279bca src/MY_gama-headless.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/MY_gama-headless.sh Fri Aug 02 18:03:16 2024 +0000 @@ -0,0 +1,79 @@ +#!/bin/bash + +javaVersion=$(java -version 2>&1 | head -n 1 | cut -d "\"" -f 2) +# Check if good Java version before everything +if [[ ${javaVersion:2} == 17 ]]; then + echo "You should use Java 17 to run GAMA" + echo "Found you using version : $javaVersion" + exit 1 +fi + +memory="0" + +for arg do + shift + case $arg in + -m) + memory="${1}" + shift + ;; + *) + set -- "$@" "$arg" + ;; + esac +done + +if [[ $memory == "0" ]]; then + memory=$(grep Xmx "$( dirname $( realpath "${BASH_SOURCE[0]}" ) )"/../Gama.ini || echo "-Xmx4096m") +else + memory=-Xmx$memory +fi + +workspaceCreate=0 +case "$@" in + *-help*|*-version*|*-validate*|*-test*|*-xml*|*-batch*|*-write-xmi*|*-socket*) + workspaceCreate=1 + ;; +esac + + +echo "******************************************************************" +echo "* GAMA version 1.9.1 *" +echo "* http://gama-platform.org *" +echo "* (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners *" +echo "******************************************************************" +passWork=.workspace +# w/ output folder +if [ $workspaceCreate -eq 0 ]; then + # create output folder if not existing + if [ ! -d "${@: -1}" ]; then + mkdir ${@: -1} + fi + # create workspace in output folder + passWork=${@: -1}/.workspace$(find ${@: -1} -name ".workspace*" | wc -l) + mkdir -p $passWork + +# w/o output folder +else + # create workspace in current folder + passWork=.workspace$(find ./ -maxdepth 1 -name ".workspace*" | wc -l) +fi + +#if ! java -cp "$( dirname $( realpath "${BASH_SOURCE[0]}" ) )"/../plugins/org.eclipse.equinox.launcher*.jar -Xms512m $memory -Djava.awt.headless=true org.eclipse.core.launcher.Main -configuration "$( dirname $( realpath "${BASH_SOURCE[0]}" ) )"/configuration -application msi.gama.headless.product -data $passWork "$@"; then + +MY_JAVA_DIR=./_java +MY_JAVA_SYSTEM_PREFS_DIR=${MY_JAVA_DIR}/.systemPrefs +MY_JAVA_USER_PREFS_DIR=${MY_JAVA_DIR}/.userPrefs +mkdir -p ${MY_JAVA_DIR} +mkdir -p ${MY_JAVA_SYSTEM_PREFS_DIR} +mkdir -p ${MY_JAVA_USER_PREFS_DIR} +chmod -R 777 ${MY_JAVA_DIR} + +MY_TEMP_DIR=. + +if ! java -cp "$( dirname $( realpath "${BASH_SOURCE[0]}" ) )"/../plugins/org.eclipse.equinox.launcher*.jar -Xms512m $memory -Djava.io.tmpdir=$MY_TEMP_DIR -Djava.util.prefs.systemRoot=${MY_JAVA_DIR} -Djava.util.prefs.userRoot=${MY_JAVA_USER_PREFS_DIR} -Djava.awt.headless=true org.eclipse.core.launcher.Main -configuration "$( dirname $( realpath "${BASH_SOURCE[0]}" ) )"/configuration -application msi.gama.headless.product -data $passWork "$@"; then + echo "Error in you command, here's the log :" + cat $passWork/.metadata/.log + exit 1 +fi + diff -r 000000000000 -r 986f43279bca src/cmd_gama_headless_legacy_run.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cmd_gama_headless_legacy_run.sh Fri Aug 02 18:03:16 2024 +0000 @@ -0,0 +1,23 @@ +#!/bin/bash + +# Headless Legacy mode. +# +# Command to run an experiment plan XML file associated with a GAML file : +# ./gama-headless.sh /path/to/file.xml /path/to/generated/outputFolder +# with: +# - /path/to/file.xml: path (relative or absolute) to the XML file +# containing the full exploration plan to run by the headless. +# - /path/to/generated/outputFolder: path (relative or absolute) +# which will be generated by GAMA and hold every output files +# (variables, snapshots, and console messages). + +# With : +# - GAMA application in folder ./software +# - [input] XML file path : ./exp/file.xml +# - [input] GAML file (associated with XML file) path : ./exp/model.gaml +# - [output] the outputs folder ./exp/outputs + +HOME=$(echo $PWD) +cd software/gama-platform/headless; +/bin/bash MY_gama-headless.sh ${HOME}/exp/file.xml ${HOME}/exp/outputs +