<commit_before>from baseplugin import BasePlugin
from basejob import BaseJob
import time
import logging

PLUGIN_NAME = "sample"

class Job(BaseJob):

    def __init__(self, log_dir, log_name, log_level, infos):
        BaseJob.__init__(self, log_dir, log_name, log_level, infos)

    # This method isn't called directly by a check but by another method inside
    # the plugin : its name MUST start with '_'.
    def _do_nothing(self):
        time.sleep(4)

    # This method is called by a check.
    def nothing(self):
        self.log.info('This check is doing nothing.')
        self._do_nothing()
        self.infos['status'] = 'FINISHED'

    # This method is called by a check.
    def pierrot(self):
        self.log.info('Au clair de la lune.')
        self.infos['status'] = 'FINISHED'

class Plugin(BasePlugin):

    # This dict defines the mandatory options to be configured to use this plugin.
    # Its form is : require = { 'option1_name' : option1_type, ... }
    require = { }

    # This dict defines the optional options of this plugin.
    # Its form is : optional = {'option1_name' : option1_type, ... }
    optional = { }

    def __init__(self, log_dir, log_name, log_level, event, url=None, params=None):
        BasePlugin.__init__(self, PLUGIN_NAME, log_dir, log_name, log_level, event, url, params)

    def create_new_job(self, job):
        return Job(self.log_name, job)<commit_msg>Update plugins to use the new logging API and fix dependencies, refs: #2814<commit_after>from baseplugin import BasePlugin
from basejob import BaseJob
import time
import logging

PLUGIN_NAME = "sample"

class Job(BaseJob):

    def __init__(self, log_dir, log_name, log_level, infos):
        BaseJob.__init__(self, log_dir, log_name, log_level, infos)

    # This method isn't called directly by a check but by another method inside
    # the plugin : its name MUST start with '_'.
    def _do_nothing(self):
        time.sleep(4)

    # This method is called by a check.
    def nothing(self):
        self.log.info('This check is doing nothing.')
        self._do_nothing()
        self.infos['status'] = 'FINISHED'

    # This method is called by a check.
    def pierrot(self):
        self.log.info('Au clair de la lune.')
        self.infos['status'] = 'FINISHED'

class Plugin(BasePlugin):

    # This dict defines the mandatory options to be configured to use this plugin.
    # Its form is : require = { 'option1_name' : option1_type, ... }
    require = { }

    # This dict defines the optional options of this plugin.
    # Its form is : optional = {'option1_name' : option1_type, ... }
    optional = { }

    def __init__(self, log_dir, log_name, log_level, event, url=None, params=None):
        BasePlugin.__init__(self, PLUGIN_NAME, log_dir, log_name, log_level, event, url, params)

    def create_new_job(self, job):
        return Job(self.log_dir, self.log_name, self.log_level, job)
{'fraction_non_alphanumeric': 0.10178204249485949, 'fraction_numerical': 0.004797806716929404, 'mean_word_length': 3.1522048364153625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7185628', 'n_tokens_mistral': 928, 'n_tokens_neox': 892, 'n_words': 299}