Skip to content

Create run with TaskId for lazy task#1198

Open
popojk wants to merge 4 commits into
flyteorg:mainfrom
popojk:creatrun_rbac
Open

Create run with TaskId for lazy task#1198
popojk wants to merge 4 commits into
flyteorg:mainfrom
popojk:creatrun_rbac

Conversation

@popojk

@popojk popojk commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Goal

While creating runs with remote task(lazy task), we should create run request with TaskID instead of TaskSpec. Thus, the user only needs Action_ACTION_CREATE_FLYTE_EXECUTIONS to do such an operation.

p.s. While executing ephemeral runs(create runs with TaskSpec), the user must process Action_ACTION_REGISTER_FLYTE_INVENTORY permission because the BE will create TaskSpec in the DB.

Tests

Add log to see if we are creating run with TaskID or TaskSpec:
Screenshot 2026-06-12 at 10 31 02 AM

Test with this script to run remote task:

import flyte

if __name__ == "__main__":
    flyte.init_from_config()
    task = flyte.remote.Task.get("named_fanout.fanout", auto_version="latest")
    result = flyte.run(task, n1=2, n2=3, n3=4)
    print(f"Result: {result}")

The log shows we create run with TaskID
Screenshot 2026-06-12 at 10 41 14 AM

Execute an ephemeral run, the log show we create run with TaskSpec:
Screenshot 2026-06-12 at 10 43 04 AM

Test if task override works by overriding the task Short_name:

import flyte

if __name__ == "__main__":
    flyte.init_from_config()
    task = flyte.remote.Task.get("named_fanout.fanout", auto_version="latest").override(short_name="overridden_my_task")
    result = flyte.run(task, n1=2, n2=3, n3=4)
    print(f"Result: {result}")

The name is overridden:
Screenshot 2026-06-15 at 11 14 41 AM

Rollout plan

The backend permission check changes is till processing. It is ok to merge this PR first as current BE authz logic will not block create run request with TaskID.

popojk added 2 commits June 12, 2026 10:31
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Comment thread src/flyte/_run.py Outdated
if task_spec.task_template.id.version == "":
task_spec.task_template.id.version = version
# Only needed for locally-defined tasks; a fetched task (task_id set) already
# carries a fully-populated id and is sent by reference, not as a spec.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work with task override?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing. Fixed in c0ab563. I also tested it and put the result in PR description.

popojk added 2 commits June 15, 2026 11:15
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Comment thread src/flyte/remote/_task.py
pb2: task_definition_pb2.TaskDetails
max_inline_io_bytes: int = 10 * 1024 * 1024 # 10 MB
overriden_queue: Optional[str] = None
overridden: bool = False # Flag if the TaskDetails was overridden

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this var in TaskDetails to flag if the fetched TaskDetail is overridden. If it is overridden, we should still send full TaskSpec to the backend while creating runs.

@popojk popojk requested a review from pingsutw June 15, 2026 03:21
@kumare3

kumare3 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

so does flyte run remote-task not work already?

@popojk

popojk commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

so does flyte run remote-task not work already?

@kumare3 Right now the flyte run remote-task will send the full TaskSpec to the BE while creating runs. However, we could just send TaskID to the BE as the task is already deployed, and that is the point of this PR. We made RBAC changes in the BE so ephemeral runs(create runs with TaskSpec) will require Deploy_Inventory permission because the BE will create TaskSpec data in the DB for ephemeral runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants