clearml_agent/commands/worker.py
def should_be_currently_active(self, current_queue, runtime_properties):
        """
        Checks if a worker is active according to queue tags, worker's runtime properties and uptime schedule.
        """
        runtime_properties = runtime_properties or []
        if UptimeConf.queue_tag_off in current_queue['tags']:
            self.log.debug("Queue {} is tagged '{}', worker will not pull tasks".format(
                current_queue['name'], UptimeConf.queue_tag_off)
            )
            return False
        if UptimeConf.queue_tag_on in current_queue['tags']:
            self.log.debug("Queue {} is tagged '{}', worker will pull tasks".format(
                current_queue['name'], UptimeConf.queue_tag_on)
            )
            return True
        force_flag = next(
            (prop for prop in runtime_properties if prop["key"] == UptimeConf.worker_key), None
        )
        if force_flag:
            if force_flag["value"].lower() in UptimeConf.worker_value_off:
                self.log.debug("worker has the following runtime property: '{}'. worker will not pull tasks".format(
                    force_flag)
                )
                return False
            elif force_flag["value"].lower() in UptimeConf.worker_value_on:
                self.log.debug("worker has the following runtime property: '{}'. worker will pull tasks".format(
                    force_flag)
                )
                return True
            else:
                print(
                    "Warning: invalid runtime_property '{}: {}' supported values are: '{}/{}', ignoring".format(
                        force_flag["key"], force_flag["value"], UptimeConf.worker_value_on, UptimeConf.worker_value_off
                    )
                )
        if self._uptime_config:
            self.log.debug("following uptime configurations")
            return check_runtime(self._uptime_config)
        if self._downtime_config:
            self.log.debug("following downtime configurations")
            return check_runtime(self._downtime_config, is_uptime=False)
        return True

        Checks if a worker is active according to queue tags, worker's runtime properties and uptime schedule.
        
Checks if a worker is active according to queue tags, worker's runtime properties and uptime schedule.
Checks if a worker is active according to queue tags worker ' s runtime properties and uptime schedule .
def should_be_currently_active(self, current_queue, runtime_properties):
        runtime_properties = runtime_properties or []
        if UptimeConf.queue_tag_off in current_queue['tags']:
            self.log.debug("Queue {} is tagged '{}', worker will not pull tasks".format(
                current_queue['name'], UptimeConf.queue_tag_off)
            )
            return False
        if UptimeConf.queue_tag_on in current_queue['tags']:
            self.log.debug("Queue {} is tagged '{}', worker will pull tasks".format(
                current_queue['name'], UptimeConf.queue_tag_on)
            )
            return True
        force_flag = next(
            (prop for prop in runtime_properties if prop["key"] == UptimeConf.worker_key), None
        )
        if force_flag:
            if force_flag["value"].lower() in UptimeConf.worker_value_off:
                self.log.debug("worker has the following runtime property: '{}'. worker will not pull tasks".format(
                    force_flag)
                )
                return False
            elif force_flag["value"].lower() in UptimeConf.worker_value_on:
                self.log.debug("worker has the following runtime property: '{}'. worker will pull tasks".format(
                    force_flag)
                )
                return True
            else:
                print(
                    "Warning: invalid runtime_property '{}: {}' supported values are: '{}/{}', ignoring".format(
                        force_flag["key"], force_flag["value"], UptimeConf.worker_value_on, UptimeConf.worker_value_off
                    )
                )
        if self._uptime_config:
            self.log.debug("following uptime configurations")
            return check_runtime(self._uptime_config)
        if self._downtime_config:
            self.log.debug("following downtime configurations")
            return check_runtime(self._downtime_config, is_uptime=False)
        return True
def should_be_currently_active ( self , current_queue , runtime_properties ) : runtime_properties = runtime_properties or [ ] if UptimeConf . queue_tag_off in current_queue [ 'tags' ] : self . log . debug ( "Queue {} is tagged '{}', worker will not pull tasks" . format ( current_queue [ 'name' ] , UptimeConf . queue_tag_off ) ) return False if UptimeConf . queue_tag_on in current_queue [ 'tags' ] : self . log . debug ( "Queue {} is tagged '{}', worker will pull tasks" . format ( current_queue [ 'name' ] , UptimeConf . queue_tag_on ) ) return True force_flag = next ( ( prop for prop in runtime_properties if prop [ "key" ] == UptimeConf . worker_key ) , None ) if force_flag : if force_flag [ "value" ] . lower ( ) in UptimeConf . worker_value_off : self . log . debug ( "worker has the following runtime property: '{}'. worker will not pull tasks" . format ( force_flag ) ) return False elif force_flag [ "value" ] . lower ( ) in UptimeConf . worker_value_on : self . log . debug ( "worker has the following runtime property: '{}'. worker will pull tasks" . format ( force_flag ) ) return True else : print ( "Warning: invalid runtime_property '{}: {}' supported values are: '{}/{}', ignoring" . format ( force_flag [ "key" ] , force_flag [ "value" ] , UptimeConf . worker_value_on , UptimeConf . worker_value_off ) ) if self . _uptime_config : self . log . debug ( "following uptime configurations" ) return check_runtime ( self . _uptime_config ) if self . _downtime_config : self . log . debug ( "following downtime configurations" ) return check_runtime ( self . _downtime_config , is_uptime = False ) return True
Checks if a worker is active according to queue tags, worker's runtime properties and uptime schedule.
Checks if a worker is active according to queue tags worker ' s runtime properties and uptime schedule .
"""
        Checks if a worker is active according to queue tags, worker's runtime properties and uptime schedule.
        """
self
current_queue
runtime_properties