def RunWithPars(pars, uid): startTime = Common.getCurrentTimeMil() reposFol = 'SavePath/Repos/' if not os.path.exists(config.basedir + '/' + reposFol): os.makedirs(config.basedir + '/' + reposFol) fname = reposFol + Common.gen_rnd_filename() os.makedirs(config.basedir + '/' + fname) ##ADD Field e = Repo() e.cloneFinishDate = "--RUNNING--" e.cloneStartDate = str(startTime) e.repoInfo = '' e.isPrivate = int(pars['isPrivate']) e.path = fname e.repoName = pars['repoName'] e.url = pars['url'] e.userId = uid db.session.add(e) db.session.commit() try: porcelain.clone(pars['url'], config.basedir + '/' + fname) endTime = Common.getCurrentTimeMil() e.cloneFinishDate = str(endTime) db.session.commit() except Exception as ex: print(ex) e.delete() db.session.commit()