From 26829e72847155b75be477b29c1711b0f4ecf4fd Mon Sep 17 00:00:00 2001 From: MyrikLD Date: Thu, 14 Dec 2017 15:23:07 +0300 Subject: [PATCH 1/2] Periodic jobs edit, code cleanup --- SpiderKeeper/app/spider/controller.py | 604 ++++++++++-------- SpiderKeeper/app/spider/model.py | 1 - SpiderKeeper/app/templates/job_periodic.html | 289 +++------ SpiderKeeper/app/templates/modal_job_add.html | 130 ++++ .../app/templates/modal_job_edit.html | 129 ++++ 5 files changed, 662 insertions(+), 491 deletions(-) create mode 100644 SpiderKeeper/app/templates/modal_job_add.html create mode 100644 SpiderKeeper/app/templates/modal_job_edit.html diff --git a/SpiderKeeper/app/spider/controller.py b/SpiderKeeper/app/spider/controller.py index 296126b3..f7c55b20 100644 --- a/SpiderKeeper/app/spider/controller.py +++ b/SpiderKeeper/app/spider/controller.py @@ -13,8 +13,8 @@ from flask_restful_swagger import swagger from werkzeug.utils import secure_filename -from SpiderKeeper.app import db, api, agent, app -from SpiderKeeper.app.spider.model import JobInstance, Project, JobExecution, SpiderInstance, JobRunType +from SpiderKeeper.app import agent, api, app, db +from SpiderKeeper.app.spider.model import JobExecution, JobInstance, JobRunType, Project, SpiderInstance api_spider_bp = Blueprint('spider', __name__) @@ -25,20 +25,20 @@ class ProjectCtrl(flask_restful.Resource): @swagger.operation( - summary='list projects', - parameters=[]) + summary='list projects', + parameters=[]) def get(self): return [project.to_dict() for project in Project.query.all()] @swagger.operation( - summary='add project', - parameters=[{ - "name": "project_name", - "description": "project name", - "required": True, - "paramType": "form", - "dataType": 'string' - }]) + summary='add project', + parameters=[{ + "name": "project_name", + "description": "project name", + "required": True, + "paramType": "form", + "dataType": 'string' + }]) def post(self): project_name = request.form['project_name'] project = Project() @@ -50,14 +50,14 @@ def post(self): class SpiderCtrl(flask_restful.Resource): @swagger.operation( - summary='list spiders', - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }]) + summary='list spiders', + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }]) def get(self, project_id): project = Project.find_project_by_id(project_id) return [spider_instance.to_dict() for spider_instance in @@ -66,66 +66,67 @@ def get(self, project_id): class SpiderDetailCtrl(flask_restful.Resource): @swagger.operation( - summary='spider detail', - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "spider_id", - "description": "spider instance id", - "required": True, - "paramType": "path", - "dataType": 'int' - }]) + summary='spider detail', + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "spider_id", + "description": "spider instance id", + "required": True, + "paramType": "path", + "dataType": 'int' + }]) def get(self, project_id, spider_id): spider_instance = SpiderInstance.query.filter_by(project_id=project_id, id=spider_id).first() return spider_instance.to_dict() if spider_instance else abort(404) @swagger.operation( - summary='run spider', - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "spider_id", - "description": "spider instance id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "spider_arguments", - "description": "spider arguments", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "priority", - "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", - "required": False, - "paramType": "form", - "dataType": 'int' - }, { - "name": "tags", - "description": "spider tags", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "desc", - "description": "spider desc", - "required": False, - "paramType": "form", - "dataType": 'string' - }]) + summary='run spider', + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "spider_id", + "description": "spider instance id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "spider_arguments", + "description": "spider arguments", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "priority", + "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", + "required": False, + "paramType": "form", + "dataType": 'int' + }, { + "name": "tags", + "description": "spider tags", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "desc", + "description": "spider desc", + "required": False, + "paramType": "form", + "dataType": 'string' + }]) def put(self, project_id, spider_id): spider_instance = SpiderInstance.query.filter_by(project_id=project_id, id=spider_id).first() - if not spider_instance: abort(404) + if not spider_instance: + abort(404) job_instance = JobInstance() job_instance.spider_name = spider_instance.spider_name job_instance.project_id = project_id @@ -149,94 +150,94 @@ def put(self, project_id, spider_id): class JobCtrl(flask_restful.Resource): @swagger.operation( - summary='list job instance', - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }]) + summary='list job instance', + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }]) def get(self, project_id): return [job_instance.to_dict() for job_instance in JobInstance.query.filter_by(run_type="periodic", project_id=project_id).all()] @swagger.operation( - summary='add job instance', - notes="json keys:
" + "
".join(JOB_INSTANCE_FIELDS), - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "spider_name", - "description": "spider_name", - "required": True, - "paramType": "form", - "dataType": 'string' - }, { - "name": "spider_arguments", - "description": "spider_arguments, split by ','", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "desc", - "description": "desc", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "tags", - "description": "tags , split by ','", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "run_type", - "description": "onetime/periodic", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "priority", - "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", - "required": False, - "paramType": "form", - "dataType": 'int' - }, { - "name": "cron_minutes", - "description": "@see http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_hour", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_day_of_month", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_day_of_week", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_month", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }]) + summary='add job instance', + notes="json keys:
" + "
".join(JOB_INSTANCE_FIELDS), + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "spider_name", + "description": "spider_name", + "required": True, + "paramType": "form", + "dataType": 'string' + }, { + "name": "spider_arguments", + "description": "spider_arguments, split by ','", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "desc", + "description": "desc", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "tags", + "description": "tags , split by ','", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "run_type", + "description": "onetime/periodic", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "priority", + "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", + "required": False, + "paramType": "form", + "dataType": 'int' + }, { + "name": "cron_minutes", + "description": "@see http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_hour", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_day_of_month", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_day_of_week", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_month", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }]) def post(self, project_id): post_data = request.form if post_data: @@ -261,106 +262,107 @@ def post(self, project_id): class JobDetailCtrl(flask_restful.Resource): @swagger.operation( - summary='update job instance', - notes="json keys:
" + "
".join(JOB_INSTANCE_FIELDS), - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "job_id", - "description": "job instance id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, { - "name": "spider_name", - "description": "spider_name", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "spider_arguments", - "description": "spider_arguments, split by ','", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "desc", - "description": "desc", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "tags", - "description": "tags , split by ','", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "run_type", - "description": "onetime/periodic", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "priority", - "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", - "required": False, - "paramType": "form", - "dataType": 'int' - }, { - "name": "cron_minutes", - "description": "@see http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_hour", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_day_of_month", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_day_of_week", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "cron_month", - "description": "", - "required": False, - "paramType": "form", - "dataType": 'string' - }, { - "name": "enabled", - "description": "-1 / 0, default: 0", - "required": False, - "paramType": "form", - "dataType": 'int' - }, { - "name": "status", - "description": "if set to 'run' will run the job", - "required": False, - "paramType": "form", - "dataType": 'int' - } - - ]) + summary='update job instance', + notes="json keys:
" + "
".join(JOB_INSTANCE_FIELDS), + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "job_id", + "description": "job instance id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, { + "name": "spider_name", + "description": "spider_name", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "spider_arguments", + "description": "spider_arguments, split by ','", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "desc", + "description": "desc", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "tags", + "description": "tags , split by ','", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "run_type", + "description": "onetime/periodic", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "priority", + "description": "LOW: -1, NORMAL: 0, HIGH: 1, HIGHEST: 2", + "required": False, + "paramType": "form", + "dataType": 'int' + }, { + "name": "cron_minutes", + "description": "@see http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_hour", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_day_of_month", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_day_of_week", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "cron_month", + "description": "", + "required": False, + "paramType": "form", + "dataType": 'string' + }, { + "name": "enabled", + "description": "-1 / 0, default: 0", + "required": False, + "paramType": "form", + "dataType": 'int' + }, { + "name": "status", + "description": "if set to 'run' will run the job", + "required": False, + "paramType": "form", + "dataType": 'int' + } + + ]) def put(self, project_id, job_id): post_data = request.form if post_data: job_instance = JobInstance.query.filter_by(project_id=project_id, id=job_id).first() - if not job_instance: abort(404) + if not job_instance: + abort(404) job_instance.spider_arguments = post_data.get('spider_arguments') or job_instance.spider_arguments job_instance.priority = post_data.get('priority') or job_instance.priority job_instance.enabled = post_data.get('enabled', 0) @@ -379,38 +381,38 @@ def put(self, project_id, job_id): class JobExecutionCtrl(flask_restful.Resource): @swagger.operation( - summary='list job execution status', - parameters=[{ - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }]) + summary='list job execution status', + parameters=[{ + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }]) def get(self, project_id): return JobExecution.list_jobs(project_id) class JobExecutionDetailCtrl(flask_restful.Resource): @swagger.operation( - summary='stop job', - notes='', - parameters=[ - { - "name": "project_id", - "description": "project id", - "required": True, - "paramType": "path", - "dataType": 'int' - }, - { - "name": "job_exec_id", - "description": "job_execution_id", - "required": True, - "paramType": "path", - "dataType": 'string' - } - ]) + summary='stop job', + notes='', + parameters=[ + { + "name": "project_id", + "description": "project id", + "required": True, + "paramType": "path", + "dataType": 'int' + }, + { + "name": "job_exec_id", + "description": "job_execution_id", + "required": True, + "paramType": "path", + "dataType": 'string' + } + ]) def put(self, project_id, job_exec_id): job_execution = JobExecution.query.filter_by(project_id=project_id, id=job_exec_id).first() if job_execution: @@ -545,7 +547,6 @@ def job_periodic(project_id): @app.route("/project//job/add", methods=['post']) def job_add(project_id): - project = Project.find_project_by_id(project_id) job_instance = JobInstance() job_instance.spider_name = request.form['spider_name'] job_instance.project_id = project_id @@ -565,20 +566,55 @@ def job_add(project_id): db.session.commit() agent.start_spider(job_instance) if job_instance.run_type == JobRunType.PERIODIC: - job_instance.cron_minutes = request.form.get('cron_minutes') or '0' - job_instance.cron_hour = request.form.get('cron_hour') or '*' - job_instance.cron_day_of_month = request.form.get('cron_day_of_month') or '*' - job_instance.cron_day_of_week = request.form.get('cron_day_of_week') or '*' - job_instance.cron_month = request.form.get('cron_month') or '*' # set cron exp manually if request.form.get('cron_exp'): job_instance.cron_minutes, job_instance.cron_hour, job_instance.cron_day_of_month, job_instance.cron_day_of_week, job_instance.cron_month = \ request.form['cron_exp'].split(' ') + else: + job_instance.cron_minutes = request.form.get('cron_minutes') or '0' + job_instance.cron_hour = request.form.get('cron_hour') or '*' + job_instance.cron_day_of_month = request.form.get('cron_day_of_month') or '*' + job_instance.cron_day_of_week = request.form.get('cron_day_of_week') or '*' + job_instance.cron_month = request.form.get('cron_month') or '*' db.session.add(job_instance) db.session.commit() return redirect(request.referrer, code=302) +@app.route("/project//job//edit", methods=['post']) +def job_edit(project_id, job_instance_id): + job_instance = JobInstance.query.filter_by(project_id=project_id, id=job_instance_id).first() + job_instance.spider_name = request.form['spider_name'] + job_instance.project_id = project_id + job_instance.spider_arguments = request.form['spider_arguments'] + job_instance.priority = request.form.get('priority', 0) + job_instance.run_type = request.form['run_type'] + # chose daemon manually + if request.form['daemon'] != 'auto': + spider_args = [] + if request.form['spider_arguments']: + spider_args = request.form['spider_arguments'].split(",") + spider_args.append("daemon={}".format(request.form['daemon'])) + job_instance.spider_arguments = ','.join(spider_args) + if job_instance.run_type == JobRunType.ONETIME: + job_instance.enabled = -1 + db.session.commit() + agent.start_spider(job_instance) + if job_instance.run_type == JobRunType.PERIODIC: + # set cron exp manually + if request.form.get('cron_exp'): + job_instance.cron_minutes, job_instance.cron_hour, job_instance.cron_day_of_month, job_instance.cron_day_of_week, job_instance.cron_month = \ + request.form['cron_exp'].split(' ') + else: + job_instance.cron_minutes = request.form.get('cron_minutes') or '0' + job_instance.cron_hour = request.form.get('cron_hour') or '*' + job_instance.cron_day_of_month = request.form.get('cron_day_of_month') or '*' + job_instance.cron_day_of_week = request.form.get('cron_day_of_week') or '*' + job_instance.cron_month = request.form.get('cron_month') or '*' + db.session.commit() + return redirect(request.referrer, code=302) + + @app.route("/project//jobexecs//stop") def job_stop(project_id, job_exec_id): job_execution = JobExecution.query.filter_by(project_id=project_id, id=job_exec_id).first() diff --git a/SpiderKeeper/app/spider/model.py b/SpiderKeeper/app/spider/model.py index 5376602b..d05835d9 100644 --- a/SpiderKeeper/app/spider/model.py +++ b/SpiderKeeper/app/spider/model.py @@ -131,7 +131,6 @@ def to_dict(self): cron_month=self.cron_month, enabled=self.enabled == 0, run_type=self.run_type - ) @classmethod diff --git a/SpiderKeeper/app/templates/job_periodic.html b/SpiderKeeper/app/templates/job_periodic.html index beeb9b94..493b3bae 100644 --- a/SpiderKeeper/app/templates/job_periodic.html +++ b/SpiderKeeper/app/templates/job_periodic.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content_header %} -

