-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG Fix
jug cleanup
for redis backend
This was a big bug: the cleanup did not preserve the active tasks at all! closes #86
- Loading branch information
Showing
4 changed files
with
38 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#-*- coding: utf-8 -*- | ||
# Copyright (C) 2009-2020, Luis Pedro Coelho <[email protected]> | ||
# Copyright (C) 2009-2022, Luis Pedro Coelho <[email protected]> | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -112,7 +112,7 @@ def cleanup(self, active, keeplocks=False): | |
existing = set(self.store.keys()) | ||
for act in active: | ||
try: | ||
existing.remove(_resultname(act)) | ||
existing.remove(_resultname(act.hash())) | ||
except KeyError: | ||
pass | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#-*- coding: utf-8 -*- | ||
# Copyright (C) 2009-2020, Luis Pedro Coelho <[email protected]> | ||
# Copyright (C) 2009-2022, Luis Pedro Coelho <[email protected]> | ||
# vim: set ts=4 sts=4 sw=4 expandtab smartindent: | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
|
@@ -119,24 +119,18 @@ def cleanup(self, active, keeplocks=False): | |
Implement 'cleanup' command | ||
''' | ||
existing = list(self.list()) | ||
for act in active: | ||
try: | ||
existing.remove(_resultname(act.hash())) | ||
except ValueError: | ||
pass | ||
|
||
if keeplocks: | ||
for lock in self.listlocks(): | ||
try: | ||
existing.remove(_lockname(lock)) | ||
except ValueError: | ||
pass | ||
|
||
existing = set(self.list()) | ||
existing -= set(act.hash() for act in active) | ||
|
||
cleaned = len(existing) | ||
for superflous in existing: | ||
self.redis.delete(_resultname(superflous)) | ||
|
||
if not keeplocks: | ||
cleaned += self.remove_locks() | ||
|
||
return cleaned | ||
|
||
def remove_locks(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters