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
5c88a5a0
Commit
5c88a5a0
authored
Jul 13, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add update jobs status for running them non stop
parent
2043a712
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
12 deletions
+1
-12
tasks.py
esi/scraper/tasks.py
+1
-12
No files found.
esi/scraper/tasks.py
View file @
5c88a5a0
...
@@ -4,18 +4,12 @@ from .service import Service
...
@@ -4,18 +4,12 @@ from .service import Service
from
.models
import
Job
from
.models
import
Job
@
shared_task
def
add
(
x
,
y
):
print
(
'ADDDDDDDDDDDDD'
)
return
x
+
y
@
shared_task
@
shared_task
def
run_job
(
job_id
):
def
run_job
(
job_id
):
api
=
Service
()
api
=
Service
()
api
.
update_jobs_status
()
print
(
'RUN spider'
,
job_id
)
print
(
'RUN spider'
,
job_id
)
job
=
Job
.
objects
.
get
(
id
=
job_id
)
job
=
Job
.
objects
.
get
(
id
=
job_id
)
print
(
job
)
# run job nonstop
# run job nonstop
if
job
.
status
==
Job
.
FINISHED
and
job
.
interval
==
Job
.
NON
:
if
job
.
status
==
Job
.
FINISHED
and
job
.
interval
==
Job
.
NON
:
...
@@ -27,9 +21,4 @@ def run_job(job_id):
...
@@ -27,9 +21,4 @@ def run_job(job_id):
print
(
'INTERVAL'
)
print
(
'INTERVAL'
)
api
.
run_job
(
job_id
)
api
.
run_job
(
job_id
)
# run only one time
elif
job
.
status
==
Job
.
PENDING
and
not
job
.
interval
:
print
(
'ONE time'
)
api
.
run_job
(
job_id
)
job
.
schedule_job
.
delete
()
return
'spider was running'
return
'spider was running'
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