Periodic jobs

-
    Periodic jobs position: absolute; top: 15px; right: 10px;"> - -
+ + {% endblock %} {% block content_body %} -
-
-

Periodic jobs (Spiders)

-
-
- - - - - - - - - - - - - - - - {% for job_instance in job_instance_list %} - - - - - - - - - {% if job_instance.priority == -1 %} - - {% elif job_instance.priority == 0 %} - - {% elif job_instance.priority == 1 %} - - {% elif job_instance.priority == 2 %} - - {% endif %} - - - {% if job_instance.enabled %} - - {% else %} - - {% endif %} - - - {% endfor %} -
#MonthDay of MonthDay of WeekHourMinutesSpiderPriorityArgsTagsEnabledAction
{{ job_instance.job_instance_id }}{{ job_instance.cron_month }}{{ job_instance.cron_day_of_month }}{{ job_instance.cron_day_of_week }}{{ job_instance.cron_hour }}{{ job_instance.cron_minutes }}{{ job_instance.spider_name }} - LOW - - NORMAL - - HIGH - - HIGHEST - {{ job_instance.spider_arguments }} - {{ job_instance.tags }} - Enabled - - Disabled - - Run - Remove -
+
+
+

Periodic jobs (Spiders)

+
+
+ + + + + + + + + + + + + + + + {% for job_instance in job_instance_list %} + + + + + + + + + {% if job_instance.priority == -1 %} + + {% elif job_instance.priority == 0 %} + + {% elif job_instance.priority == 1 %} + + {% elif job_instance.priority == 2 %} + + {% endif %} + + + {% if job_instance.enabled %} + + {% else %} + + {% endif %} + + + {% include "modal_job_edit.html" %} + {% endfor %}s +
#MonthDay of MonthDay of WeekHourMinutesSpiderPriorityArgsTagsEnabledAction
{{ job_instance.job_instance_id }}{{ job_instance.cron_month }}{{ job_instance.cron_day_of_month }}{{ job_instance.cron_day_of_week }}{{ job_instance.cron_hour }}{{ job_instance.cron_minutes }}{{ job_instance.spider_name }} + LOW + + NORMAL + + HIGH + + HIGHEST + {{ job_instance.spider_arguments }}{{ job_instance.tags }} + + Enabled + + + Disabled + + + Run + + + Remove + + + Edit + +
+
-
- - {% endblock %} \ No newline at end of file diff --git a/SpiderKeeper/app/templates/modal_job_add.html b/SpiderKeeper/app/templates/modal_job_add.html new file mode 100644 index 00000000..cd12a309 --- /dev/null +++ b/SpiderKeeper/app/templates/modal_job_add.html @@ -0,0 +1,130 @@ + + \ No newline at end of file diff --git a/SpiderKeeper/app/templates/modal_job_edit.html b/SpiderKeeper/app/templates/modal_job_edit.html new file mode 100644 index 00000000..d7f28ce9 --- /dev/null +++ b/SpiderKeeper/app/templates/modal_job_edit.html @@ -0,0 +1,129 @@ + + \ No newline at end of file From bafddd55753ce3d0fd2fc55a6087ae54591c5ab6 Mon Sep 17 00:00:00 2001 From: MyrikLD Date: Fri, 15 Dec 2017 16:43:07 +0300 Subject: [PATCH 2/2] job add template for dashboard --- SpiderKeeper/app/templates/job_dashboard.html | 410 ++++++++---------- SpiderKeeper/app/templates/job_periodic.html | 4 +- SpiderKeeper/app/templates/modal_job_add.html | 142 +++--- .../app/templates/modal_job_edit.html | 2 +- 4 files changed, 249 insertions(+), 309 deletions(-) diff --git a/SpiderKeeper/app/templates/job_dashboard.html b/SpiderKeeper/app/templates/job_dashboard.html index 494b93d7..1d4f1cc9 100644 --- a/SpiderKeeper/app/templates/job_dashboard.html +++ b/SpiderKeeper/app/templates/job_dashboard.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content_header %} -

