How to Upload and Start Flux Workflows from the Command Line
It's really easy to upload Flux workflows — and even start them — from the command line. Just use Flux's REST APIs right from the command line, without any need for coding or scripting.
Here's how you do it.
Upload Flux Workflow
curl -F "firstname.lastname@example.org" --user 'username:password' http://localhost:7186/cluster/repositoryFlowCharts/upload
This command (all one line) uploads the template workflow file template.ffc from your local file system to your Flux cluster.
- curl is the venerable command line tool, available on most Unix systems.
- template.ffc is the name of your workflow file to be uploaded.
- username:password are your security credentials.
- The http://localhost:7186 portion of the URL is the network location of your Flux operations console.
- The remainder of that URL is the REST endpoint for Flux's REST API.
- The result for a successful upload is HTTP status 200. Failed uploads results in an HTTP status 400 message.
Upload Flux Workflow Using Alternate Name
You can also explicitly change the template name of a file upload part by using the filename property, like this:
curl -F "email@example.com;filename=child template v1" --user 'username:password' http://localhost:7186/cluster/repositoryFlowCharts/upload
This naming technique allows you to maintain multiple revisions of the same template workflow in the repository.
Start Flux Workflow
To start a workflow template instance from the repository, use this command:
curl -d "namespace=/ingest" --user 'admin:admin' http://localhost:7186/cluster/repositoryFlowCharts/start
- An instance of the repository workflow "/ingest" will be started within the Flux cluster.