Julien Dehos il y a 7 ans
Parent
commit
24d90b69c2
6 fichiers modifiés avec 60 ajouts et 13 suppressions
  1. 1 0
      .gitignore
  2. 0 13
      bin/double_n.sh
  3. 14 0
      bin/mul.sh
  4. 12 0
      bin/run_mul.sh
  5. 23 0
      compile_csv/compile_csv.py
  6. 10 0
      oar_basic/oar_basic.sh

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.*~

+ 0 - 13
bin/double_n.sh

@@ -1,13 +0,0 @@
-#!/bin/sh
-
-if [ $# -ne 1 ] ; then
-    echo "usage: $0 <n>"
-    exit
-fi
-
-n1=$1
-n2=`echo "${n1} * 2" | bc`
-
-echo "n1;n2"
-echo "${n1};${n2}"
-

+ 14 - 0
bin/mul.sh

@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ $# -ne 2 ] ; then
+    echo "usage: $0 <x> <y>"
+    exit
+fi
+
+x=$1
+y=$2
+r=`echo "$x * $y" | bc`
+
+echo "x;y;r"
+echo "$x;$y;$r"
+

+ 12 - 0
bin/run_mul.sh

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+OUTDIR="../output"
+
+params=`echo $@ | tr " " "_"`
+output_path="${OUTDIR}/mul_`hostname`_`date +%Y-%m-%d`_`date +%H-%M-%S`_${params}.csv"
+
+mkdir -p ${OUTDIR}
+echo $@
+
+../bin/mul.sh $@ 1> ${output_path}
+

+ 23 - 0
compile_csv/compile_csv.py

@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import sys, glob, pandas
+
+# get command line arguments
+if len(sys.argv) < 2:
+    print('usage:', sys.argv[0], ' input_dir output_file')
+    sys.exit(-1)
+input_dir = sys.argv[1]
+output_file = sys.argv[2]
+
+# read csv files and append dataframe
+df = pandas.DataFrame()
+for csv_file in glob.glob(input_dir + '*.csv'):
+    try:
+        file_df = pandas.read_csv(csv_file, sep=';')
+        df = df.append(file_df, ignore_index=True)
+    except:
+        print('warning:', csv_file, 'is empty')
+
+# export dataframe to csv
+df.to_csv(output_file, index=False, sep=';')
+

+ 10 - 0
oar_basic/oar_basic.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+#OAR -l /core=1,walltime=00:05:00
+
+##OAR -p host="orval02"
+##OAR --notify mail:toto@univ-littoral.fr
+
+../bin/run_mul.sh 2 3
+../bin/run_mul.sh 2 4
+