Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TaskSpec instead of TaskTemplate for fetch_task and avoid network when loading module #1348

Merged
merged 18 commits into from
Dec 21, 2022
Merged
2 changes: 0 additions & 2 deletions flytekit/clients/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def handler(self, create_request):
cli_logger.error(_MessageToJson(create_request))
cli_logger.error("Details returned from the flyte admin: ")
cli_logger.error(e.details)
e.details += "create_request: " + _MessageToJson(create_request)
# Re-raise since we're not handling the error here and add the create_request details
raise e

Expand Down Expand Up @@ -260,7 +259,6 @@ def _refresh_credentials_from_command(self):
:param self: RawSynchronousFlyteClient
:return:
"""

command = self._cfg.command
if not command:
raise FlyteAuthenticationException("No command specified in configuration for command authentication")
Expand Down
9 changes: 9 additions & 0 deletions flytekit/clis/sdk_in_container/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
is_flag=True,
help="Enables to skip zipping and uploading the package",
)
@click.option(
"--dry-run",
default=False,
is_flag=True,
help="Execute registration in dry-run mode. Skips actual registration to remote",
)
@click.argument("package-or-module", type=click.Path(exists=True, readable=True, resolve_path=True), nargs=-1)
@click.pass_context
def register(
Expand All @@ -122,6 +128,7 @@ def register(
deref_symlinks: bool,
non_fast: bool,
package_or_module: typing.Tuple[str],
dry_run: bool,
):
"""
see help
Expand Down Expand Up @@ -156,6 +163,7 @@ def register(

# Create and save FlyteRemote,
remote = get_and_save_remote_with_click_context(ctx, project, domain)
click.secho(f"Registering against {remote.config.platform.endpoint}")
try:
repo.register(
project,
Expand All @@ -170,6 +178,7 @@ def register(
fast=not non_fast,
package_or_module=package_or_module,
remote=remote,
dry_run=dry_run,
)
except Exception as e:
raise e
4 changes: 4 additions & 0 deletions flytekit/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __rshift__(self, other: Node):
self.runs_before(other)
return other

@property
def name(self) -> str:
return self._id

@property
def outputs(self):
if self._outputs is None:
Expand Down
1 change: 0 additions & 1 deletion flytekit/core/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ def create_and_link_node_from_remote(
)

flytekit_node = Node(
# TODO: Better naming, probably a derivative of the function name.
id=f"{ctx.compilation_state.prefix}n{len(ctx.compilation_state.nodes)}",
metadata=entity.construct_node_metadata(),
bindings=sorted(bindings, key=lambda b: b.var),
Expand Down
7 changes: 1 addition & 6 deletions flytekit/core/python_function_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,7 @@ def compile_into_workflow(
for entity, model in model_entities.items():
# We only care about gathering tasks here. Launch plans are handled by
# propeller. Subworkflows should already be in the workflow spec.
if not isinstance(entity, Task) and not isinstance(entity, task_models.TaskTemplate):
continue

# Handle FlyteTask
if isinstance(entity, task_models.TaskTemplate):
tts.append(entity)
if not isinstance(entity, Task) and not isinstance(entity, task_models.TaskSpec):
continue

# We are currently not supporting reference tasks since these will
Expand Down
14 changes: 9 additions & 5 deletions flytekit/remote/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@

"""

from flytekit.remote.component_nodes import FlyteTaskNode, FlyteWorkflowNode
from flytekit.remote.entities import (
FlyteBranchNode,
FlyteLaunchPlan,
FlyteNode,
FlyteTask,
FlyteTaskNode,
FlyteWorkflow,
FlyteWorkflowNode,
)
from flytekit.remote.executions import FlyteNodeExecution, FlyteTaskExecution, FlyteWorkflowExecution
from flytekit.remote.launch_plan import FlyteLaunchPlan
from flytekit.remote.nodes import FlyteNode
from flytekit.remote.remote import FlyteRemote
from flytekit.remote.task import FlyteTask
from flytekit.remote.workflow import FlyteWorkflow
163 changes: 0 additions & 163 deletions flytekit/remote/component_nodes.py

This file was deleted.

Loading