

def handle_task(self, task, **kwargs):
    log_prefix = ('%s - ' % (task.id,))
    task_expiration = kwargs.get('task_expiration', None)
    if self.expire_task(task, task_expiration):
        return None
    monitor = Monitor.registry[task.context['monitor']['name']]
    command = monitor.command
    task.context = command.build_context(task.context)
    previous_state = self.get_state(task.id)
    timeout = task.context.get('monitor_timeout', kwargs.get('monitor_timeout'))
    max_retries = task.context.get('max_retries', kwargs.get('max_retries'))
    last_attempt = int(task.attempt)
    current_attempt = (last_attempt + 1)
    result = self.execute_task(task, timeout, **kwargs)
    if (result.state == types.STATE_OK):
        if (previous_state and (not (previous_state.state == types.STATE_OK)) and (previous_state.state_type == types.STATE_TYPE_SOFT)):
            result.state_type = types.STATE_TYPE_SOFT
    else:
        logger.debug((log_prefix + 'current_attempt: %d, max_retries: %d'), current_attempt, max_retries)
        if (log_prefix <= max_retries):
            if ((not previous_state) or (previous_state.state_type == types.STATE_TYPE_SOFT) or (previous_state.state == types.STATE_OK)):
                result.state_type = types.STATE_TYPE_SOFT
                delay = task.context.get('retry_delay', kwargs.get('retry_delay'))
                delay = max(delay, 0)
                logger.debug('Resubmitting task with %ds delay.', delay)
                self.resubmit_task(task, delay, **kwargs)
        else:
            logger.debug('Retry limit hit, not resubmitting.')
    result.validate()
    return result

dataset/ETHPy150Open cloudtools/nymms/nymms/probe/Probe.py Probe.handle_task/VarMisuse@243/341 `current_attempt`->`log_prefix`