modal run
Run a Modal function or local entrypoint.
FUNC_REF should be of the format {file or module}::{function name}.
Alternatively, you can refer to the function via the app:
{file or module}::{app variable name}.{function name}
Examples:
To run the hello_world function (or local entrypoint) in my_app.py:
modal run my_app.py::hello_worldIf your module only has a single app and your app has a single local entrypoint (or single function), you can omit the app and function parts:
modal run my_app.pyInstead of pointing to a file, you can also use the Python module path, which by default will ensure that your remote functions will use the same module names as they do locally.
modal run -m my_project.my_appUsage:
modal run [OPTIONS] FUNC_REFOptions:
-n, --name TEXT: Name for this run of the App.-w, --write-result TEXT: Write return value (which must be str or bytes) to this local path.-q, --quiet: Don’t show Modal progress indicators.-d, --detach: Don’t stop the app if the local process dies or disconnects.-i, --interactive: Run the app in interactive mode.-e, --env TEXT: Environment to interact with. If unspecified, defers toMODAL_ENVIRONMENT, your active local profile, or your workspace default, in that order.-m: Interpret argument as a Python module path instead of a file/script path--timestamps: Show timestamps for each log line.--help: Show this message and exit.