trains/task.py
def __task_is_relevant(cls, task_data):
        """
        Check that a cached task is relevant for reuse.
        
        A task is relevant for reuse if:
            1. It is not timed out i.e it was last use in the previous 24 hours.
            2. It's name, project and type match the data in the server, so not
               to override user changes made by using the UI.
               
        :param task_data: A mapping from 'id', 'name', 'project', 'type' keys
            to the task's values, as saved in the cache.
            
        :return: True if the task is relevant for reuse, False if not.
        """
        if not task_data:
            return False

        # in dev-worker mode, never reuse a task
        if DevWorker.is_enabled():
            return False

        if cls.__task_timed_out(task_data):
            return False

        task_id = task_data.get('id')

        if not task_id:
            return False

        task = cls.__get_task_api_obj(task_id, ('id', 'name', 'project', 'type'))

        if task is None:
            return False

        project_name = None
        if task.project:
            project = cls._send(
                cls._get_default_session(),
                projects.GetByIdRequest(project=task.project)
            ).response.project

            if project:
                project_name = project.name

        compares = (
            (task.name, 'name'),
            (project_name, 'project'),
            (task.type, 'type'),
        )

        return all(server_data == task_data.get(task_data_key)
                   for server_data, task_data_key in compares)

        Check that a cached task is relevant for reuse.
        
        A task is relevant for reuse if:
            1. It is not timed out i.e it was last use in the previous 24 hours.
            2. It's name, project and type match the data in the server, so not
               to override user changes made by using the UI.
               
        :param task_data: A mapping from 'id', 'name', 'project', 'type' keys
            to the task's values, as saved in the cache.
            
        :return: True if the task is relevant for reuse, False if not.
        
Check that a cached task is relevant for reuse.
A task is relevant for reuse if:
1. It is not timed out i.e it was last use in the previous 24 hours.
2. It's name, project and type match the data in the server, so not
to override user changes made by using the UI.
Check that a cached task is relevant for reuse . A task is relevant for reuse if : 1 . It is not timed out i . e it was last use in the previous 24 hours . 2 . It ' s name project and type match the data in the server so not to override user changes made by using the UI .
def __task_is_relevant(cls, task_data):
        if not task_data:
            return False
        if DevWorker.is_enabled():
            return False
        if cls.__task_timed_out(task_data):
            return False
        task_id = task_data.get('id')
        if not task_id:
            return False
        task = cls.__get_task_api_obj(task_id, ('id', 'name', 'project', 'type'))
        if task is None:
            return False
        project_name = None
        if task.project:
            project = cls._send(
                cls._get_default_session(),
                projects.GetByIdRequest(project=task.project)
            ).response.project
            if project:
                project_name = project.name
        compares = (
            (task.name, 'name'),
            (project_name, 'project'),
            (task.type, 'type'),
        )
        return all(server_data == task_data.get(task_data_key)
                   for server_data, task_data_key in compares)
def __task_is_relevant ( cls , task_data ) : if not task_data : return False if DevWorker . is_enabled ( ) : return False if cls . __task_timed_out ( task_data ) : return False task_id = task_data . get ( 'id' ) if not task_id : return False task = cls . __get_task_api_obj ( task_id , ( 'id' , 'name' , 'project' , 'type' ) ) if task is None : return False project_name = None if task . project : project = cls . _send ( cls . _get_default_session ( ) , projects . GetByIdRequest ( project = task . project ) ) . response . project if project : project_name = project . name compares = ( ( task . name , 'name' ) , ( project_name , 'project' ) , ( task . type , 'type' ) , ) return all ( server_data == task_data . get ( task_data_key ) for server_data , task_data_key in compares )
Check that a cached task is relevant for reuse.
Check that a cached task is relevant for reuse .
"""
        Check that a cached task is relevant for reuse.
        
        A task is relevant for reuse if:
            1. It is not timed out i.e it was last use in the previous 24 hours.
            2. It's name, project and type match the data in the server, so not
               to override user changes made by using the UI.
               
        :param task_data: A mapping from 'id', 'name', 'project', 'type' keys
            to the task's values, as saved in the cache.
            
        :return: True if the task is relevant for reuse, False if not.
        """ # in dev-worker mode, never reuse a task
True if the task is relevant for reuse, False if not.
True if the task is relevant for reuse False if not .
cls
task_data
A mapping from 'id', 'name', 'project', 'type' keys
to the task's values, as saved in the cache.
A mapping from ' id ' ' name ' ' project ' ' type ' keys to the task ' s values as saved in the cache .