Super simple question: I am running a `@task` us...
# ask-the-community
n
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
@David Espejo (he/him) do you know the answer to this?
n
To be clear here I am executing with
Copy code
FlyteRemote(...).execute(example_task, options=options, ...)
y
let me try to take a look tonight…
n
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
sorry, I'm not sure yet but will keep investigating later
n
Sweet thanks all, really appreciate it.
But just to be clear, is this approach supposed to work?
y
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
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
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
The latter
y
so yeah that’s a locally defined task, so the options arg appears to be missing
n
Okay, I can open a PR for this this week
152 Views