def newUser(self, user): """ New User has been found, need to communicate to myself and all workers the new details A new Database is created And the engine commences watching the logfile. Args: user (string): string value of the user """ self.logger.info("New User Requested") # Reset class variables for controlling logic and data self.first = True self.logLines = [] self.needBuffer = True self.user = user self.liveLog = self.rootDirectory + "/" + self.user + "/images/livelogfile.log" self.datFileLocation = self.rootDirectory + "/" + self.user + "/raw_dat/" # Generate Directory Structure createFolderStructure(self.rootDirectory, self.user) self.logger.info("Directory Structure Created") # Update all workers self.sendCommand({"command": "update_user", "user": self.user}) self.sendCommand({"command": "absolute_directory", "absolute_directory": self.rootDirectory + "/" + self.user}) self.createDB() # Start waiting for log to appear self.watchForLogLines(self.liveLog) # Start waiting for the Log
def setupExperiment(self, user, experimentFolder = ""): """ New User or Experiment has been found, need to communicate to myself and all workers the new details A new Database is created And the engine commences watching the logfile. Args: user (string): string value of the user """ self.logger.info("Setting up new experiment") #Reset class variables for controlling logic and data self.first = True self.logLines = [] self.needBuffer = True absolute_directory = os.path.join(self.rootDirectory, user, experimentFolder) self.liveLog = os.path.join(absolute_directory, "images", "livelogfile.log") self.datFileLocation = os.path.join(absolute_directory, "raw_dat") #Generate Directory Structure createFolderStructure(absolute_directory) self.logger.info("Directory Structure Created") #Update all workers self.sendCommand({"command":"update_user", "user":user}) self.sendCommand({"command":"absolute_directory","absolute_directory":absolute_directory}) dbname = "_".join(filter(None, [user, experimentFolder])) self.createDB(dbname) #Start waiting for log to appear self.watchForLogLines(self.liveLog) # Start waiting for the Log