labpack/platforms/apscheduler.py
def list_jobs(self, argument_filters=None):

        '''
            a method to list jobs in the scheduler

        :param argument_filters: list of query criteria dictionaries for class argument keys
        :return: list of jobs (which satisfy the filters)

        NOTE:   query criteria architecture

                each item in the argument filters list must be a dictionary
                which is composed of one or more key names which represent the
                dotpath to a key in the job record to be queried with a value
                that is a dictionary of conditional operators used to test the
                value in the corresponding key in each record in the list of jobs.

                eg. argument_filters = [ { '.function': { 'must_contain': [ 'debug' ] } } ]

                this example filter looks in the function key of each job for a
                value which contains the characters 'debug'.

        NOTE:   the filter method uses a query filters list structure to represent
                the disjunctive normal form of a logical expression. a record is
                added to the results list if any query criteria dictionary in the
                list evaluates to true. within each query criteria dictionary, all
                declared conditional operators must evaluate to true.

                in this way, the argument_filters represents a boolean OR operator and
                each criteria dictionary inside the list represents a boolean AND
                operator between all keys in the dictionary.

        NOTE:   each query_criteria uses the architecture of query declaration in
                the jsonModel.query method

        the list of keys in each query_criteria is the same as the arguments for
        adding a job to the scheduler
        query_criteria = {
            '.id': {},
            '.function': {},
            '.name': {},
            '.dt': {},
            '.interval': {},
            '.month': {},
            '.day': {},
            '.weekday': {},
            '.hour': {},
            '.minute': {},
            '.second': {},
            '.start_date': {},
            '.end_date': {}
        }

        conditional operators for '.id', '.function', '.name':
            "byte_data": false,
            "discrete_values": [ "" ],
            "excluded_values": [ "" ],
            "greater_than": "",
            "less_than": "",
            "max_length": 0,
            "max_value": "",
            "min_length": 0,
            "min_value": "",
            "must_contain": [ "" ],
            "must_not_contain": [ "" ],
            "contains_either": [ "" ]

        conditional operators for '.dt', 'start', 'end':
            "discrete_values": [ 0.0 ],
            "excluded_values": [ 0.0 ],
            "greater_than": 0.0,
            "less_than": 0.0,
            "max_value": 0.0,
            "min_value": 0.0

        operators for '.interval', '.month', '.day', '.weekday', '.hour', '.minute', '.second':
            "discrete_values": [ 0 ],
            "excluded_values": [ 0 ],
            "greater_than": 0,
            "less_than": 0,
            "max_value": 0,
            "min_value": 0

        '''

        title = '%s.list_jobs' % self.__class__.__name__

    # validate inputs
        if argument_filters:
            self.fields.validate(argument_filters, '.argument_filters')

    # send request to get jobs
        url = '%s/scheduler/jobs' % self.url
        job_list = self._get_request(url)

    # construct filter function
        def query_function(**kwargs):
            job_details = {}
            for key, value in kwargs.items():
                if key in self.job_model.schema.keys():
                    job_details[key] = value
            for query_criteria in argument_filters:
                if self.job_model.query(query_criteria, job_details):
                    return True
            return False

    # construct empty list
        results_list = []

    # add refactored jobs to results list
        for job in job_list:
            job_details = self._construct_details(job)
            if argument_filters:
                if query_function(**job_details):
                    results_list.append(job_details)
            else:
                results_list.append(job_details)

        return results_list

            a method to list jobs in the scheduler

        :param argument_filters: list of query criteria dictionaries for class argument keys
        :return: list of jobs (which satisfy the filters)

        NOTE:   query criteria architecture

                each item in the argument filters list must be a dictionary
                which is composed of one or more key names which represent the
                dotpath to a key in the job record to be queried with a value
                that is a dictionary of conditional operators used to test the
                value in the corresponding key in each record in the list of jobs.

                eg. argument_filters = [ { '.function': { 'must_contain': [ 'debug' ] } } ]

                this example filter looks in the function key of each job for a
                value which contains the characters 'debug'.

        NOTE:   the filter method uses a query filters list structure to represent
                the disjunctive normal form of a logical expression. a record is
                added to the results list if any query criteria dictionary in the
                list evaluates to true. within each query criteria dictionary, all
                declared conditional operators must evaluate to true.

                in this way, the argument_filters represents a boolean OR operator and
                each criteria dictionary inside the list represents a boolean AND
                operator between all keys in the dictionary.

        NOTE:   each query_criteria uses the architecture of query declaration in
                the jsonModel.query method

        the list of keys in each query_criteria is the same as the arguments for
        adding a job to the scheduler
        query_criteria = {
            '.id': {},
            '.function': {},
            '.name': {},
            '.dt': {},
            '.interval': {},
            '.month': {},
            '.day': {},
            '.weekday': {},
            '.hour': {},
            '.minute': {},
            '.second': {},
            '.start_date': {},
            '.end_date': {}
        }

        conditional operators for '.id', '.function', '.name':
            "byte_data": false,
            "discrete_values": [ "" ],
            "excluded_values": [ "" ],
            "greater_than": "",
            "less_than": "",
            "max_length": 0,
            "max_value": "",
            "min_length": 0,
            "min_value": "",
            "must_contain": [ "" ],
            "must_not_contain": [ "" ],
            "contains_either": [ "" ]

        conditional operators for '.dt', 'start', 'end':
            "discrete_values": [ 0.0 ],
            "excluded_values": [ 0.0 ],
            "greater_than": 0.0,
            "less_than": 0.0,
            "max_value": 0.0,
            "min_value": 0.0

        operators for '.interval', '.month', '.day', '.weekday', '.hour', '.minute', '.second':
            "discrete_values": [ 0 ],
            "excluded_values": [ 0 ],
            "greater_than": 0,
            "less_than": 0,
            "max_value": 0,
            "min_value": 0

        
