Quickstart: Workflow
This quickstart showcases how to write applications containing stateful, long-running, reliable workflows using the Workflow API. Catalyst hosts the workflow execution engine and manages the workflow state, with the external application containing the workflow definition and business logic.
Prerequisites
Before you proceed, ensure you have the following prereqs installed.
- Python
- .NET
- JavaScript
- Java
Log in to Catalyst
Authenticate to Diagrid Catalyst using the following command:
diagrid login
Confirm your organization and user details are correct:
diagrid whoami
Clone quickstart code
Clone the quickstart code from the Diagrid Labs GitHub repository and navigate to the appropriate directory:
- Python
- .NET
- Javascript
- Java
diagrid dev quickstart --type workflow --language python
diagrid dev quickstart --type workflow --language csharp
diagrid dev quickstart --type workflow --language javascript
diagrid dev quickstart --type workflow --language java
Run quickstart application
To run the quickstart locally, use the diagrid dev run
command. This command uses the dapr multi-app run file in the root of the code directory to:
- Create a Catalyst project: If the project does not exist, the command will create a new project
- Create resources: Creates the necessary resources on Catalyst such as App IDs, Components, and Diagrid Pub/Sub or KV Store managed services
- Launch the quickstart applications: Locates the code directories using the values specified for
workDir
and launches each application using the respective app command inputs - Inject environment variables: Configures the Dapr workflow client to talk to Catalyst
For additional details on the Catalyst local development experience, read Develop Locally with Catalyst APIs.
- Python
- .NET
- JavaScript
- Java
Install python dependencies in a virtual environment.
This quickstart uses the venv module to create the virtual environment. Please feel free to adapt if you prefer to use conda, pipenv, or another alternative.
python -m venv venv
- MacOS
- Linux
- Windows
If you are using MacOS, start the virtual environment with the following command:
source venv/bin/activate
Don't forget to close your virtual environment with deactivate
when done with the quickstart
If you are using Linux, start the virtual environment with the following command:
source venv/bin/activate
Don't forget to close your virtual environment with deactivate
when done with the quickstart
If you are using PowerShell on Windows, start the virtual environment with the following command:
venv/Scripts/Activate.ps1
If you are using the Command Prompt on Windows, start the virtual environment with the following command:
venv/Scripts/activate.bat
If running in the Windows Command Prompt, don't forget to close your virtual environment with venv/Scripts/deactivate.bat
when done with the quickstart
Install the python app requirements:
pip install -r requirements.txt
Install .NET dependencies.
dotnet restore
Install node dependencies.
npm install
Install maven dependencies.
mvn clean install
Run the application using the following command:
- Python
- .NET
- JavaScript
- Java
diagrid dev run -f dev-python-workflow.yaml --project dev-python-workflow
diagrid dev run -f dev-csharp-workflow.yaml --project dev-csharp-workflow
diagrid dev run -f dev-js-workflow.yaml --project dev-js-workflow
diagrid dev run -f dev-java-workflow.yaml --project dev-java-workflow