From a47c191bb9be796fe61e7a2069a0156992f0adb8 Mon Sep 17 00:00:00 2001
From: AxelCarayon <axel.carayon@gmail.com>
Date: Tue, 1 Feb 2022 17:21:09 +0100
Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20possibilit=C3=A9=20d'ajouter?=
 =?UTF-8?q?=20un=20fichier=20d'instruction?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 loadExperiment.py     |  5 ++---
 registerExperiment.py | 18 ++++++++++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/loadExperiment.py b/loadExperiment.py
index 3d753fa..e8bb82e 100644
--- a/loadExperiment.py
+++ b/loadExperiment.py
@@ -47,6 +47,7 @@ def getParameters() -> None :
         inputFiles = parameters.get('inputs')
         beforeHash = parameters.get('checksums')
 
+
 def runExperiment() -> None :
     file = open(commandsFile, "r")
     for line in file.read().splitlines():
@@ -92,6 +93,4 @@ def run(repository, branch) -> None :
     if (compareChecksums()) : 
         print("The exepriment was reproduced with succes but some output files are differents.")
     else :
-        print("The exepriment was reproduced with succes !")
-    
-#TODO : laisser à l'utilisateur le temps de reproduire l'experience
\ No newline at end of file
+        print("The exepriment was reproduced with succes !")
\ No newline at end of file
diff --git a/registerExperiment.py b/registerExperiment.py
index df348cf..f667035 100644
--- a/registerExperiment.py
+++ b/registerExperiment.py
@@ -17,7 +17,8 @@ inputFiles = []
 paramsFolder = None
 paramsFiles = []
 
-commandsFile = "commands.txt"
+commandsFile = None
+instructionFile = None
 
 experimentName = None
 
@@ -111,11 +112,19 @@ def searchForParamsFolder() -> None:
 def askForCommandsFile() -> None:
     global commandsFile
     commandsFile = input("Enter the name of the commands file: ")
-    if commandsFile == "":
-        raise Exception("No commands file given")
     if not fileExists(commandsFile):
         raise Exception(f"{commandsFile} file does not exist")
 
+def askForInstructionFile() -> None :
+    global instructionFile
+    print("If you have an instruction file, enter its name, otherwise press enter")
+    instructionFile = input()
+    if instructionFile == "":
+        warnings.warn("No instruction file given, make sure you give instructions to reproduce the experiment along with it")
+    else:
+        if not fileExists(instructionFile):
+            raise Exception(f"{instructionFile} file does not exist")
+
 def registeringExperimentInputs(inputs) -> None:
     with open(commandsFile, "w") as file:
         for input in inputs:
@@ -224,6 +233,7 @@ def run(folder) -> None :
         askForCommandsFile()
         runExperiment()
     else:
+        askForInstructionFile()
         done = ""
         while(done != "done"):
             done = input("Run your experiment and then type 'done' when you are done : ")
@@ -235,4 +245,4 @@ def run(folder) -> None :
         scanParameters()
     checkGeneratedFiles()
     writeInYaml()
-    pushBranch()
+    #pushBranch()
-- 
GitLab