<commit_before>
__copyright__ = 'Copyright 2017-2018, http://radical.rutgers.edu'
__author__    = '<NAME> <<EMAIL>>'
__license__   = 'MIT'


from ..base.resource_manager import Base_ResourceManager
import radical.utils as ru


# ------------------------------------------------------------------------------
#
class ResourceManager(Base_ResourceManager):
    '''
    A resource manager takes the responsibility of placing resource requests on
    different, possibly multiple, DCIs. This ResourceManager uses mocks an
    implementation by doing nothing, it is only usable for testing.

    :arguments:
        :resource_desc: dictionary with details of the resource request and
                        access credentials of the user
        :example: resource_desc = {
                                    |  'resource'      : 'xsede.stampede',
                                    |  'walltime'      : 120,
                                    |  'cpus'          : 64,
                                    |  'project'       : 'TG-abcxyz',
                                    |  'queue'         : 'abc',    # optional
                                    |  'access_schema' : 'ssh'     # optional}
    '''

    # --------------------------------------------------------------------------
    #
    def __init__(self, resource_desc, sid, rts_config):

        super(ResourceManager, self).__init__(resource_desc=resource_desc,
                                              sid=sid,
                                              rts='mock',
                                              rts_config=rts_config)


    # --------------------------------------------------------------------------
    #
    def get_resource_allocation_state(self):
        '''
        **Purpose**: get the state of the resource allocation

        '''
        try:
            ru.raise_on(tag='resource_fail')
            return 'Running'
        except:
            return 'Final'


    # --------------------------------------------------------------------------
    #
    def get_completed_states(self):
        '''
        **Purpose**: test if a resource allocation was submitted
        '''

        return ['Final']


    # --------------------------------------------------------------------------
    #
    def _validate_resource_desc(self):
        '''
        **Purpose**: validate the provided resource description
        '''

        return True


    # --------------------------------------------------------------------------
    #
    def _populate(self):
        '''
        **Purpose**: evaluate attributes provided in the resource description
        '''

        return None


    # --------------------------------------------------------------------------
    #
    def submit_resource_request(self, *args):
        '''
        **Purpose**: Create a resourceas per provided resource description
        '''

        return None


    # --------------------------------------------------------------------------
    #
    def get_rts_info(self):

        return None

    # --------------------------------------------------------------------------
    #
    def _terminate_resource_request(self):
        '''
        **Purpose**: Cancel the resource
        '''

        return None


# ------------------------------------------------------------------------------

<commit_msg>linter happy!<commit_after>__copyright__ = 'Copyright 2017-2018, http://radical.rutgers.edu'
__author__    = '<NAME> <<EMAIL>>'
__license__   = 'MIT'


#pylint: disable=unused-argument

from ..base.resource_manager import Base_ResourceManager
import radical.utils as ru


# ------------------------------------------------------------------------------
#
class ResourceManager(Base_ResourceManager):
    '''
    A resource manager takes the responsibility of placing resource requests on
    different, possibly multiple, DCIs. This ResourceManager uses mocks an
    implementation by doing nothing, it is only usable for testing.

    :arguments:
        :resource_desc: dictionary with details of the resource request and
                        access credentials of the user
        :example: resource_desc = {
                                    |  'resource'      : 'xsede.stampede',
                                    |  'walltime'      : 120,
                                    |  'cpus'          : 64,
                                    |  'project'       : 'TG-abcxyz',
                                    |  'queue'         : 'abc',    # optional
                                    |  'access_schema' : 'ssh'     # optional}
    '''

    # --------------------------------------------------------------------------
    #
    def __init__(self, resource_desc, sid, rts_config):

        super(ResourceManager, self).__init__(resource_desc=resource_desc,
                                              sid=sid,
                                              rts='mock',
                                              rts_config=rts_config)


    # --------------------------------------------------------------------------
    #
    def get_resource_allocation_state(self):
        '''
        **Purpose**: get the state of the resource allocation

        '''
        try:
            ru.raise_on(tag='resource_fail')
            return 'Running'
        except:
            return 'Final'


    # --------------------------------------------------------------------------
    #
    def get_completed_states(self):
        '''
        **Purpose**: test if a resource allocation was submitted
        '''

        return ['Final']


    # --------------------------------------------------------------------------
    #
    def _validate_resource_desc(self):
        '''
        **Purpose**: validate the provided resource description
        '''

        return True


    # --------------------------------------------------------------------------
    #
    def _populate(self):
        '''
        **Purpose**: evaluate attributes provided in the resource description
        '''

        return None


    # --------------------------------------------------------------------------
    #
    def submit_resource_request(self, *args):
        '''
        **Purpose**: Create a resourceas per provided resource description
        '''

        return None


    # --------------------------------------------------------------------------
    #
    def get_rts_info(self):

        return None

    # --------------------------------------------------------------------------
    #
    def _terminate_resource_request(self):
        '''
        **Purpose**: Cancel the resource
        '''

        return None


# ------------------------------------------------------------------------------


{'fraction_non_alphanumeric': 0.2913780397936625, 'fraction_numerical': 0.003831982313927782, 'mean_word_length': 0.84251968503937, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4548781', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1310, 'n_words': 336}