in example/my_example/cli.py [0:0]
def remote_hello_world_2(name: str) -> None:
"""Demonstration of an advanced function decoration
Here the decorated ``codeseeder.remote_function`` is nested in another function. At times in may be necessary to
programmatically determine the parameters passed to the decorator at function execution time rather than when the
module is imported. Nesting the decorated function inside another function will work as long as both functions have
the same name and parameters.
Keep in mind when nesting like this, when the functions are executed in CodeBuild the outer function is executed
then the inner function code. The EXECUTING_REMOTELY flag can be used to determine if function is being executed
locally or by CodeBuild.
Parameters
----------
name : str
Just some example name
"""
codebuild_role = "Admin"
# Execute this if we're being run by CodeBuild
if codeseeder.EXECUTING_REMOTELY:
LOGGER.info("Executing remotely in CodeBuild")
else:
LOGGER.info("Executing locally")
@codeseeder.remote_function(
"my-example",
extra_python_modules=["python-slugify~=4.0.1"],
codebuild_role=codebuild_role,
extra_files={"VERSION": os.path.realpath(os.path.join(CLI_ROOT, "../VERSION"))},
)
def remote_hello_world_2(name: str) -> None:
print(f"[RESULT] {name}")
remote_hello_world_2(name)