def finish_script(self, xnat, flagfile, project_list, type_update, start_end, project_local): """ Finish script for any of the main methods: build/update/launch :param flagfile: flag file for the method to run :param project_list: List of projects that were updated by the method :param type_update: What type of process ran: dax_build (1), dax_update_tasks (2), dax_launch (3) :param start_end: starting timestamp (1) and ending timestamp (2) :param project_local: project to run locally :return: None """ if not project_local: self.unlock_flagfile(flagfile) #Set the date on REDCAP for update ending bin.upload_update_date_redcap(project_list, type_update, start_end) xnat.disconnect() LOGGER.info('Connection to XNAT closed')
def finish_script(self, xnat, flagfile, project_list, type_update, start_end, project_local): """ Finish script for any of the main methods: build/update/launch :param flagfile: flag file for the method to run :param project_list: List of projects that were updated by the method :param type_update: What type of process ran: dax_build (1), dax_update_tasks (2), dax_launch (3) :param start_end: starting timestamp (1) and ending timestamp (2) :param project_local: project to run locally :return: None """ if not project_local: self.unlock_flagfile(flagfile) #Set the date on REDCAP for update ending bin.upload_update_date_redcap(project_list, type_update, start_end) if xnat: xnat.disconnect() LOGGER.info('Connection to XNAT closed')
def init_script(self, flagfile, project_local, type_update, start_end): """ Init script for any of the main methods: build/update/launch :param flagfile: flag file for the method to run :param project_local: project to run locally :param type_update: What type of process ran: dax_build (1), dax_update_tasks (2), dax_launch (3) :param start_end: starting timestamp (1) and ending timestamp (2) :return: None """ if project_local: if ',' in project_local: mess = """too much projects ID given to the option\ --project : {proj}. Only for one project.""" mess_str = mess.format(proj=project_local) LOGGER.error(mess_str) exit(1) elif project_local in self.project_process_dict.keys(): #Updating session for a specific project project_list = [project_local] else: mess = """failed to run locally on project {proj}.\ The project is not part of the settings.""" mess_str = mess.format(proj=project_local) LOGGER.error(mess_str) exit(1) else: success = self.lock_flagfile(flagfile) if not success: LOGGER.warn('failed to get lock. Already running.') exit(1) #Get default project list for XNAT out of the module and process dict ulist = set(self.project_process_dict.keys() + self.project_modules_dict.keys()) project_list = sorted(ulist) #Set the date on REDCAP for update starting bin.upload_update_date_redcap(project_list, type_update, start_end) return project_list
def init_script(self, flagfile, project_local, type_update, start_end): """ Init script for any of the main methods: build/update/launch :param flagfile: flag file for the method to run :param project_local: project to run locally :param type_update: What type of process ran: dax_build (1), dax_update_tasks (2), dax_launch (3) :param start_end: starting timestamp (1) and ending timestamp (2) :return: None """ if project_local: if ',' in project_local: mess = """too much projects ID given to the option\ --project : {proj}. Only for one project.""" mess_str = mess.format(proj=project_local) LOGGER.error(mess_str) exit(1) elif project_local in self.project_process_dict.keys(): #Updating session for a specific project project_list = [project_local] else: mess = """failed to run locally on project {proj}.\ The project is not part of the settings.""" mess_str = mess.format(proj=project_local) LOGGER.error(mess_str) exit(1) else: success = self.lock_flagfile(flagfile) if not success: LOGGER.warn('failed to get lock. Already running.') exit(1) #Get default project list for XNAT out of the module and process dict ulist = set(self.project_process_dict.keys()+self.project_modules_dict.keys()) project_list = sorted(ulist) #Set the date on REDCAP for update starting bin.upload_update_date_redcap(project_list, type_update, start_end) return project_list