Skip to content

Commit

Permalink
Support Identifier in generate_console_url (#2868)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas J. Fan <[email protected]>
  • Loading branch information
thomasjpfan authored Oct 25, 2024
1 parent c5cc389 commit e33960f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions flytekit/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,7 @@ def generate_console_url(
FlyteWorkflow,
FlyteTask,
WorkflowExecutionIdentifier,
Identifier,
FlyteLaunchPlan,
],
):
Expand All @@ -2506,11 +2507,11 @@ def generate_console_url(
entity = entity.id
return f"{self.generate_console_http_domain()}/console/projects/{entity.project}/domains/{entity.domain}/executions/{entity.name}" # noqa

if not isinstance(entity, (FlyteWorkflow, FlyteTask, FlyteLaunchPlan)):
if not isinstance(entity, (FlyteWorkflow, FlyteTask, FlyteLaunchPlan, Identifier)):
raise ValueError(f"Only remote entities can be looked at in the console, got type {type(entity)}")
return self.generate_url_from_id(id=entity.id)

def generate_url_from_id(self, id: Identifier):
id = entity if isinstance(entity, Identifier) else entity.id

rt = "workflow"
if id.resource_type == ResourceType.TASK:
rt = "task"
Expand Down
2 changes: 1 addition & 1 deletion flytekit/tools/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _raw_register(cp_entity: FlyteControlPlaneEntity):
i = remote.raw_register(
cp_entity, serialization_settings, version=version, create_default_launchplan=False
)
console_url = remote.generate_url_from_id(id=i)
console_url = remote.generate_console_url(i)
print_activation_message = False
if is_lp and activate_launchplans:
remote.activate_launchplan(i)
Expand Down

0 comments on commit e33960f

Please sign in to comment.