Job Dashboard

-
    Job Dashboard position: absolute; top: 15px; right: 10px;"> - -
+ + {% endblock %} {% block content_body %} - -
-
-

Next Jobs

-
- + +
+
+

Next Jobs

+
+ +
-
-
- - - - - - - - - - {% for job in job_status.PENDING %} - {% if job.job_instance %} - - - - - - {% if job.job_instance.priority == -1 %} - - {% elif job.job_instance.priority == 0 %} - - {% elif job.job_instance.priority == 1 %} - - {% elif job.job_instance.priority == 2 %} - - {% endif %} - - - {% endif %} - {% endfor %} -
#JobSpiderArgsPriorityWait
{{ job.job_execution_id }}{{ job.job_instance_id }}{{ job.job_instance.spider_name }}{{ job.job_instance.spider_arguments }} - - LOW - - NORMAL - - HIGH - - HIGHEST - {{ timedelta(now,job.create_time) }}
-
-
- - -
-
-

Running Jobs

-
- +
+ + + + + + + + + + {% for job in job_status.PENDING %} + {% if job.job_instance %} + + + + + + + + + {% endif %} + {% endfor %} +
#JobSpiderArgsPriorityWait
{{ job.job_execution_id }}{{ job.job_instance_id }}{{ job.job_instance.spider_name }}{{ job.job_instance.spider_arguments }} + + {% if job.job_instance.priority == -1 %} + LOW + {% elif job.job_instance.priority == 0 %} + NORMAL + {% elif job.job_instance.priority == 1 %} + HIGH + {% elif job.job_instance.priority == 2 %} + HIGHEST + {% endif %} + {{ timedelta(now,job.create_time) }}
-
- - - - - - - - - - - - - - {% for job in job_status.RUNNING %} - {% if job.job_instance %} - - - - - - {% if job.job_instance.priority == -1 %} - - {% elif job.job_instance.priority == 0 %} - - {% elif job.job_instance.priority == 1 %} - - {% elif job.job_instance.priority == 2 %} - - {% endif %} - - - - - - - {% endif %} - {% endfor %} -
#JobSpiderArgsPriorityRuntimeStartedLogRunning OnAction
{{ job.job_execution_id }}{{ job.job_instance_id }}{{ job.job_instance.spider_name }}{{ job.job_instance.spider_arguments }} - - LOW - - NORMAL - - HIGH - - HIGHEST - {{ timedelta(now,job.start_time) }}{{ job.start_time }}Log - {{ job.running_on }} - Stop -
-
-
- -
-
-