a method to list jobs in the scheduler
a method to list jobs in the scheduler
def list_jobs(self, argument_filters=None):
        title = '%s.list_jobs' % self.__class__.__name__
        if argument_filters:
            self.fields.validate(argument_filters, '.argument_filters')
        url = '%s/scheduler/jobs' % self.url
        job_list = self._get_request(url)
        def query_function(**kwargs):
            job_details = {}
            for key, value in kwargs.items():
                if key in self.job_model.schema.keys():
                    job_details[key] = value
            for query_criteria in argument_filters:
                if self.job_model.query(query_criteria, job_details):
                    return True
            return False
        results_list = []
        for job in job_list:
            job_details = self._construct_details(job)
            if argument_filters:
                if query_function(**job_details):
                    results_list.append(job_details)
            else:
                results_list.append(job_details)
        return results_list
def list_jobs ( self , argument_filters = None ) : title = '%s.list_jobs' % self . __class__ . __name__ if argument_filters : self . fields . validate ( argument_filters , '.argument_filters' ) url = '%s/scheduler/jobs' % self . url job_list = self . _get_request ( url ) def query_function ( ** kwargs ) : job_details = { } for key , value in kwargs . items ( ) : if key in self . job_model . schema . keys ( ) : job_details [ key ] = value for query_criteria in argument_filters : if self . job_model . query ( query_criteria , job_details ) : return True return False results_list = [ ] for job in job_list : job_details = self . _construct_details ( job ) if argument_filters : if query_function ( ** job_details ) : results_list . append ( job_details ) else : results_list . append ( job_details ) return results_list
a method to list jobs in the scheduler
a method to list jobs in the scheduler
'''
            a method to list jobs in the scheduler

        :param argument_filters: list of query criteria dictionaries for class argument keys
        :return: list of jobs (which satisfy the filters)

        NOTE:   query criteria architecture

                each item in the argument filters list must be a dictionary
                which is composed of one or more key names which represent the
                dotpath to a key in the job record to be queried with a value
                that is a dictionary of conditional operators used to test the
                value in the corresponding key in each record in the list of jobs.

                eg. argument_filters = [ { '.function': { 'must_contain': [ 'debug' ] } } ]

                this example filter looks in the function key of each job for a
                value which contains the characters 'debug'.

        NOTE:   the filter method uses a query filters list structure to represent
                the disjunctive normal form of a logical expression. a record is
                added to the results list if any query criteria dictionary in the
                list evaluates to true. within each query criteria dictionary, all
                declared conditional operators must evaluate to true.

                in this way, the argument_filters represents a boolean OR operator and
                each criteria dictionary inside the list represents a boolean AND
                operator between all keys in the dictionary.

        NOTE:   each query_criteria uses the architecture of query declaration in
                the jsonModel.query method

        the list of keys in each query_criteria is the same as the arguments for
        adding a job to the scheduler
        query_criteria = {
            '.id': {},
            '.function': {},
            '.name': {},
            '.dt': {},
            '.interval': {},
            '.month': {},
            '.day': {},
            '.weekday': {},
            '.hour': {},
            '.minute': {},
            '.second': {},
            '.start_date': {},
            '.end_date': {}
        }

        conditional operators for '.id', '.function', '.name':
            "byte_data": false,
            "discrete_values": [ "" ],
            "excluded_values": [ "" ],
            "greater_than": "",
            "less_than": "",
            "max_length": 0,
            "max_value": "",
            "min_length": 0,
            "min_value": "",
            "must_contain": [ "" ],
            "must_not_contain": [ "" ],
            "contains_either": [ "" ]

        conditional operators for '.dt', 'start', 'end':
            "discrete_values": [ 0.0 ],
            "excluded_values": [ 0.0 ],
            "greater_than": 0.0,
            "less_than": 0.0,
            "max_value": 0.0,
            "min_value": 0.0

        operators for '.interval', '.month', '.day', '.weekday', '.hour', '.minute', '.second':
            "discrete_values": [ 0 ],
            "excluded_values": [ 0 ],
            "greater_than": 0,
            "less_than": 0,
            "max_value": 0,
            "min_value": 0

        ''' # validate inputs
 # send request to get jobs
 # construct filter function
 # construct empty list
 # add refactored jobs to results list

