This project is no longer actively maintained. While existing releases remain available, there are no planned updates, bug fixes, new features, or security patches. Users should be aware that vulnerabilities may not be addressed.
A key feature of TorchServe is the ability to package workflow specification (.yaml) and other workflow dependency files into a single workflow archive file (.war). This file can then be redistributed and served by anyone using TorchServe.
The CLI creates a .war
file that TorchServe CLI uses to serve the workflows.
The following information is required to create a standalone workflow archive:
Install torch-workflow-archiver
as follows:
pip install torch-workflow-archiver
Install torch-workflow-archiver
from source as follows:
git clone https://github.com/pytorch/serve.git
cd serve/workflow-archiver
pip install .
Now let's cover the details on using the CLI tool: torch-workflow-archiver
.
torch-workflow-archiver --workflow-name my_workflow --spec-file spec.yaml --handler handler.py
$ torch-workflow-archiver -h
usage: torch-workflow-archiver [-h] --workflow-name WORKFLOW_NAME --spec-file WORKFLOW_SPECIFICATION_FILE_PATH
[--handler HANDLER] [--export-path EXPORT_PATH] [-f]
Workflow Archiver Tool
optional arguments:
-h, --help show this help message and exit
--workflow-name WORKFLOW_NAME
Exported workflow name. Exported file will be named as
workflow-name.war and saved in current working directory
if no --export-path is specified, else it will be
saved under the export path
--spec-file WORKFLOW_SPECIFICATION_FILE_PATH
Path to .yaml file containing workflow DAG specification.
--handler HANDLER Path to python file containing workflow's pre-process and post-process logic.
--export-path EXPORT_PATH
Path where the exported .war file will be saved. This
is an optional parameter. If --export-path is not
specified, the file will be saved in the current
working directory.
-f, --force When the -f or --force flag is specified, an existing
.war file with same name as that provided in --workflow-name
in the path specified by --export-path will be overwritten
--extra-files EXTRA_FILES
Comma separated path to extra dependency files.
WAR-INF is a reserved folder name that will be used inside .war
file. This folder contains the workflow archive metadata files. Users should avoid using WAR-INF in their workflow path.
A valid workflow name must begin with a letter of the alphabet and can only contains letters, digits, underscores _
, dashes -
and periods .
.
A .yaml file specifying workflow DAG specification
Handler is path to a py file to handle workflow's pre-process and post-process functions.