Once you have defined your project's asynchronous tasks as Python functions, you must register these functions with the Multinode control plane before you can invoke them.
This section describes how to register a project's function definitions and manage
the lifecycle of a project using the multinode CLI.
To use the multinode CLI, you must first authenticate with the control plane
using the multinode login command.
multinode login
You will be prompted to enter your Multinode control plane URL and API key, which you should have noted down from when you installed multinode into your AWS account.
The multinode logout command terminates an authenticated session.
multinode logout
The multinode deploy command is used to register project function definitions with
the Multinode control plane. You must run multinode deploy before you can
invoke your project functions.
multinode deploy {CODE_PATH} --project-name={PROJECT_NAME}
Under the hood, this command:
- Builds a Docker image containing the function definitions in
{CODE_PATH}. - Uploads the Docker image to a private Docker repository in your AWS account.
- Registers the Docker image URI with the Multinode control plane,
associating it with the project name
{PROJECT_NAME}.
When complete, the command returns a version ID for the project.
{CODE_PATH} is the folder containing the main.py file that contains the functions defining
your asynchronous tasks (i.e. the functions with the @mn.function() decorator).
For example, if your project folder structure is...
[CURRENT PATH]
└── tasks/
├── .env
├── requirements.txt
├── main.py
└── submodule/
├── __init__.py
├── file_1.py
└── file_2.py
... then {CODE_PATH} should be tasks/.
The multinode upgrade command is used to register a new version of your project function definitions
with the Multinode control plane. You must run this command every time you make changes to the function
definitions in your project.
multinode upgrade {CODE_PATH} --project-name={PROJECT_NAME}
When complete, this command returns a new version ID for the project.
In-flight function invocations will continue to run using the old version of the function definitions, but future function invocations will use the new version of the code (unless a historical version ID is explicitly specified in the codebase where the invocation is made).
The multinode undeploy command aborts all in-flight invocations associated with a project,
and deletes the project from the Multinode control plane.
multinode undeploy --project-name={PROJECT_NAME}
The multinode list command lists all projects currently registered with the control plane.
multinode list
The multinode describe command prints information about projects, functions and invocations.
Exactly what is printed can be controlled by flags.
multinode describe --project-name={PROJECT_NAME}
This command prints:
- the IDs of all versions of the project
- the names of all functions associated with the latest version of the project
To see the names of functions associated with a historical version of the project, use the following command.
multinode describe --project-name={PROJECT_NAME} --version-id={VERSION_ID}
(The --version-id={VERSION_ID} flag can be used in a similar manner with the remaining
multinode describe commands, as well as with the multinode logs command, which is covered below.)
multinode describe --project-name={PROJECT_NAME} --function-name={FUNCTION_NAME}
This command prints:
- Information about the function - for example, its CPU and memory requirements, concurrency quota, timeout limit and retry policy
- the IDs of recent invocations of this function
multinode describe --project-name={PROJECT_NAME} --function-name={FUNCTION_NAME} \\
--invocation-id={INVOCATION_ID}
This command prints:
- The status of the function invocation, and its creation time
- The ID, status and timestamps for every execution associated with this function invocation.
(An invocation may have multiple executions associated with it if it has been retried due to failures.)
The multinode logs command prints the logs from a function execution.
multinode logs --project-name={PROJECT_NAME} --function-name={FUNCTION_NAME} \\
--invocation-id={INVOCATION_ID} --execution-id={EXECUTION_ID}
Next: Function invocations