https://flyte.org logo
#ask-the-community
Title
# ask-the-community
v

Vinnam Kim

01/17/2024, 5:40 AM
Hi all, Is there any method to get Workflow Labels or Annotations in the Flyte Workflow itself? For example,
Copy code
from flytekit import Labels, Annotations

@workflow
class MyWorkflow(object):
    assert some_workflow_label_getter("myexecutionlabel") == "bar"

my_launch_plan = MyWorkflow.create_launch_plan(
    labels=Labels({"myexecutionlabel": "bar", ...}),
    annotations=Annotations({"region": "SEA", ...}),
    ...
)

my_launch_plan.execute(...)
k

Ketan (kumare3)

01/17/2024, 6:11 AM
what is the usecase?
can you not use env vars?
v

Vinnam Kim

01/17/2024, 6:26 AM
Hi, We have many Flyte workflows and own Flyte scheduler to launch them. With our own Flyte scheduler, the Flyte workflows have been executed with the Workflow Labels. Now, some of our Flyte workflows need to use the variables in the Workflow Labels in addition to the inputs. However, if we decide to include those in the inputs, it is expected that we need to change all Flyte workflows' signatures (because we have our own single Flyte scheduler), not just those who actually need it.
Following your suggestion, does it mean that I can use this argument to set the environment variables for the workflow? :param envs: Environment variables to set for the execution. https://docs.flyte.org/en/latest/_modules/flytekit/remote/remote.html#FlyteRemote.execute_remote_wf
s

Samhita Alla

01/19/2024, 1:19 PM
env variables let you send env variables to your workflow. i believe what you're looking for is the ability to fetch labels and annotations in your workflow, correct? i'm not sure if that's possible today.