Skip to content

Remove sync singledispatch, add option for top-level only sync - #681

Merged
wild-endeavor merged 7 commits into
masterfrom
clean-up-remote
Oct 7, 2021
Merged

wild-endeavor merged 7 commits into
masterfrom
clean-up-remote

Conversation

@wild-endeavor

@wild-endeavor wild-endeavor commented Sep 29, 2021

Copy link
Copy Markdown
Contributor

Signed-off-by: Yee Hing Tong wild-endeavor@users.noreply.github.com

TL;DR

This removes the singledispatchmethod for remote.sync and replaces the main function with one that only works for FlyteWorkflowExecution instances. The other registered methods have been renamed to sync_xyz. The singledispatch was too hard to decipher and confusing to navigate in an IDE.

Also added a switch sync_nodes (by default True to maintain current behavior) to the sync call so that people can sync executions that have dynamic tasks that run launch plans and subworkflows in lieu of flyteorg/flyte#1482

Type

  • Bug Fix
  • Feature
  • Plugin
  • Refactor

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

See above.

Tracking Issue

NA

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
@codecov

codecov Bot commented Sep 29, 2021

Copy link
Copy Markdown

Codecov Report

Merging #681 (1c5697c) into master (243adb7) will decrease coverage by 0.01%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #681      +/-   ##
==========================================
- Coverage   85.69%   85.68%   -0.02%     
==========================================
  Files         355      355              
  Lines       29683    29682       -1     
  Branches     2425     2427       +2     
==========================================
- Hits        25438    25434       -4     
- Misses       3604     3606       +2     
- Partials      641      642       +1     
Impacted Files Coverage Δ
flytekit/remote/remote.py 72.46% <55.55%> (-0.79%) ⬇️
tests/flytekit/integration/remote/test_remote.py 91.62% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 243adb7...1c5697c. Read the comment docs.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
@eapolinario
eapolinario marked this pull request as ready for review October 1, 2021 21:33

@kumare3 kumare3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why can't we still keep the sync method and just use an if else case to switch dispatch?

@eapolinario

Copy link
Copy Markdown
Collaborator

Why can't we still keep the sync method and just use an if else case to switch dispatch?

I'd argue that this makes the code less clear, I'd much rather keep sync in the API for backwards compatibility (people in the wild are already relying on this) and make the library code more clear. In the future we might deprecate sync altogether if we can reach a point where it's not needed (i.e. we'll sync whenever necessary, still TBD if we can do it in all cases without taking a huge perf hit).

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
@wild-endeavor wild-endeavor changed the title Remove sync singledispatch Remove sync singledispatch, add option for top-level only sync Oct 6, 2021
Comment thread flytekit/remote/remote.py Outdated
so that we don't break people.
:param execution:
:param entity_definition:
:return:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you update the docstring?

Comment thread flytekit/remote/remote.py Outdated
execution: typing.Union[FlyteWorkflowExecution, FlyteNodeExecution, FlyteTaskExecution],
execution: FlyteWorkflowExecution,
entity_definition: typing.Union[FlyteWorkflow, FlyteTask] = None,
workflow_only: bool = False,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

workflow_only is not clear, how about sync_children_nodes?

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.

okay

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>

@eapolinario eapolinario left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@wild-endeavor
wild-endeavor merged commit 1fb425f into master Oct 7, 2021
eapolinario pushed a commit that referenced this pull request Oct 8, 2021
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
AdrianoKF pushed a commit to AdrianoKF/flytekit that referenced this pull request Oct 11, 2021
…org#681)


Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
eapolinario added a commit that referenced this pull request Oct 19, 2021
* Run 3.9 in CI

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Also run 3.9 in plugins tests.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Fix tests

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Account for the different exception type raised in case of wrong types

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Exclude spark2

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Failed to load json_data to dataclass (#684)

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Remove sync singledispatch, add option for top-level only sync (#681)

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Failed to transform path string to Literal (#689)

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Don't node sync on remote wait (#690)

* no node sync

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>

* add param to wait

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Fix plugin regressions (#688)

* fix pandera regression

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* install plugin with pip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* fix pandera plugin tests

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* add spark flytekit plugin to papermill test_requires

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* add sqlalchemy to great expectations plugin

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* wip

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* plugins plugins plugins!

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* lint

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>

* Exclude does not understand lists

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Invert python version check

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Invert python version check for real this time

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Enable 3.10 just for kicks

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Add quotes around python versions

Yes, this is needed, please see https://dev.to/hugovk/the-python-3-1-problem-85g.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Revert "Add quotes around python versions"

This reverts commit 4d619d5.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Revert "Enable 3.10 just for kicks"

This reverts commit bd6d694.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* wip - restricted types

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* wip - restricted types

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Comment use of restricted types in get_transformer

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Publish 3.9 image

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Add python 3.9 to the list of supported languages

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Comment RestrictedTypeTransformer and add one test case.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Review feedback

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Comment RestrictedTypeTransformer

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Handle the TypeError

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Remove breakpoint

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

Co-authored-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Co-authored-by: Kevin Su <pingsutw@gmail.com>
Co-authored-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Co-authored-by: Niels Bantilan <niels.bantilan@gmail.com>
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