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 lazy_loader for pyspark #168

Merged
merged 5 commits into from
Aug 28, 2020
Merged

Use lazy_loader for pyspark #168

merged 5 commits into from
Aug 28, 2020

Conversation

akhurana001
Copy link
Contributor

@akhurana001 akhurana001 commented Aug 26, 2020

TL;DR

Use lazy_loaded for pyspark so that non-spark notebooks can run without pyspark installed.

Also added a dependency on ipykernel . Executions in my local venv were failing with a No module named ipykernel_launcher .

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

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

Complete description

Use lazy_loader for pyspark

Tracking Issue

flyteorg/flyte#488

Follow-up issue

NA
OR
https://github.com/lyft/flyte/issues/

@akhurana001 akhurana001 changed the title [WIP]Remove dependence on pyspark for non-spark notebooks Remove dependence on pyspark for non-spark notebooks Aug 27, 2020
@akhurana001 akhurana001 changed the title Remove dependence on pyspark for non-spark notebooks Use lazy_loader for pyspark Aug 27, 2020
@kumare3
Copy link
Contributor

kumare3 commented Aug 27, 2020

Please update the description completely

@@ -50,6 +50,7 @@
"urllib3>=1.22,<2.0.0",
"wrapt>=1.0.0,<2.0.0",
"papermill>=1.2.0",
"ipykernel>=5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the description. Still not sure why it worked before but adding this does resolve the error I was seeing while testing: jupyter/notebook#1558


from flytekit.common.types.helpers import pack_python_std_map_to_literal_map as _packer
from flytekit.contrib.notebook.supported_types import notebook_types_map as _notebook_types_map
from flytekit.plugins import pyspark as _pyspark
Copy link
Contributor

Choose a reason for hiding this comment

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

this will work because only when we access pyspark.x will it load the real module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's my understanding of lazy_loading here: https://github.com/lyft/flytekit/blob/master/flytekit/plugins/__init__.py#L5 . Have tested, it works.

@akhurana001 akhurana001 merged commit 9dc9911 into master Aug 28, 2020
@akhurana001 akhurana001 deleted the notebook branch August 28, 2020 18:57
max-hoffman pushed a commit to dolthub/flytekit that referenced this pull request May 11, 2021
* Remove dependence on pyspark for non-spark notebooks

* Use lazy_loader for pyspark

* lint

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants