Running the workflow#

Run the workflow locally in Python#

To quickly check your workflow code, you can run it in your local Python environment with the following command:

$ union run guide/first_workflow/ml_workflow/ml_workflow.py main --max_bins 64

If the code runs successfully, you should see output like this:

Running Execution on local.
0.9767441860465116

Run the workflow remotely on Union#

To run the workflow on Union, you will need to register the workflow, make your container image accessible to Union, and finally, run the workflow from the Union interface.

Register the workflow on Union#

When starting with a new workflow that requires a new container image that has not been previously built, you must first register your workflow code with union register. To register the ml_workflow example, run the following command:

$ union register guide/first_workflow/ml_workflow

This command does the following:

  • Builds the images defined by the ImageSpec objects in your code and pushes them to the specified container registry.

  • Pushes the workflow code to Union.

  • Sets up the workflow DAG and its constituent task containers.

  • Registers the workflow in the default domain (development) of the default project (flytesnacks) in Union.

You should see the following output (or similar) in your terminal:

Successfully serialized 5 flyte objects
[] Registration ml_workflow.ml_workflow.evaluate_model type TASK successful with version nuHakW_PUV5uk71n-to7bg
[] Registration ml_workflow.ml_workflow.train_model type TASK successful with version nuHakW_PUV5uk71n-to7bg
[] Registration ml_workflow.ml_workflow.get_dataset type TASK successful with version nuHakW_PUV5uk71n-to7bg
[] Registration ml_workflow.ml_workflow.main type WORKFLOW successful with version nuHakW_PUV5uk71n-to7bg
[] Registration ml_workflow.ml_workflow.main type LAUNCH_PLAN successful with version nuHakW_PUV5uk71n-to7bg
Successfully registered 5 entities

Make your image accessible to Union#

Before you can run the workflow from the Union interface, you must make sure that the image defined in your ImageSpec is public.

In the GitHub Container Registry, switch the visibility of your container image to Public. For more information, see Configuring a package’s access control and visibility.

At this point, you can run the workflow from the Union interface.

Run the workflow from the Union interface#

To run the workflow from the Union interface:

  1. Navigate to the Union dashboard.

  2. In the left sidebar, click Workflows.

  3. Search for your workflow, then select the workflow from the search results.

  4. On the workflow page, click Launch Workflow.

  5. In the “Create New Execution” dialog, you can change the workflow version, Launch Plan, and inputs (if present). Click “Advanced options” to change the security context, labels, annotations, max parallelism, override the interruptible flag, and overwrite cached inputs.

  6. To execute the workflow, click Launch. You should see the workflow status change to “Running”, then “Succeeded” as the execution progresses.

To view the workflow execution graph, click the Graph tab above the running workflow.

View the workflow execution on Union#

When you view the workflow execution graph, you will see the following:

Graph

Above the graph, there is metadata that describes the workflow execution, such as the duration and the workflow version. Next, click on the evaluate_model node to open up a sidebar that contains additional information about the task:

Sidebar

Click on the “Flyte Deck” button in the sidebar to open up visualizations generated by the task:

Flyte Deck

Now that we are familiar with the UI, let’s jump into the code and see how to build the workflow!

Next step#

The next step is to take a look at the Example code components.