MCPcopy Create free account
hub / github.com/zappa/Zappa / run

Function run

zappa/asynchronous.py:330–359  ·  view source on GitHub ↗

Instead of decorating a function with @task, you can just run it directly. If you were going to do func(*args, **kwargs), then you will call this: import zappa.asynchronous.run zappa.asynchronous.run(func, args, kwargs) If you want to use SNS, then do: zappa.asynchronous.

(
    func,
    args=[],
    kwargs={},
    service="lambda",
    capture_response=False,
    remote_aws_lambda_function_name=None,
    remote_aws_region=None,
    **task_kwargs
)

Source from the content-addressed store, hash-verified

328
329
330def run(
331 func,
332 args=[],
333 kwargs={},
334 service="lambda",
335 capture_response=False,
336 remote_aws_lambda_function_name=None,
337 remote_aws_region=None,
338 **task_kwargs
339):
340 """
341 Instead of decorating a function with @task, you can just run it directly.
342 If you were going to do func(*args, **kwargs), then you will call this:
343
344 import zappa.asynchronous.run
345 zappa.asynchronous.run(func, args, kwargs)
346
347 If you want to use SNS, then do:
348
349 zappa.asynchronous.run(func, args, kwargs, service='sns')
350
351 and other arguments are similar to @task
352 """
353 lambda_function_name = remote_aws_lambda_function_name or os.environ.get("AWS_LAMBDA_FUNCTION_NAME")
354 aws_region = remote_aws_region or os.environ.get("AWS_REGION")
355
356 task_path = get_func_task_path(func)
357 return ASYNC_CLASSES[service](
358 lambda_function_name=lambda_function_name, aws_region=aws_region, capture_response=capture_response, **task_kwargs
359 ).send(task_path, args, kwargs)
360
361
362# Handy:

Callers

nothing calls this directly

Calls 2

get_func_task_pathFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected