From a19ecec0224aeee1e79d65d4a622f1607c2c6f3c Mon Sep 17 00:00:00 2001 From: Firmlyzhu Date: Sat, 22 Dec 2018 16:59:33 +0800 Subject: [PATCH 1/2] change http url to https url & csrf token --- src/master/jobmgr.py | 10 ++++++++++ web/templates/batch/batch_create.html | 15 +++++++-------- web/templates/batch/batch_output.html | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/master/jobmgr.py b/src/master/jobmgr.py index e758d79..d9d6e11 100644 --- a/src/master/jobmgr.py +++ b/src/master/jobmgr.py @@ -22,7 +22,10 @@ class BatchJob(object): def top_sort(self): logger.debug('top sorting') tasks = self.raw_job_info["tasks"] + logger.debug('top sorting test') dependency_graph = {} + logger.debug('top sorting test2') + logger.info(tasks) for task_idx in tasks: dependency_graph[task_idx] = set() task_info = tasks[task_idx] @@ -33,6 +36,7 @@ class BatchJob(object): if not t in tasks: raise ValueError('task %s is not defined in the dependency of task %s' % (t, task_idx)) dependency_graph[task_idx].add(t) + logger.debug('top sorting end') while len(dependency_graph) > 0: s = set() flag = False @@ -54,6 +58,7 @@ class BatchJob(object): 'task_idx': s, 'status': 'pending' }) + logger.debug('top sorting return') # get a task and pass it to taskmgr def get_task(self): @@ -89,11 +94,15 @@ class JobMgr(threading.Thread): # user submit a new job, add this job to queue and database def add_job(self, user, job_info): try: + logger.info(self.job_queue) job = BatchJob(user, job_info) + logger.info("test2") job.job_id = self.gen_jobid() + logger.info("test3") self.job_queue.append(job.job_id) self.job_map[job.job_id] = job except ValueError as err: + logger.error(err) return [False, err.args[0]] except Exception as err: return [False, err.args[0]] @@ -104,6 +113,7 @@ class JobMgr(threading.Thread): # list a user's all job def list_jobs(self,user): res = [] + logger.info(self.job_queue) for job_id in self.job_queue: job = self.job_map[job_id] logger.debug('job_id: %s, user: %s' % (job_id, job.user)) diff --git a/web/templates/batch/batch_create.html b/web/templates/batch/batch_create.html index 31945f6..532a1d1 100644 --- a/web/templates/batch/batch_create.html +++ b/web/templates/batch/batch_create.html @@ -42,6 +42,7 @@
+
@@ -79,21 +80,19 @@ {% endblock %} {% block script_src %} - - - + - + - + - - - + + +