def setUp(self): self.repos = phlgitu_fixture.CentralisedWithTwoWorkers() self.repo_central = self.repos.central_repo self.repo_dev = self.repos.w0.repo sys_repo = self.repos.w1.repo refcache_repo = phlgitx_refcache.Repo(sys_repo) differ_cache = abdt_differresultcache.Cache(refcache_repo) self.repo_arcyd = abdt_git.Repo(refcache_repo, differ_cache, 'origin', 'myrepo')
def process(args): _ = args # NOQA fs = abdt_fs.make_default_accessor() with fs.lockfile_context(): pid = fs.get_pid_or_none() if pid is not None and phlsys_pid.is_running(pid): raise Exception("cannot fetch whilst arcyd is running.") repo_config_path_list = fs.repo_config_path_list() repo_name_config_list = abdi_repoargs.parse_config_file_list( repo_config_path_list) url_watcher_wrapper = phlurl_watcher.FileCacheWatcherWrapper( fs.layout.urlwatcher_cache_path) # Let the user know what's happening before potentially blocking for a # while. print('Refreshing repository snoop status ..', end=' ') # Make sure that the output is actually visible by flushing stdout # XXX: Will use 'flush' parameter to 'print()' in Python 3.3 sys.stdout.flush() print("done") url_watcher_wrapper.watcher.refresh() for repo_name, repo_config in repo_name_config_list: print(repo_name + ' ..', end=' ') # Make sure that the output is actually visible by flushing stdout # XXX: Will use 'flush' parameter to 'print()' in Python 3.3 sys.stdout.flush() snoop_url = abdi_repoargs.get_repo_snoop_url(repo_config) sys_repo = phlsys_git.Repo(repo_config.repo_path) refcache_repo = phlgitx_refcache.Repo(sys_repo) differ_cache = abdt_differresultcache.Cache(refcache_repo) abd_repo = abdt_git.Repo(refcache_repo, differ_cache, "origin", repo_config.repo_desc) did_fetch = abdi_processrepoarglist.fetch_if_needed( url_watcher_wrapper.watcher, snoop_url, abd_repo, repo_config.repo_desc) if did_fetch: print('fetched') else: print('skipped') url_watcher_wrapper.save()
def __init__(self, repo_name, repo_args, conduit_manager, url_watcher_wrapper, sys_admin_emails, mail_sender): self._active_state = _RepoActiveRetryState( retry_timestr_list=["10 seconds", "10 minutes", "1 hours"]) sys_repo = phlsys_git.Repo(repo_args.repo_path) self._refcache_repo = phlgitx_refcache.Repo(sys_repo) self._differ_cache = abdt_differresultcache.Cache(self._refcache_repo) self._abd_repo = abdt_git.Repo(self._refcache_repo, self._differ_cache, "origin", repo_args.repo_desc) self._name = repo_name self._args = repo_args self._conduit_manager = conduit_manager conduit_cache = conduit_manager.get_conduit_and_cache_for_args( repo_args) self._arcyd_conduit, self._review_cache = conduit_cache self._mail_sender = mail_sender self._url_watcher_wrapper = url_watcher_wrapper self._mail_sender = mail_sender self._on_exception = abdt_exhandlers.make_exception_delay_handler( sys_admin_emails, repo_name)