Return the update intervals for all of the enabled fileserver backends
        which support variable update intervals.
499798
def update_intervals(self, back=None):
        '''
        
        '''
        back = self.backends(back)
        ret = {}
        for fsb in back:
            fstr = '{0}.update_intervals'.format(fsb)
            if fstr in self.servers:
                ret[fsb] = self.servers[fstr]()
        return ret
360484
def do_api_calls_update_cache(self):
        '''  '''

        if self.route53_enabled:
            self.get_route53_records()

        for region in self.regions:
            self.get_instances_by_region(region)
            if self.rds_enabled:
                self.get_rds_instances_by_region(region)
            if self.elasticache_enabled:
                self.get_elasticache_clusters_by_region(region)
                self.get_elasticache_replication_groups_by_region(region)

        self.write_to_cache(self.inventory, self.cache_path_cache)
        self.write_to_cache(self.index, self.cache_path_index)
273365
def update_continuously(records, update_interval=600):
    """"""
    while True:
        for record in records:
            try:
                record.update()
            except (ApiError, RequestException):
                pass
        time.sleep(update_interval)
1098309
async def process_updates(self, updates, fast: typing.Optional[bool] = True):
        
        if fast:
            tasks = []
            for update in updates:
                tasks.append(self.updates_handler.notify(update))
            return await asyncio.gather(*tasks)

        results = []
        for update in updates:
            results.append(await self.updates_handler.notify(update))
        return results
1170570
def _get_paths_for_status(self, status):
        
        added, modified, deleted = self._changes_cache
        return sorted({
            'added': list(added),
            'modified': list(modified),
            'deleted': list(deleted)}[status]
        )