Completed Jobs

-
- + +
+
+

Running Jobs

+
+ +
+
+
+ + + + + + + + + + + + + + {% for job in job_status.RUNNING %} + {% if job.job_instance %} + + + + + + + + + + + + + {% endif %} + {% endfor %} +
#JobSpiderArgsPriorityRuntimeStartedLogRunning OnAction
{{ job.job_execution_id }}{{ job.job_instance_id }}{{ job.job_instance.spider_name }}{{ job.job_instance.spider_arguments }} + + {% if job.job_instance.priority == -1 %} + LOW + {% elif job.job_instance.priority == 0 %} + NORMAL + {% elif job.job_instance.priority == 1 %} + HIGH + {% elif job.job_instance.priority == 2 %} + HIGHEST + {% endif %} + {{ timedelta(now,job.start_time) }}{{ job.start_time }}Log + {{ job.running_on }} + Stop +
-
- - - - - - - - - - - - - {% for job in job_status.COMPLETED %} - {% if job.job_instance %} - - - - - - {% if job.job_instance.priority == -1 %} - - {% elif job.job_instance.priority == 0 %} - - {% elif job.job_instance.priority == 1 %} - - {% elif job.job_instance.priority == 2 %} - - {% endif %} - - - - {% if job.running_status == 2 %} - - {% else %} - - {% endif %} - - {% endif %} - {% endfor %} -
#JobSpiderArgsPriorityRuntimeStartedLogStatus
{{ job.job_execution_id }}{{ job.job_instance_id }}{{ job.job_instance.spider_name }}{{ job.job_instance.spider_arguments }} - - LOW - - NORMAL - - HIGH - - HIGHEST - {{ timedelta(job.end_time,job.start_time) }}{{ job.start_time }}Log - - FINISHED - - CANCELED -
-
-
- + {% set run_type="periodic" %} {% include "modal_job_add.html" %} diff --git a/SpiderKeeper/app/templates/modal_job_add.html b/SpiderKeeper/app/templates/modal_job_add.html index cd12a309..e559d222 100644 --- a/SpiderKeeper/app/templates/modal_job_add.html +++ b/SpiderKeeper/app/templates/modal_job_add.html @@ -9,12 +9,12 @@
- +