(self, client: "BusClient")
return dict(
            process_name=self.process_name,
            service_name=self.service_name,
            metrics_enabled=client.plugin_registry.is_plugin_loaded(MetricsPlugin),
            api_names=[api.meta.name for api in client.api_registry.public()],
            listening_for=[
                "{}.{}".format(api_name, event_name) for api_name, event_name in event_listeners
            ],
            timestamp=datetime.utcnow().timestamp(),
            ping_enabled=self.ping_enabled,
            ping_interval=self.ping_interval,
            hostname=socket.gethostname(),
            pid=os.getpid(),
            max_memory_use=max_memory_use,
        )
Get the kwargs for a worker_started or ping message
Get the kwargs for a worker_started or ping message
Get the kwargs for a worker_started or ping message
def get_state_kwargs(self, client: "BusClient"):
        """Get the kwargs for a worker_started or ping message"""
        if resource:
            max_memory_use = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
        else:
            # The resource module isn't available on windows. Set to zero
            max_memory_use = 0

        event_listeners = chain(
            *[event_listener.events for event_listener in client.event_client._event_listeners]
        )
        return dict(
            process_name=self.process_name,
            service_name=self.service_name,
            metrics_enabled=client.plugin_registry.is_plugin_loaded(MetricsPlugin),
            api_names=[api.meta.name for api in client.api_registry.public()],
            listening_for=[
                "{}.{}".format(api_name, event_name) for api_name, event_name in event_listeners
            ],
            timestamp=datetime.utcnow().timestamp(),
            ping_enabled=self.ping_enabled,
            ping_interval=self.ping_interval,
            hostname=socket.gethostname(),
            pid=os.getpid(),
            max_memory_use=max_memory_use,
        )
def get_state_kwargs ( self , client : "BusClient" ) : if resource : max_memory_use = resource . getrusage ( resource . RUSAGE_SELF ) . ru_maxrss else : # The resource module isn't available on windows. Set to zero max_memory_use = 0 event_listeners = chain ( * [ event_listener . events for event_listener in client . event_client . _event_listeners ] ) return dict ( process_name = self . process_name , service_name = self . service_name , metrics_enabled = client . plugin_registry . is_plugin_loaded ( MetricsPlugin ) , api_names = [ api . meta . name for api in client . api_registry . public ( ) ] , listening_for = [ "{}.{}" . format ( api_name , event_name ) for api_name , event_name in event_listeners ] , timestamp = datetime . utcnow ( ) . timestamp ( ) , ping_enabled = self . ping_enabled , ping_interval = self . ping_interval , hostname = socket . gethostname ( ) , pid = os . getpid ( ) , max_memory_use = max_memory_use , )