Skip to content

Commit

Permalink
Fix Flytefile Remote Path Error (#2544)
Browse files Browse the repository at this point in the history
* print messages for sandbox execute and local execute

Signed-off-by: Future-Outlier <[email protected]>

* remove PR 2476 change

Signed-off-by: Future-Outlier <[email protected]>

* print execution mode in flytefile

Signed-off-by: Future-Outlier <[email protected]>

* add should upload

Signed-off-by: Future-Outlier <[email protected]>

* add condition ctx.execution_state.mode != ExecutionState.Mode.TASK_EXECUTION

Signed-off-by: Future-Outlier <[email protected]>

* bug found, need to call the function

Signed-off-by: Future-Outlier <[email protected]>

* remove comparison

Signed-off-by: Future-Outlier <[email protected]>

* use ctx.execution_state.is_local_execution()

Signed-off-by: Future-Outlier <[email protected]>

* lint

Signed-off-by: Future-Outlier <[email protected]>

* fix bug

Signed-off-by: Future-Outlier <[email protected]>

* remove comments

Signed-off-by: Future-Outlier <[email protected]>

* revert is_local_execution

Signed-off-by: Future-Outlier <[email protected]>

---------

Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
  • Loading branch information
Future-Outlier authored and fiedlerNr9 committed Jul 25, 2024
1 parent 3d4bfbc commit 440dc3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flytekit/core/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def with_params(
user_space_params=user_space_params if user_space_params else self.user_space_params,
)

def is_local_execution(self):
def is_local_execution(self) -> bool:
return (
self.mode == ExecutionState.Mode.LOCAL_TASK_EXECUTION
or self.mode == ExecutionState.Mode.LOCAL_WORKFLOW_EXECUTION
Expand Down
4 changes: 2 additions & 2 deletions flytekit/types/file/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def to_literal(
# Set the remote destination if one was given instead of triggering a random one below
remote_path = python_val.remote_path or None

if ctx.execution_state.is_local_execution and python_val.remote_path is None:
if ctx.execution_state.is_local_execution() and python_val.remote_path is None:
should_upload = False

elif isinstance(python_val, pathlib.Path) or isinstance(python_val, str):
Expand All @@ -458,7 +458,7 @@ def to_literal(
p = pathlib.Path(python_val)
if not p.is_file():
raise TypeTransformerFailedError(f"Error converting {python_val} because it's not a file.")
if ctx.execution_state.is_local_execution:
if ctx.execution_state.is_local_execution():
should_upload = False
# python_type must be os.PathLike - see check at beginning of function
else:
Expand Down

0 comments on commit 440dc3a

Please sign in to comment.