Exemple #1
0
def process_async_task(headers, request_body):
    """Process an Async task and execute the requested function."""
    async_options = json.loads(request_body)
    async = async_from_options(async_options)

    _log_task_info(headers)
    logging.info(async ._function_path)

    with context.execution_context_from_async(async):
        run_job()
Exemple #2
0
def process_async_task(headers, request_body):
    """Process an Async task and execute the requested function."""
    async_options = json.loads(request_body)
    async = async_from_options(async_options)

    _log_task_info(headers)
    logging.info(async._function_path)

    with context.execution_context_from_async(async):
        run_job()

    return 200, async._function_path
Exemple #3
0
    def test_has_type(self):
        """Ensure that if _type is not furious.async.Async that the correct
        subclass is instantiated.
        """
        from furious.async import async_from_options
        from furious.batcher import MessageProcessor

        async_job = MessageProcessor(dir)

        options = async_job.to_dict()

        result = async_from_options(options)

        self.assertIsInstance(result, MessageProcessor)
Exemple #4
0
    def test_has_type(self):
        """Ensure that if _type is not furious.async.Async that the correct
        subclass is instantiated.
        """
        from furious. async import async_from_options
        from furious.batcher import MessageProcessor

        async_job = MessageProcessor(dir)

        options = async_job.to_dict()

        result = async_from_options(options)

        self.assertIsInstance(result, MessageProcessor)
Exemple #5
0
    def test_no_type(self):
        """Ensure that if not _type is in options, that it defaults to
        furious.async.Async.
        """
        from furious.async import Async
        from furious.async import async_from_options

        async_job = Async(dir)

        options = async_job.to_dict()
        options.pop("_type")

        result = async_from_options(options)

        self.assertIsInstance(result, Async)
Exemple #6
0
    def test_no_type(self):
        """Ensure that if not _type is in options, that it defaults to
        furious.async.Async.
        """
        from furious. async import Async
        from furious. async import async_from_options

        async_job = Async(dir)

        options = async_job.to_dict()
        options.pop('_type')

        result = async_from_options(options)

        self.assertIsInstance(result, Async)