Add speedyf/job_manager.py
This commit is contained in:
parent
5af0e5b05a
commit
33c94d64c1
18
speedyf/job_manager.py
Normal file
18
speedyf/job_manager.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class JobManager:
|
||||||
|
def __init__(self):
|
||||||
|
self.jobs = {}
|
||||||
|
|
||||||
|
def create_job(self, job_id):
|
||||||
|
self.jobs[job_id] = {state: 'pending', fetch_url: None, error:None}
|
||||||
|
|
||||||
|
def set_job_state(self, job_id, state):
|
||||||
|
self.jobs[job_id]['state'] = state
|
||||||
|
|
||||||
|
def set_fetch_url(self, job_id, url):
|
||||||
|
self.jobs[job_id]['fetch_url'] = url
|
||||||
|
|
||||||
|
def set_error(self, job_id, error):
|
||||||
|
self.jobs[job_id]['error'] = error
|
||||||
|
|
||||||
|
def get_job_status(self, job_id):
|
||||||
|
return self.jobs.get(job_id, {})
|
Loading…
Reference in New Issue
Block a user