def __reinitialize(self, subjects): """Reinitialize the study and every subjects into the pipeline Move every files and images back to the subjects directory and remove all subdirectory that may have been created by the pipeline. Remove logs directory created into the root directory of the study Args: subjects: a list of subjects """ if self.config.getboolean('arguments', 'prompt'): if util.displayYesNoMessage("Are you sure you want to reinitialize your data at is initial stage"): self.info("Reinitializing all subjects") else: self.quit("Exit the pipeline now as user request") else: self.warning("Prompt message have been disabled, reinitialisation will be force") for subject in subjects: tasksmanager = TasksManager(subject) for task in tasksmanager.getTasks(): task.cleanup() print "Clean up subject log" subject.removeLogDir()
def __submitLocal(self, subject): """Submit execution of the subject locally in a shell Args: config: a configuration structure containing pipeline options """ name = subject.getName() self.info("Evaluating which task subject {} should process".format(name)) tasksmanager = TasksManager(subject) if tasksmanager.getNumberOfRunnableTasks(): message = "Tasks : " for task in tasksmanager.getRunnableTasks(): message += "{}, ".format(task.getName()) self.info("{}will be submitted into the pipeline".format(message)) if not subject.isLock(): try: self.info("Starting subject {} at task {}".format(name, tasksmanager.getFirstRunnableTasks().getName())) subject.lock() #log versions that will be use for the pipeline execution subject.createXmlSoftwareVersionConfig(self.softwareVersions) tasksmanager.run() finally: subject.removeLock() self.info("Pipeline finish at {}, have a nice day!".format(self.getTimestamp())) else: self.__processLocksSubjects(subject) else: self.info("Subject {} already completed, it will not be submitted!".format(name))