Perian connector example usage

Once you have a Union account, install union:

pip install union

Export the following environment variable to build and push images to your own container registry:

# replace with your registry name
export IMAGE_SPEC_REGISTRY="<your-container-registry>"

Then run the following commands to run the workflow:

$ git clone https://github.com/unionai/unionai-examples
$ cd unionai-examples
$ union run --remote <path/to/file.py> <workflow_name> <params>

The source code for this example can be found here.

This example shows how to use the Perian connector to execute tasks on Perian Job Platform.

import union
from flytekitplugins.perian_job import PerianConfig

image_spec = union.ImageSpec(
    name="flyte-test",
    registry="my-registry",
    python_version="3.11",
    apt_packages=["wget", "curl", "git"],
    packages=[
        "flytekitplugins-perian-job",
    ],
)

PerianConfig configures PerianTask. Tasks specified with PerianConfig will be executed on Perian Job Platform.

@union.task(
    container_image=image_spec,
    task_config=PerianConfig(
        accelerators=1,
        accelerator_type="A100",
    ),
)
def perian_hello(name: str) -> str:
    return f"hello {name}!"


@union.workflow
def my_wf(name: str = "world") -> str:
    return perian_hello(name=name)