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

Interface for remote execution in Jupyter Notebook #2618

Closed
wants to merge 37 commits into from

Conversation

Mecoli1219
Copy link
Contributor

@Mecoli1219 Mecoli1219 commented Jul 27, 2024

Tracking issue or PR

#2579

Why are the changes needed?

Enable this usage:

init_remote(Config.auto(), default_project="flytesnacks", default_domain="development")

@task
def hello(name: str) -> str:
    return f"Hello {name}"

@task
def world(pre: str) -> str:
    return f"{pre} Welcome to the world!"

@workflow
def wf(name: str) -> str:
    return world(pre=hello(name=name))

future = wf.remote(name="Flyte says...")
out = future.get()

What changes were proposed in this pull request?

  • a remote() function for workflow and task.
  • a init_remote() function to store the remote configuration.
  • FlyteFuture class to store the remote execution data.
  • a new integration unit-test testing the Jupyter Notebook environment.
  • Default option, currently set as another variable, should merge into FlyteRemote in the future
  • Doc
  • get_deck
  • Add translator unit-test if interactive_mode_enabled => check pickle & no dest-dir
  • update unit-test to remove version
  • Remove fast_register_file_uploader

How was this patch tested?

All the tests were tested locally.

  1. I created a ipynb file similar to the one provided in [wip] Jupyter notebooks support - run tasks on remote cluster! #2579 (https://www.loom.com/share/1369e80571e8427fbfc8e2c6ad127d67?sid=658c01ce-da5c-4bff-b50d-57c61107fba6) with the new interface.
  2. I tested the PyTorch example in Flytesnack.
  3. I tested the new integration unit test with the docker image built from Dockerfile.dev.

Screenshots

  1. get_deck()
image

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

#2579

Docs link

@Mecoli1219 Mecoli1219 changed the title [WIP] Interface for remote execution in Jupyter Notebook Interface for remote execution in Jupyter Notebook Jul 28, 2024
@Mecoli1219 Mecoli1219 marked this pull request as ready for review July 28, 2024 17:19
@kumare3
Copy link
Contributor

kumare3 commented Jul 28, 2024

OHH WOW this is amazing stuff. I am really excited about this. The only problem I see is if we simply convert this into a script it will fail, but we can solve that problem as a separate PR.

@kumare3
Copy link
Contributor

kumare3 commented Jul 29, 2024

@Mecoli1219 this is great, how about few more unit tests for translator, tracker and entrypoint.
I would love to have unit tests for entrypoint specifically. Otherwise it will be subtly break.

Also if you could test if this thing works with some large scale examples, like maybe when we have some state in jupyter notebook etc. Basically a few more real world tests. Also if ray/spark work?

flytekit/core/base_task.py Show resolved Hide resolved
:param src: The source file to upload
"""
# return md5_bytes and path
return "", file_access.put_data(src, dest)
Copy link
Member

Choose a reason for hiding this comment

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

if it always returns the "", why do we need it here?

Copy link

codecov bot commented Aug 3, 2024

Codecov Report

Attention: Patch coverage is 79.87013% with 31 lines in your changes missing coverage. Please review.

Project coverage is 49.94%. Comparing base (ae9c6f8) to head (76db07d).
Report is 57 commits behind head on master.

Files with missing lines Patch % Lines
flytekit/core/future.py 70.58% 13 Missing and 2 partials ⚠️
flytekit/tools/translator.py 80.00% 4 Missing and 4 partials ⚠️
flytekit/core/tracker.py 0.00% 2 Missing and 1 partial ⚠️
flytekit/remote/remote.py 88.00% 3 Missing ⚠️
flytekit/core/promise.py 75.00% 1 Missing ⚠️
flytekit/remote/executions.py 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (ae9c6f8) and HEAD (76db07d). Click for more details.

HEAD has 14 uploads less than BASE
Flag BASE (ae9c6f8) HEAD (76db07d)
15 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2618       +/-   ##
===========================================
- Coverage   90.87%   49.94%   -40.93%     
===========================================
  Files          74      196      +122     
  Lines        3331    19824    +16493     
  Branches        0     2867     +2867     
===========================================
+ Hits         3027     9902     +6875     
- Misses        304     9399     +9095     
- Partials        0      523      +523     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mecoli1219
Copy link
Contributor Author

@kumare3 Default options and interactive_mode_enabled kwargs are added, and all the existing and new unit tests pass. Could you take a look at it? Thanks!
BTW, we can have a 1-on-1 chat if needed

Copy link
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

Could we move the log (Jupyter notebook..) to init_remote?
Also, I think we can remove Uploading Pickled representation of Task to remote storage...

Screenshot 2024-08-05 at 12 44 53 PM

flytekit/bin/entrypoint.py Show resolved Hide resolved
flytekit/bin/entrypoint.py Show resolved Hide resolved
flytekit/core/future.py Show resolved Hide resolved
flytekit/core/future.py Outdated Show resolved Hide resolved
flytekit/core/future.py Outdated Show resolved Hide resolved
flytekit/remote/remote.py Outdated Show resolved Hide resolved
flytekit/remote/remote.py Outdated Show resolved Hide resolved
self._serialize_and_register(entity=entity, settings=serialization_settings, version=version)
)
try:
import nest_asyncio
Copy link
Member

Choose a reason for hiding this comment

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

This code is the same as line 869~879; could we add a common function for it?

flytekit/remote/remote.py Outdated Show resolved Hide resolved
flytekit/tools/translator.py Outdated Show resolved Hide resolved
kumare3 added 4 commits August 8, 2024 15:54
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
@Mecoli1219 Mecoli1219 requested a review from fg91 as a code owner August 14, 2024 07:18
@Mecoli1219 Mecoli1219 force-pushed the remote_jupyter branch 2 times, most recently from 0bd6edc to 6f51bce Compare August 14, 2024 08:27
Signed-off-by: Mecoli1219 <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
@thomasjpfan
Copy link
Member

Done in #2733. We can open a new PR if we want to revisit the interface.

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.

4 participants