示例#1
0
    def execute(_event=None, _context=None):
        """
        Encapsulation of _event-running code, with access to collectors and other variables in main() scope. Used
        for both single-run and stream modes.
        :param _event: A valid Lambda _event object.
        :return: Void.
        """
        # Invoke the lambda
        # TODO consider refactoring to pass stats through function
        result, exec_clock = invoke_lambda(lfunc, _event, _context, args.timeout, args.role)

        # Get process peak RSS memory after execution
        exec_rss = get_memory_usage() - pre_rss

        # Store statistics
        stats['clock'].append(exec_clock)
        stats['rss'].append(exec_rss)

        # Render the result
        render_result(args.verbose, args.lambdapath, result, exec_clock, exec_rss)
示例#2
0
    def execute(_event=None, _context=None):
        """
        Encapsulation of _event-running code, with access to collectors and other variables in main() scope. Used
        for both single-run and stream modes.
        :param _event: A valid Lambda _event object.
        :return: Void.
        """
        # Invoke the lambda
        # TODO consider refactoring to pass stats through function
        result, exec_clock = invoke_lambda(lfunc, _event, _context, args.timeout)

        # Get process peak RSS memory after execution
        exec_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss - pre_rss

        # Store statistics
        stats['clock'].append(exec_clock)
        stats['rss'].append(exec_rss)

        # Render the result
        render_result(args.verbose, args.lambdapath, result, exec_clock, exec_rss)