cuddly-jelly-27016
05/27/2025, 12:09 AMpyflyte run --remote on this file, twice.
from flytekit import task, workflow
from flytekit.core.base_task import PythonTask
from flytekit.core.interface import Interface
import rich_click as click
from dataclasses import dataclass
from typing import Optional
import datetime
@dataclass
class MyConfig(object):
MyField: Optional[str] = None
class MyTask(PythonTask[MyConfig]):
def __init__(
self,
name: str,
my_config: MyConfig,
**kwargs,
):
my_config.MyField = str(datetime.datetime.now())
click.secho(f"Resolved my_config: {my_config}", fg="cyan")
super().__init__(
name=name,
task_type="my_task",
interface=Interface(),
task_config=my_config,
**kwargs,
)
@workflow
def wf2():
job = MyTask(
name="test",
my_config=MyConfig(),
)
return job()
1. The output looks similar to below. The version string for each job is identical.
$ pyflyte run --remote wf2.py wf2
Running Execution on Remote.
Resolved job properties: MyConfig(MyField='2024-05-14 22:03:53.646933')
[✔] Go to https://.../f6562c3c440124ee3a76 to see execution in the console.
$ pyflyte run --remote wf2.py wf2
Running Execution on Remote.
Resolved my_config: MyConfig(MyField='2024-05-14 22:09:07.348125')
[✔] Go to https://.../f72aa991349d041f499b to see execution in the console.
### Expected behavior
Task version strings should be different because the task configs are different.
Especially when used in a custom flyte agent that has more complex logic, this will lead to an error like:
RPC Failed, with Status: StatusCode.INVALID_ARGUMENT
details: task with different structure already exists:
- /template/custom/myField: abc -> def
### Additional context to reproduce
No response
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/27/2025, 12:09 AM