Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jadbin committed Sep 28, 2016
1 parent d7949d6 commit f962a35
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xpaw/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def run(self, args):
k = self._format_key(args.unset)
config = self._load_config()
if k in config:
config.pop(k)
del config[k]
self._save_config(config)
elif args.unset_all:
if os.path.isfile(cli.CONFIG_FILE):
Expand Down
10 changes: 5 additions & 5 deletions xpaw/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ def _load_task_config(self, task_id):

def _remove_task_config(self, task_id):
self._remove_custom_objects(task_id)
self._config.pop(task_id)
del self._config[task_id]

def _remove_custom_objects(self, task_id):
self._downloadermw.pop(task_id)
self._spider.pop(task_id)
self._spidermw.pop(task_id)
del self._downloadermw[task_id]
del self._spider[task_id]
del self._spidermw[task_id]

def _load_custom_objects(self, task_id, task_config, code_dir):
# add project path
Expand Down Expand Up @@ -304,7 +304,7 @@ def gc(self, task_set):
for t in del_task:
self._set.remove(t)
self._producers[t].stop()
self._producers.pop(t)
del self._producers[t]

def push_request(self, topic, req):
log.debug("Push request (url={0}) into the topic '{1}'".format(req.url, topic))
Expand Down
6 changes: 3 additions & 3 deletions xpaw/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ def insert_config(self, task_id, task_config_zip):
def get_info(self, task_id):
task_info = self._info_tbl.find_one({"_id": ObjectId(task_id)})
if task_info:
task_info.pop("_id")
del task_info["_id"]
return task_info

def get_progress(self, task_id):
task_progress = self._progress_tbl.find_one({"_id": ObjectId(task_id)})
if task_progress:
task_progress.pop("_id")
del task_progress["_id"]
return task_progress


Expand Down Expand Up @@ -287,7 +287,7 @@ def recheck(self):
for task_id in [i for i in self._last_modified.keys()]:
if t - self._last_modified[task_id] > self._task_finished_delay:
log.debug("The task '{0}' has not been updated in the last {1} seconds".format(task_id, self._task_finished_delay))
self._last_modified.pop(task_id)
del self._last_modified[task_id]
self._finish_task(task_id)

def _update_database(self, task_id, completed, total):
Expand Down
4 changes: 2 additions & 2 deletions xpaw/mqcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ def _remove_topic(self, topic):
finally:
if producer:
producer.stop()
self._mq.pop(topic)
del self._mq[topic]
self._consumers[topic].stop()
self._consumers.pop(topic)
del self._consumers[topic]

0 comments on commit f962a35

Please sign in to comment.