Skip to content

Quick Start

Charles d'Avernas edited this page Aug 13, 2024 · 2 revisions

Welcome to Synapse! This guide will walk you through the steps to create and run your first workflow using Synapse. By following these steps, you'll get a basic workflow up and running in no time.

Prerequisites

Ensure you have the following installed and set up:

  • Synapse (using Docker, Kubernetes, or directly via .NET binaries)
  • synctl CLI (installed and configured)

Step 1: Define a Simple Workflow

Create a YAML file that defines a simple workflow. For this example, we'll use a workflow named greeter that returns a greeting message.

  1. Create a file named greeter.yaml:

    document:
      dsl: '1.0.0'
      name: greeter
      namespace: default
      version: '0.1.0'
    do:
      - greet:
          set:
            greetings: '${ "Hello \(.user.firstName) \(.user.lastName)!" }'

    This file defines a workflow with a single task that sets a greeting message based on input.

Step 2: Create the Workflow

Use synctl to create the workflow in Synapse.

  1. Run the following command:

    synctl workflow create -f greeter.yaml

    This command uploads the greeter.yaml definition to the Synapse API and creates the workflow.

Step 3: Run the Workflow

Now, let's execute the workflow with sample input to see how it works.

  1. Prepare the input YAML file, input.yaml:

    user:
      firstName: John
      lastName: Doe
  2. Run the workflow with the input file:

    synctl workflow run greeter --namespace default --version 0.1.0 --input input.yaml

    This command triggers the greeter workflow with the provided input. The output will include the results of the workflow execution.

Step 4: Check Workflow Instance Output

After the workflow completes, you can retrieve the output to see the result of the execution.

  1. Get the output of the workflow instance:

    synctl workflow-instance get-output <workflow-instance-id> --namespace default --output yaml

    Replace <workflow-instance-id> with the ID of the workflow instance obtained from the run command.

Summary

You have successfully:

  • Defined a simple workflow using Synapse.
  • Created the workflow using the synctl CLI.
  • Ran the workflow with sample YAML input.
  • Retrieved the output to verify the result.

Next Steps

For additional help, refer to the troubleshooting guide or join the discussion on the GitHub discussions page.