Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
E
esi-table-data
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esi-data-scrapping
esi-table-data
Commits
6b969122
Commit
6b969122
authored
Jul 17, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in non stop task
parent
a46ef0f5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
10 deletions
+12
-10
tasks.py
esi/scraper/tasks.py
+4
-2
views.py
esi/scraper/views.py
+5
-5
edit_job.html
esi/templates/edit_job.html
+2
-2
new_job.html
esi/templates/new_job.html
+1
-1
No files found.
esi/scraper/tasks.py
View file @
6b969122
...
...
@@ -8,16 +8,18 @@ from .models import Job
def
run_job
(
job_id
):
api
=
Service
()
api
.
update_jobs_status
()
print
(
'RUN spider
'
,
job_id
)
print
(
'RUN spider
for job: {}'
.
format
(
job_id
)
)
job
=
Job
.
objects
.
get
(
id
=
job_id
)
# run job nonstop
if
job
.
status
==
Job
.
FINISHED
and
job
.
interval
==
Job
.
NON
:
print
(
'NONSTOP'
)
api
.
run_job
(
job_id
)
else
:
print
(
'JOB NOT FINISHED YET'
)
# run job with some interval
el
if
job
.
interval
and
job
.
interval
!=
Job
.
NON
:
if
job
.
interval
and
job
.
interval
!=
Job
.
NON
:
print
(
'INTERVAL'
)
api
.
run_job
(
job_id
)
...
...
esi/scraper/views.py
View file @
6b969122
...
...
@@ -78,7 +78,7 @@ class NewJobCreateView(CreateView):
if
query
==
BAD_QUERY
:
return
HttpResponse
(
'Bad request'
,
status
=
400
)
job
=
Job
.
objects
.
create
(
name
=
name
,
spider
=
spider
,
query
=
query
)
interval
=
request
.
POST
.
get
(
'interval'
)
interval
=
request
.
POST
.
get
(
'interval'
,
''
)
.
upper
(
)
print
(
'Interval'
,
interval
)
if
interval
:
every
=
request
.
POST
.
get
(
'count'
)
...
...
@@ -127,10 +127,10 @@ class EditJobView(UpdateView):
def
schedule
(
interval
,
every
):
DAY
=
'
day
'
WEEK
=
'
week
'
MONTH
=
'
month
'
NON
=
'
nonstop
'
DAY
=
'
DAY
'
WEEK
=
'
WEEK
'
MONTH
=
'
MONTH
'
NON
=
'
NON
'
scheduler
=
{
'minute'
:
0
,
'hour'
:
0
,
...
...
esi/templates/edit_job.html
View file @
6b969122
...
...
@@ -71,10 +71,10 @@
<div
class=
"col-md-3"
>
<label
class=
"custom-control custom-radio"
>
{% if job.interval == 'nonstop' %}
<input
id=
"radio4"
name=
"interval"
value=
"non
stop
"
type=
"radio"
<input
id=
"radio4"
name=
"interval"
value=
"non"
type=
"radio"
class=
"custom-control-input"
checked
>
{% endif %}
<input
id=
"radio4"
name=
"interval"
value=
"non
stop
"
type=
"radio"
<input
id=
"radio4"
name=
"interval"
value=
"non"
type=
"radio"
class=
"custom-control-input"
>
<span
class=
"custom-control-indicator"
></span>
<span
class=
"custom-control-description"
>
After finish
</span>
...
...
esi/templates/new_job.html
View file @
6b969122
...
...
@@ -58,7 +58,7 @@
</div>
<div
class=
"col-md-3"
>
<label
class=
"custom-control custom-radio"
>
<input
id=
"radio4"
name=
"interval"
value=
"non
stop
"
type=
"radio"
<input
id=
"radio4"
name=
"interval"
value=
"non"
type=
"radio"
class=
"custom-control-input"
>
<span
class=
"custom-control-indicator"
></span>
<span
class=
"custom-control-description"
>
After finish
</span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment