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

Nicholas Roberson

05/05/2023, 6:05 PM
Super simple question: I am running a
@task
using
remote.execute
with the arg
options=Options(labels=Labels({"test_label": "test_value"}))
and I cannot seem to get that label to attach to the pod in kubernetes, however this same setup works when I call this using a
@workflow
and I can see my
"test_label"
label added to all pods spun up by the workflow, is this to be expected? If so is there a way to attach pod labels when running
remote.execute
just on a
@task
?
@Yee and ideas here? You've been super helpful in the past. Or is this just not possible.
y

Yee

05/05/2023, 6:10 PM
@David Espejo (he/him) do you know the answer to this?
n

Nicholas Roberson

05/05/2023, 6:15 PM
To be clear here I am executing with
Copy code
FlyteRemote(...).execute(example_task, options=options, ...)
y

Yee

05/05/2023, 6:22 PM
let me try to take a look tonight…
n

Nicholas Roberson

05/05/2023, 6:23 PM
Thanks from the docs it looks like Options should apply to workflows as well as tasks, so I wanted to ask to confirm.
^ and Launchplans
FWIW it also doesn't attach the labels it seems when executing
@dynamic
tasks.
d

David Espejo (he/him)

05/05/2023, 7:26 PM
sorry, I'm not sure yet but will keep investigating later
n

Nicholas Roberson

05/05/2023, 7:27 PM
Sweet thanks all, really appreciate it.
But just to be clear, is this approach supposed to work?
y

Yee

05/06/2023, 12:02 AM
is this a local task? (ie a task defined in your .py file) as opposed to a “remote task” (ie the output of remote.fetch_task(…))
it feels like it’s maybe just missing from the function.
it should work that way yes. there’s not currently actually any single task execution. behind the scenes it’s just a wrapper
flyte creates a one task/one node workflow around it, and executes that instead. which is why the return signature is a workflow execution.
would you be up for putting in a PR?
n

Nicholas Roberson

05/08/2023, 3:09 PM
I am executing it as a remote task, from python code. So I guess it would qualify as a locally defined task. I can open a PR for this yeah. The task is simply defined as this that we are running
remote.execute
on
Copy code
import logging
from flytekit import dynamic, task, workflow

@task
def my_task(input: str) -> str:
    return input
Looking at the code that would at least explain that behavior. Calling
type()
on the task when I run it from my local I do get
flytekit.core.python_function_task.PythonFunctionTask
, will try triggering it from a remote workflow to see if the behavior changes.
y

Yee

05/08/2023, 4:31 PM
okay…
not quite sure what you mean - how do you get the task? Are you doing
remote.fetch_task
? Or are you doing
@task
?
n

Nicholas Roberson

05/08/2023, 6:30 PM
The latter
y

Yee

05/08/2023, 7:14 PM
so yeah that’s a locally defined task, so the options arg appears to be missing
n

Nicholas Roberson

05/08/2023, 9:57 PM
Okay, I can open a PR for this this week
75 Views