def post(self): title = '调度任务列表' #需要先从azkaban登陆 session_id = self.get_argument('session_id', '') login_user = self.get_argument('login_user', '') if session_id == '' or login_user == '': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name', '') query_project_name = self.get_argument('query_project_name', '') query_server_host = self.get_argument('query_server_host', '') query_user = self.get_argument('query_user', '') #列表 jobs = Job.get_alljobs(query_name, query_project_name, query_server_host, query_user, login_user) query_dict = { 'query_name': query_name, 'query_project_name': query_project_name, 'query_server_host': query_server_host, 'query_user': query_user, 'session_id': session_id, 'login_user': login_user } logging.info('query job list [%s]' % query_dict) self.render('list.html', title=title, jobs=jobs, query_dict=query_dict, azkaban_url=azkaban_url)
def post(self): title = '调度任务列表' #需要先从azkaban登陆 session_id = self.get_argument('session_id','') login_user = self.get_argument('login_user','') if session_id=='' or login_user=='': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name','') query_project_name = self.get_argument('query_project_name','') query_server_host = self.get_argument('query_server_host','') query_user = self.get_argument('query_user','') #列表 jobs = Job.get_alljobs(query_name,query_project_name,query_server_host,query_user,login_user) query_dict = { 'query_name':query_name, 'query_project_name':query_project_name, 'query_server_host':query_server_host, 'query_user':query_user, 'session_id':session_id, 'login_user':login_user } logging.info('query job list [%s]' % query_dict) self.render('list.html',title=title,jobs=jobs,query_dict=query_dict,azkaban_url=azkaban_url)
def post(self): #更新完跳转到列表页 title = '调度任务列表' #需要先从azkaban登陆 session_id = self.get_argument('session_id', '') login_user = self.get_argument('login_user', '') if session_id == '' or login_user == '': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name', '') query_project_name = self.get_argument('query_project_name', '') query_server_host = self.get_argument('query_server_host', '') query_user = self.get_argument('query_user', '') #生成job attr_list = Job.get_attr_list() dependencies_box = self.get_argument('dependencies_box', '') logging.info('>>>>>>>>>>>' + str(type(dependencies_box))) logging.info('>>>>>>>>>>>' + str(dependencies_box)) job = Job() #动态加载字段,默认均为字符串 for attr in attr_list: value = str(self.get_argument(attr, '')).strip() if value != '': setattr(job, attr, value) logging.info(attr + ':' + value) #默认设置 job.name = job.name.replace('.', '-') job.updater = login_user job.update_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) if job.creator == '': job.creator = job.updater job.create_time = job.update_time #更新 job.update_job() #列表 jobs = Job.get_alljobs(query_name, query_project_name, query_server_host, query_user, login_user) query_dict = { 'query_name': query_name, 'query_project_name': query_project_name, 'query_server_host': query_server_host, 'query_user': query_user, 'session_id': session_id, 'login_user': login_user } logging.info('[%s] update job [%s]' % (login_user, job.name)) self.render('list.html', title=title, jobs=jobs, query_dict=query_dict, azkaban_url=azkaban_url)
def post(self): op = self.get_argument('op','') if op=='show': name = self.get_argument('name','') job = Job.get_job_fromdb(name) self.write('<pre>%s</pre>' %str(job)) return title = '任务配置' #需要先从azkaban登陆 session_id = self.get_argument('session_id','') login_user = self.get_argument('login_user','') if session_id=='' or login_user=='': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name','') query_project_name = self.get_argument('query_project_name','') query_server_host = self.get_argument('query_server_host','') query_user = self.get_argument('query_user','') #任务 name = self.get_argument('name','') job = Job() if name !='': job = Job.get_job_fromdb(name) projects = Job.get_projects(login_user) jobs = Job.get_alljobs(login_user=login_user) all_jobs = Job.get_alljobs() query_dict = { 'query_name':query_name, 'query_project_name':query_project_name, 'query_server_host':query_server_host, 'query_user':query_user, 'session_id':session_id, 'login_user':login_user } logging.info('to update job [%s]' % name) self.render('to_update.html',title=title,job=job,jobs=jobs,all_jobs=all_jobs,projects=projects,query_dict=query_dict,azkaban_url=azkaban_url)
def post(self): #更新完跳转到列表页 title = '调度任务列表' #需要先从azkaban登陆 session_id = self.get_argument('session_id','') login_user = self.get_argument('login_user','') if session_id=='' or login_user=='': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name','') query_project_name = self.get_argument('query_project_name','') query_server_host = self.get_argument('query_server_host','') query_user = self.get_argument('query_user','') #生成job attr_list = Job.get_attr_list() dependencies_box = self.get_argument('dependencies_box','') logging.info('>>>>>>>>>>>'+str(type(dependencies_box))) logging.info('>>>>>>>>>>>'+str(dependencies_box)) job = Job() #动态加载字段,默认均为字符串 for attr in attr_list: value = str(self.get_argument(attr,'')).strip() if value!='': setattr(job,attr,value) logging.info(attr+':'+value) #默认设置 job.name = job.name.replace('.','-') job.updater = login_user job.update_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) if job.creator == '': job.creator = job.updater job.create_time = job.update_time #更新 job.update_job() #列表 jobs = Job.get_alljobs(query_name,query_project_name,query_server_host,query_user,login_user) query_dict = { 'query_name':query_name, 'query_project_name':query_project_name, 'query_server_host':query_server_host, 'query_user':query_user, 'session_id':session_id, 'login_user':login_user } logging.info('[%s] update job [%s]' % (login_user,job.name)) self.render('list.html',title=title,jobs=jobs,query_dict=query_dict,azkaban_url=azkaban_url)
def post(self): #需要先从azkaban登陆 op = self.get_argument('op', '') login_user = self.get_argument('login_user', '') project_name = self.get_argument('project_name', '') if login_user == '': self.render('to_login.html') return if op == 'edit': #项目 jobs = Job.get_alljobs(project_name=project_name, login_user=login_user) has_dependce_jobs = set() is_dependced_jobs = set() for job in jobs: if job.dependencies != '': has_dependce_jobs.add(job.name) is_dependced_jobs.update(job.dependencies.split(',')) for job in jobs: job.has_dependce = True if job.name in has_dependce_jobs else False job.is_dependced = True if job.name in is_dependced_jobs else False logging.info('to edit dag [%s][%s]' % (project_name, login_user)) self.render('dag_edit.html', project_name=project_name, jobs=jobs, login_user=login_user) elif op == 'save': try: nodes = self.get_argument('nodes', '') links = self.get_argument('links', '') ns = json.loads(nodes) ls = json.loads(links) Job.update_dag(login_user, ns, ls) logging.info('edit dag [%s][%s]' % (project_name, login_user)) self.write("保存成功") except Exception, e: logging.info(e) self.write('保存失败[%s]' % str(e))
def post(self): title = '任务配置' #需要先从azkaban登陆 session_id = self.get_argument('session_id', '') login_user = self.get_argument('login_user', '') if session_id == '' or login_user == '': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name', '') query_project_name = self.get_argument('query_project_name', '') query_server_host = self.get_argument('query_server_host', '') query_user = self.get_argument('query_user', '') #任务删除 name = self.get_argument('name', '') job = Job.get_job_fromdb(name) #job = Job() #job.name = name job.updater = login_user job.delete_dependencies() job.delete_job() #列表 jobs = Job.get_alljobs(query_name, query_project_name, query_server_host, query_user, login_user) query_dict = { 'query_name': query_name, 'query_project_name': query_project_name, 'query_server_host': query_server_host, 'query_user': query_user, 'session_id': session_id, 'login_user': login_user } logging.info('[%s] delete job [%s]' % (login_user, name)) self.render('list.html', title=title, jobs=jobs, query_dict=query_dict, azkaban_url=azkaban_url)
def post(self): #需要先从azkaban登陆 op = self.get_argument('op','') login_user = self.get_argument('login_user','') project_name = self.get_argument('project_name','') if login_user=='': self.render('to_login.html') return if op=='edit' : #项目 jobs = Job.get_alljobs(project_name=project_name,login_user=login_user) has_dependce_jobs = set() is_dependced_jobs = set() for job in jobs: if job.dependencies != '': has_dependce_jobs.add(job.name) is_dependced_jobs.update(job.dependencies.split(',')) for job in jobs: job.has_dependce = True if job.name in has_dependce_jobs else False job.is_dependced = True if job.name in is_dependced_jobs else False logging.info('to edit dag [%s][%s]' % (project_name,login_user)) self.render('dag_edit.html',project_name=project_name,jobs=jobs,login_user=login_user) elif op=='save' : try: nodes = self.get_argument('nodes','') links = self.get_argument('links','') ns = json.loads(nodes) ls = json.loads(links) Job.update_dag(login_user,ns,ls) logging.info('edit dag [%s][%s]' % (project_name,login_user)) self.write("保存成功") except Exception,e: logging.info(e) self.write('保存失败[%s]' % str(e))
def post(self): title = '任务配置' #需要先从azkaban登陆 session_id = self.get_argument('session_id','') login_user = self.get_argument('login_user','') if session_id=='' or login_user=='': self.render('to_login.html') return #参数 query_name = self.get_argument('query_name','') query_project_name = self.get_argument('query_project_name','') query_server_host = self.get_argument('query_server_host','') query_user = self.get_argument('query_user','') #任务删除 name = self.get_argument('name','') job = Job.get_job_fromdb(name) #job = Job() #job.name = name job.updater = login_user job.delete_dependencies() job.delete_job() #列表 jobs = Job.get_alljobs(query_name,query_project_name,query_server_host,query_user,login_user) query_dict = { 'query_name':query_name, 'query_project_name':query_project_name, 'query_server_host':query_server_host, 'query_user':query_user, 'session_id':session_id, 'login_user':login_user } logging.info('[%s] delete job [%s]' % (login_user,name)) self.render('list.html',title=title,jobs=jobs,query_dict=query_dict,azkaban_url=azkaban_url)