fixed Issue #3

This commit is contained in:
Marvin Zhang
2019-03-23 21:03:27 +08:00
parent d94c3adc8a
commit f624779da5
2 changed files with 5 additions and 5 deletions

View File

@@ -159,7 +159,7 @@ class SpiderApi(BaseApi):
db_manager.save('tasks', {
'_id': job.id,
'spider_id': ObjectId(id),
'create_ts': datetime.now(),
'create_ts': datetime.utcnow(),
'status': TaskStatus.PENDING
})
@@ -252,7 +252,7 @@ class SpiderApi(BaseApi):
db_manager.save('deploys', {
'spider_id': ObjectId(id),
'node_id': node_id,
'finish_ts': datetime.now()
'finish_ts': datetime.utcnow()
})
return {

View File

@@ -41,7 +41,7 @@ def execute_spider(self, id: str):
# create a new task
db_manager.update_one('tasks', id=task_id, values={
'start_ts': datetime.now(),
'start_ts': datetime.utcnow(),
'node_id': hostname,
'hostname': hostname,
'log_file_path': log_file_path,
@@ -72,11 +72,11 @@ def execute_spider(self, id: str):
# save task when the task is finished
db_manager.update_one('tasks', id=task_id, values={
'start_ts': datetime.now(),
'start_ts': datetime.utcnow(),
'node_id': hostname,
'hostname': hostname,
'log_file_path': log_file_path,
'finish_ts': datetime.now(),
'finish_ts': datetime.utcnow(),
'status': status
})
task = db_manager.get('tasks', id=id)