list of jobs (which satisfy the filters)
NOTE:   query criteria architecture

each item in the argument filters list must be a dictionary
which is composed of one or more key names which represent the
dotpath to a key in the job record to be queried with a value
that is a dictionary of conditional operators used to test the
value in the corresponding key in each record in the list of jobs.

eg. argument_filters = [ { '.function': { 'must_contain': [ 'debug' ] } } ]

this example filter looks in the function key of each job for a
value which contains the characters 'debug'.

the filter method uses a query filters list structure to represent
the disjunctive normal form of a logical expression. a record is
added to the results list if any query criteria dictionary in the
list evaluates to true. within each query criteria dictionary, all
declared conditional operators must evaluate to true.

in this way, the argument_filters represents a boolean OR operator and
each criteria dictionary inside the list represents a boolean AND
operator between all keys in the dictionary.

each query_criteria uses the architecture of query declaration in
the jsonModel.query method








list of jobs ( which satisfy the filters ) NOTE : query criteria architecture each item in the argument filters list must be a dictionary which is composed of one or more key names which represent the dotpath to a key in the job record to be queried with a value that is a dictionary of conditional operators used to test the value in the corresponding key in each record in the list of jobs . eg . argument_filters = [ { ' . function ' : { ' must_contain ' : [ ' debug ' ] } } ] this example filter looks in the function key of each job for a value which contains the characters ' debug ' . the filter method uses a query filters list structure to represent the disjunctive normal form of a logical expression . a record is added to the results list if any query criteria dictionary in the list evaluates to true . within each query criteria dictionary all declared conditional operators must evaluate to true . in this way the argument_filters represents a boolean OR operator and each criteria dictionary inside the list represents a boolean AND operator between all keys in the dictionary . each query_criteria uses the architecture of query declaration in the jsonModel . query method
self
argument_filters
list of query criteria dictionaries for class argument keys
list of query criteria dictionaries for class argument keys