1065307
def available_backends():
    """"""
    print 'The following LiveSync agents are available:'
    for name, backend in current_plugin.backend_classes.iteritems():
        print cformat('  - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
1060223
def clear_cache(self, back=None):
        '''
        
        '''
        back = self.backends(back)
        cleared = []
        errors = []
        for fsb in back:
            fstr = '{0}.clear_cache'.format(fsb)
            if fstr in self.servers:
                log.debug('Clearing %s fileserver cache', fsb)
                failed = self.servers[fstr]()
                if failed:
                    errors.extend(failed)
                else:
                    cleared.append(
                        'The {0} fileserver cache was successfully cleared'
                        .format(fsb)
                    )
        return cleared, errors
1371895
def find_updates_since(time)
      stamp = time.to_i # Get timestamp
      result = self.class.get("/Updates.php?type=all&time=#{stamp}")['Items']
      { :series => result['Series'],
        :episodes => result['Episode'],
        :time => result['Time'] }
    end
219694
def list_backends():
    """"""
    return [b.name.replace(".py", "") for b in
            os.scandir(os.path.join(MODULE_DIR, "backends"))
            if "__" not in b.name]
349528
private List<ServerConnection> updateServerList() {
        final Map<Endpoint, ServerConnection> allServersByEndpoint = allServers
                .stream()
                .collect(toImmutableMap(ServerConnection::endpoint,
                                        Function.identity(),
                                        (l, r) -> l));
        return allServers = delegate
                .endpoints()
                .stream()
                .map(endpoint -> {
                    ServerConnection connection = allServersByEndpoint.get(endpoint);
                    if (connection != null) {
                        return connection;
                    }
                    return new ServerConnection(endpoint, createEndpointHealthChecker(endpoint));
                })
                .collect(toImmutableList());
    }
814105
def update(self):
        """"""
        if self.client_mode == 'glances':
            return self.update_glances()
        elif self.client_mode == 'snmp':
            return self.update_snmp()
        else:
            self.end()
            logger.critical("Unknown server mode: {}".format(self.client_mode))
            sys.exit(2)
1177436
def requested_intervals(self, intervals):
        
        with switch_db(WorkflowStatusModel, db_alias='hyperstream'):
            workflow_statuses = WorkflowStatusModel.objects(workflow_id=self.workflow_id)
            if len(workflow_statuses) != 1:
                workflow_status = WorkflowStatusModel(
                    workflow_id=self.workflow_id,
                    requested_intervals=[]
                )

            else:
                workflow_status = workflow_statuses[0]

            workflow_status.last_updated = utcnow()
            workflow_status.last_accessed = utcnow()
            workflow_status.requested_intervals = tuple(
                map(lambda x: TimeIntervalModel(start=x.start, end=x.end), intervals))

            workflow_status.save()
820967
def ReadClientLastPings(self,
                          min_last_ping=None,
                          max_last_ping=None,
                          fleetspeak_enabled=None,
                          cursor=None):
    """"""
    query = "SELECT client_id, UNIX_TIMESTAMP(last_ping) FROM clients "
    query_values = []
    where_filters = []
    if min_last_ping is not None:
      where_filters.append("last_ping >= FROM_UNIXTIME(%s) ")
      query_values.append(mysql_utils.RDFDatetimeToTimestamp(min_last_ping))
    if max_last_ping is not None:
      where_filters.append(
          "(last_ping IS NULL OR last_ping <= FROM_UNIXTIME(%s))")
      query_values.append(mysql_utils.RDFDatetimeToTimestamp(max_last_ping))
    if fleetspeak_enabled is not None:
      if fleetspeak_enabled:
        where_filters.append("fleetspeak_enabled IS TRUE")
      else:
        where_filters.append(
            "(fleetspeak_enabled IS NULL OR fleetspeak_enabled IS FALSE)")

    if where_filters:
      query += "WHERE " + "AND ".join(where_filters)
    cursor.execute(query, query_values)
    last_pings = {}
    for int_client_id, last_ping in cursor.fetchall():
      client_id = db_utils.IntToClientID(int_client_id)
      last_pings[client_id] = mysql_utils.TimestampToRDFDatetime(last_ping)
    return last_pings
219817
def get_releases(data, **kwargs):
    
    if "versions" in data:
        return sorted(data["versions"].keys(), key=lambda v: parse(v), reverse=True)
    return []
342879
def get_backends_versions(self):
        
        # We are not always have permission, so find open.
        for i in range(0, len(self.organizations)):
            try:
                backends = self.organizations[i].environments['default'].backends
            except ApiAuthenticationError:
                pass
            else:
                break
        versions = dict([(x['name'], x['version']) for x in backends])
        return versions
1169553
def suspended_updates():
    
    if getattr(local_storage, "bulk_queue", None) is None:
        local_storage.bulk_queue = defaultdict(list)

    try:
        yield
    finally:
        for index, items in local_storage.bulk_queue.items():
            index.bulk(chain(*items))
        local_storage.bulk_queue = None
500631
function getUpdates() {
		return _client.method('WaitForUpdatesEx', {
			_this: _client._updatesCollector,
			version: _client._updatesVersion,
			options: {
				maxWaitSeconds: 0
			}
		})
		.then(function(set) {
			if (set) {

				// update the version
				_client._updatesVersion = set.version;
				
				// get only the updates
				var updates   = [];
				var filterSet = _.get(set, 'filterSet');
				filterSet     = Array.isArray(filterSet) ? filterSet : [filterSet];
				
				// loop through the filter sets
				_.forEach(filterSet, function(f) {
					
					var objectSet = _.get(f, 'objectSet');
					objectSet     = Array.isArray(objectSet) ? objectSet : [objectSet];
					
					// format the objects
					_.forEach(objectSet, function(u) {
						u.obj = {
							type: _.get(u, 'obj.attributes.type'),
							id: _.get(u, 'obj.$value')
						};
						
						// make the change set an array
						u.changeSet = Array.isArray(u.changeSet) ? u.changeSet : [u.changeSet];
						
						// update change set
						_.forEach(u.changeSet, function(c) {
							c.val = _.get(c, 'val.$value');
						});
						
						// push the update
						updates.push(u);
					});
				});

				// emit the results
				_client.emit('updates', updates);
			}
		});
	}