def main(): args = parser.parse_args() # Check and sanitize user input args = check_input(args) # Create logfile to track the analysis, overwrite it if it exist ("w+" mode) time_stamp = time.strftime("%Y%m%d-%H%M%S") logfile = os.path.join(args.outpath, f"{time_stamp}_{args.outname}_logfile_temp.out") logger(logfile, w_mode="w+") # Record executed command command = " ".join(sys.argv) print(f"\n{command}\n", flush=True) # Run analysis try: transfix_gtf = transfix_main(args.gtf, args.fasta, args.outpath, args.outname, iter_th=args.iter_th, chimeric=args.chimeric) # Annotate additional features (UTR, start/stop codons) _ = add_features_to_gtf(transfix_gtf) except SystemExit as err: # Valid for python 3.5+ print("".join(traceback.TracebackException.from_exception(err).format())) except Exception as err: print("".join(traceback.TracebackException.from_exception(err).format())) sys.exit(f"{err}") clean_log(logfile)
def __init__(self,parameters,audit_entires): self.parameters = parameters self.audit_entires = audit_entires self.process_cmd_txt = [] self.logger = logger(self.parameters["log_dir"],self.parameters["log_file"],self.__class__.__name__).get() self.logger.info("ParameterEvaluation API Started")
def __init__(self, parameters): self.parameters = parameters self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], 'SQLExecutor:' + self.__class__.__name__).get() self.logger.info("ParameterEvaluation API Started")
def __init__(self, parameters): self.parameters = parameters self.cmd = [] self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], 'IICSCTaskRunner:' + self.__class__.__name__).get() self.logger.info("Command Runner API has Started")
def __init__(self, parameters): self.parameters = parameters self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], 'BCPRunner:' + self.__class__.__name__).get() self.logger.info("Session API Started") # Decrypting connection info using gpg utility self.DB_CONN_NM = self.parameters["DB_CONN_NM"] # gpg_cmd = "gpg --yes --batch --output - --passphrase=%s --decrypt %s | grep %s" % (base64.b64decode(settings.GPG_PASSPHRASE).decode(),settings.GPG_CONN_FILE,self.DB_CONN_NM) gpg_cmd = "gpg --yes --batch --output - --passphrase=%s --decrypt %s" % ( base64.b64decode( settings.GPG_PASSPHRASE).decode(), settings.GPG_CONN_FILE) grep_cmd = "grep %s" % self.DB_CONN_NM self.logger.info("gpg command to be executed : %s" % gpg_cmd) try: process_connstr = subprocess.Popen(shlex.split(gpg_cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) process_conndtl = subprocess.Popen(shlex.split(grep_cmd), stdin=process_connstr.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) conn_dtl, stderr = process_conndtl.communicate() if len(conn_dtl.strip()) == 0: self.logger.error( "Connection Details of CONN_NM are not part of entry. Please give entry" ) raise Exception( "Connection Details of CONN_NM are not part of entry. Please give entry" ) conn_info = conn_dtl.decode().split("|") self.DB_CONN_NM = conn_info[0] self.SERVER_HOST = conn_info[1] self.SERVER_PORT = conn_info[2] self.DB_NM = conn_info[3] self.SCH_NM = conn_info[4] self.USER_NM = conn_info[5] self.PASS_TX = conn_info[6] except Exception as err: self.logger.error("Error reading or decrypting connection file") self.logger.error("Error stacktrace : %s" % err) sys.exit(1) self.logger.info("Audit Database connection name : %s" % (self.DB_CONN_NM)) self.logger.info("Audit Database Server URL : %s" % (self.SERVER_HOST)) self.logger.info("Audit Database Server Port : %s" % (self.SERVER_PORT)) self.logger.info("Audit Database name : %s" % (self.DB_NM)) self.logger.info("Audit Database Schema name : %s" % (self.SCH_NM)) self.logger.info("Audit Database User name : %s" % (self.USER_NM))
def __init__(self, parameters, audit_entires, session): self.parameters = parameters self.audit_entires = audit_entires self.session = session # added to handle checkpoints self.process_cmd_txt = [] self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], self.__class__.__name__).get() self.logger.info("CommandRunner API Started")
def __init__(self, parameters): self.parameters = parameters self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], 'IICSCTaskRunner:' + self.__class__.__name__).get() self.logger.info("Parameter file creation Started")
def __init__(self, parameters): #Import logger self.parameters = parameters self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], self.__class__.__name__).get() self.logger.info("Session API Started") #Decrypting connection info using gpg utility self.DB_ADT_CONN_NM = settings.DB_ADT_CONN_NM #gpg_cmd = "gpg --yes --batch --output - --passphrase=%s --decrypt %s | grep %s" % (base64.b64decode(settings.GPG_PASSPHRASE).decode(),settings.GPG_CONN_FILE,self.DB_ADT_CONN_NM) gpg_cmd = "gpg --yes --batch --output - --passphrase=%s --decrypt %s" % ( base64.b64decode( settings.GPG_PASSPHRASE).decode(), settings.GPG_CONN_FILE) grep_cmd = "grep %s" % settings.DB_ADT_CONN_NM self.logger.info("gpg command to be executed : %s" % gpg_cmd) try: process_connstr = subprocess.Popen(shlex.split(gpg_cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) process_conndtl = subprocess.Popen(shlex.split(grep_cmd), stdin=process_connstr.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) conn_dtl, stderr = process_conndtl.communicate() if len(conn_dtl.strip()) == 0: self.logger.error( "Connection Details of CONN_NM are not part of entry. Please give entry" ) raise Exception( "Connection Details of CONN_NM are not part of entry. Please give entry" ) conn_info = conn_dtl.decode().split("|") self.DB_ADT_CONN_NM = conn_info[0] self.SERVER_HOST = conn_info[1] self.SERVER_PORT = conn_info[2] self.ADT_DB_NM = conn_info[3] self.ADT_SCH_NM = conn_info[4] self.USER_NM = conn_info[5] self.PASS_TX = conn_info[6] except Exception as err: self.logger.error("Error reading or decrypting connection file") self.logger.error("Error stacktrace : %s" % err) sys.exit(1) # self.DB_ADT_CONN_NM = settings.DB_ADT_CONN_NM # self.SERVER_HOST = settings.SERVER_HOST # self.SERVER_PORT = settings.SERVER_PORT # self.ADT_DB_NM = settings.ADT_DB_NM # self.ADT_SCH_NM = settings.ADT_SCH_NM # self.USER_NM = settings.USER_NM # self.PASS_TX = base64.b64decode(settings.PASS_TX).decode() #settings.PASS_TX self.logger.info("Audit Database connection name : %s" % (self.DB_ADT_CONN_NM)) self.logger.info("Audit Database Server URL : %s" % (self.SERVER_HOST)) self.logger.info("Audit Database Server Port : %s" % (self.SERVER_PORT)) self.logger.info("Audit Database name : %s" % (self.ADT_DB_NM)) self.logger.info("Audit Database Schema name : %s" % (self.ADT_SCH_NM)) self.logger.info("Audit Database User name : %s" % (self.USER_NM)) self.logger.info("Creating a Session to Audit Database") try: connection_str = 'Driver={ODBC Driver 17 for SQL Server};Server=tcp:' + self.SERVER_HOST + ',' + self.SERVER_PORT + ';Database=' + self.ADT_DB_NM + ';Uid=' + self.USER_NM + '@' + self.SERVER_HOST.split( "." )[0] + ';Pwd=' + self.PASS_TX + ';Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;' connection = pyodbc.connect(connection_str) self.cursor = connection.cursor() if self.cursor is not None: self.logger.info("Cursor object created successfully") self.logger.info( self.cursor.execute("SELECT @@VERSION;").fetchone()) except Exception as err: self.logger.error( "Error while creating database connection. Please check connection entries" ) self.logger.error("Error Stacktrace : %s" % (err)) sys.exit(1)
def __init__(self,parameters): self.parameters = parameters # self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"], self.__class__.__name__).get() self.logger = logger(self.parameters["log_dir"], self.parameters["log_file"],'BCPRunner:'+self.__class__.__name__).get() self.logger.info("BCP Runner Started")