<commit_before>import logging
import math
import os
import signal
import subprocess
import time
from string import Template

import libsubmit.error as ep_error
from libsubmit.channels.local.local import LocalChannel
from libsubmit.launchers import Launchers
from libsubmit.providers.provider_base import ExecutionProvider

logger = logging.getLogger(__name__)

translate_table = { 'PD' :  'PENDING',
                    'R'  :  'RUNNING',
                    'CA' : 'CANCELLED',
                    'CF' : 'PENDING', #(configuring),
                    'CG' : 'RUNNING', # (completing),
                    'CD' : 'COMPLETED',
                    'F'  : 'FAILED', # (failed),
                    'TO' : 'TIMEOUT', # (timeout),
                    'NF' : 'FAILED', # (node failure),
                    'RV' : 'FAILED', #(revoked) and
                    'SE' : 'FAILED' } # (special exit state


class Local(ExecutionProvider):
    ''' Local Execution Provider

    This provider is used to launch IPP engines on the localhost.

    .. warning::
        Please note that in the config documented below, description and values
        are placed inside a schema that is delimited by #{ schema.. }

    Here's the scheme for the Local provider:

    .. code-block:: python

         { "execution" : { # Definition of all execution aspects of a site

              "executor"   : #{Description: Define the executor used as task executor,
                             # Type : String,
                             # Expected : "ipp",
                             # Required : True},

              "provider"   : #{Description : The provider name, in this case local
                             # Type : String,
                             # Expected : "local",
                             # Required :  True },

              "scriptDir"  : #{Description : Relative or absolute path to a
                             # directory in which intermediate scripts are placed
                             # Type : String,
                             # Default : "./.scripts"},

              "block" : { # Definition of a block

                  "initBlocks" : #{Description : # of blocks to provision at the start of
                                 # the DFK
                                 # Type : Integer
                                 # Default : ?
                                 # Required :    },

                  "minBlocks" :  #{Description : Minimum # of blocks outstanding at any time
                                 # WARNING :: Not Implemented
                                 # Type : Integer
                                 # Default : 0 },

                  "maxBlocks" :  #{Description : Maximum # Of blocks outstanding at any time
                                 # WARNING :: Not Implemented
                                 # Type : Integer
                                 # Default : ? },

                  "taskBlocks": #{Description : workers to launch per request
                                # Type : Integer
                                # Default : 1 },
              }
            }
         }

    '''

    def __repr__ (self):
        return "<Local Execution Provider for site:{0}>".format(self.sitename)

    def __init__ (self, config, channel_script_dir=None, channel=None):
        ''' Initialize the local provider class

        Args:
             - Config (dict): Dictionary with all the config options.
        '''

        if channel is None:
            if channel_script_dir is None:
                self.channel = LocalChannel(scriptDir=channel_script_dir)
            else:
                self.channel = LocalChannel()
        else:
            self.channel = channel
        self.config = config
        self.sitename = config['site']
        self.current_blocksize = 0
        self.scriptDir  = self.config["execution"]["scriptDir"]
        self.taskBlocks = self.config["execution"]["block"].get("taskBlocks", 1)
        launcher_name   = self.config["execution"]["block"].get("launcher",
                                                                "singleNode")<commit_msg>Fix log error pointed out by @yadudoc<commit_after>import logging
import math
import os
import signal
import subprocess
import time
from string import Template

import libsubmit.error as ep_error
from libsubmit.channels.local.local import LocalChannel
from libsubmit.launchers import Launchers
from libsubmit.providers.provider_base import ExecutionProvider

logger = logging.getLogger(__name__)

translate_table = { 'PD' :  'PENDING',
                    'R'  :  'RUNNING',
                    'CA' : 'CANCELLED',
                    'CF' : 'PENDING', #(configuring),
                    'CG' : 'RUNNING', # (completing),
                    'CD' : 'COMPLETED',
                    'F'  : 'FAILED', # (failed),
                    'TO' : 'TIMEOUT', # (timeout),
                    'NF' : 'FAILED', # (node failure),
                    'RV' : 'FAILED', #(revoked) and
                    'SE' : 'FAILED' } # (special exit state


class Local(ExecutionProvider):
    ''' Local Execution Provider

    This provider is used to launch IPP engines on the localhost.

    .. warning::
        Please note that in the config documented below, description and values
        are placed inside a schema that is delimited by #{ schema.. }

    Here's the scheme for the Local provider:

    .. code-block:: python

         { "execution" : { # Definition of all execution aspects of a site

              "executor"   : #{Description: Define the executor used as task executor,
                             # Type : String,
                             # Expected : "ipp",
                             # Required : True},

              "provider"   : #{Description : The provider name, in this case local
                             # Type : String,
                             # Expected : "local",
                             # Required :  True },

              "scriptDir"  : #{Description : Relative or absolute path to a
                             # directory in which intermediate scripts are placed
                             # Type : String,
                             # Default : "./.scripts"},

              "block" : { # Definition of a block

                  "initBlocks" : #{Description : # of blocks to provision at the start of
                                 # the DFK
                                 # Type : Integer
                                 # Default : ?
                                 # Required :    },

                  "minBlocks" :  #{Description : Minimum # of blocks outstanding at any time
                                 # WARNING :: Not Implemented
                                 # Type : Integer
                                 # Default : 0 },

                  "maxBlocks" :  #{Description : Maximum # Of blocks outstanding at any time
                                 # WARNING :: Not Implemented
                                 # Type : Integer
                                 # Default : ? },

                  "taskBlocks": #{Description : workers to launch per request
                                # Type : Integer
                                # Default : 1 },
              }
            }
         }

    '''

    def __repr__ (self):
        return "<Local Execution Provider for site:{0}>".format(self.sitename)

    def __init__ (self, config, channel_script_dir=None, channel=None):
        ''' Initialize the local provider class

        Args:
             - Config (dict): Dictionary with all the config options.
        '''

        if channel is None:
            if channel_script_dir is None:
                self.channel = LocalChannel()
            else:
                self.channel = LocalChannel(scriptDir=channel_script_dir)
        else:
            self.channel = channel
        self.config = config
        self.sitename = config['site']
        self.current_blocksize = 0
        self.scriptDir  = self.config["execution"]["scriptDir"]
        self.taskBlocks = self.config["execution"]["block"].get("taskBlocks", 1)
        launcher_name   = self.config["execution"]["block"].get("launcher",
                                                                "singleNode")
{'fraction_non_alphanumeric': 0.08971579961464354, 'fraction_numerical': 0.0012042389210019267, 'mean_word_length': 1.3063038044987503, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5917641', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1864, 'n_words': 595}