Removed usage of update time concept

Fixes bug 1201445

Change-Id: Ie9eff190cc680873eaaf64474e0382910257b66c
This commit is contained in:
Ilya Shakhat 2013-07-15 18:36:09 +04:00
parent 90d6e1cd43
commit e6b0ef52af
2 changed files with 0 additions and 55 deletions

View File

@ -13,15 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import time
from oslo.config import cfg
import psutil
from psutil import _error
import sh
from stackalytics.openstack.common import log as logging
from stackalytics.openstack.common import timeutils
from stackalytics.processor import commit_processor
from stackalytics.processor import persistent_storage
from stackalytics.processor import runtime_storage
@ -37,11 +33,6 @@ OPTS = [
help='The folder that holds all project sources to analyze'),
cfg.StrOpt('runtime-storage-uri', default='memcached://127.0.0.1:11211',
help='Storage URI'),
cfg.StrOpt('frontend-update-address',
default='http://user:user@localhost/update/%s',
help='Address of update handler'),
cfg.StrOpt('repo-poll-period', default='300',
help='Repo poll period in seconds'),
cfg.StrOpt('persistent-storage-uri', default='mongodb://localhost',
help='URI of persistent storage'),
cfg.BoolOpt('sync-default-data', default=False,
@ -76,21 +67,11 @@ def get_pids():
return result
def update_pid(pid):
url = cfg.CONF.frontend_update_address % pid
sh.curl(url)
def update_pids(runtime_storage):
pids = get_pids()
if not pids:
return
runtime_storage.active_pids(pids)
current_time = time.time()
for pid in pids:
if current_time > runtime_storage.get_pid_update_time(pid):
update_pid(pid)
return current_time
def process_repo(repo, runtime_storage, processor):
@ -114,14 +95,6 @@ def process_repo(repo, runtime_storage, processor):
def update_repos(runtime_storage, persistent_storage):
current_time = time.time()
repo_update_time = runtime_storage.get_repo_update_time()
if current_time < repo_update_time:
LOG.info('The next update is scheduled at %s. Skipping' %
timeutils.iso8601_from_timestamp(repo_update_time))
return
repos = persistent_storage.get_repos()
processor = commit_processor.CommitProcessorFactory.get_processor(
commit_processor.COMMIT_PROCESSOR_CACHED,
@ -130,9 +103,6 @@ def update_repos(runtime_storage, persistent_storage):
for repo in repos:
process_repo(repo, runtime_storage, processor)
runtime_storage.set_repo_update_time(time.time() +
int(cfg.CONF.repo_poll_period))
def main():
# init conf and logging

View File

@ -47,18 +47,6 @@ class RuntimeStorage(object):
def active_pids(self, pids):
pass
def get_pid_update_time(self, pid):
pass
def set_pid_update_time(self, pid, time):
pass
def get_repo_update_time(self):
pass
def set_repo_update_time(self, time):
pass
class MemcachedStorage(RuntimeStorage):
@ -126,7 +114,6 @@ class MemcachedStorage(RuntimeStorage):
for pid in stored_pids:
if pid not in pids:
self.memcached.delete('pid:%s' % pid)
self.memcached.delete('pid_update_time:%s' % pid)
self.memcached.set('pids', pids)
@ -147,18 +134,6 @@ class MemcachedStorage(RuntimeStorage):
self.memcached.set('first_valid_update_id', min_update)
def get_pid_update_time(self, pid):
return self.memcached.get('pid_update_time:%s' % pid) or 0
def set_pid_update_time(self, pid, time):
self.memcached.set('pid_update_time:%s' % pid, time)
def get_repo_update_time(self):
return self.memcached.get('repo_update_time') or 0
def set_repo_update_time(self, time):
self.memcached.set('repo_update_time', time)
def _get_update_count(self):
return self.memcached.get('update:count') or 0