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

FlyteCoPilot: Raw container support [Alpha] #107

Merged
merged 27 commits into from
Jun 30, 2020
Merged

Conversation

kumare3
Copy link
Contributor

@kumare3 kumare3 commented May 5, 2020

TL;DR

This change adds a new type of task called SDKRawContainer task. Currently this is in Alpha, but eventually will become the base task for all container executions on K8s.

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

Refer to the Design doc at https://docs.google.com/document/d/1ZsCDOZ5ZJBPWzCNc45FhNtYQOxYHz0PAu9lrtDVnUpw/edit?ts=5ea7f579#

Tracking Issue

flyteorg/flyte#297

Follow-up issue

NA

Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

minor comments and request for a docs and one test

:param metadata_format: Format in which the metadata will be available for the script
"""

# Set as class fields which are used down below to configure implicit
Copy link
Contributor

Choose a reason for hiding this comment

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

these aren't class fields though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self.input_data_dir = input_data_dir self.output_data_dir = output_data_dir self.metadata_format = metadata_format

"This is deprecated!"
)

# Here we set the routing_group, catalog, and schema as implicit
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover comment from presto?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true!

# parameters for caching purposes
i = _interface.TypedInterface(inputs=types_to_variable(inputs), outputs=types_to_variable(outputs))

# TODO create custom proto to store data dir and other things
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no not remove, add the custom proto I guess?

from flytekit.sdk.types import Types


def test_raw_container_task_definition():
Copy link
Contributor

Choose a reason for hiding this comment

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

can you do a test in your test harness, and maybe add one here, where you have a workflow with two of these raw container tasks and the second one consumes the output of the first one? Or is that not possible to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is possible, good point. I actually have a real workflow, just scroll up. But i will write an test workflow too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually i cannot write a test today, as it will execute it locally, which we do not want


class SdkRawContainerTask(_base_task.SdkTask):
"""
This class includes the logic for building a task that executes as a Presto task.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a few paragraphs of documentation here or somewhere else on 1) how to use this and 2) how it works?

For 1) I've left you a page to fill in here: https://github.com/lyft/flytesnacks/blob/cookbook/cookbook/workflows/recipe_5/index.rst

Feel free to check out that branch and commit... or make your own PR if you want the street cred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice :D will do

)

echo = SdkRawContainerTask(
input_data_dir="/var/flyte/inputs",
inputs={"x": Types.Integer},
image="alpine",
command=["cat", "/var/flyte/inputs.json"],
command=["sh" "-c", "ls /var/flyte/inputs; cat /var/flyte/inputs/inputs.json"],
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make this a bit more complicated? echo '3 + 5' | bc > output_file. where 3 and or 5 comes from an input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the previous step is complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you want i can modify this to produce an output?

@kumare3 kumare3 changed the title [WIP] RawContainer Task support FlyteCoPilot: Raw container support [Alpha] May 27, 2020
Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

Pushed a couple of trivial unit tests.

)

# Override method in order to set the implicit inputs
def __call__(self, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

@wild-endeavor
Copy link
Contributor

Also, bump version.

@wild-endeavor
Copy link
Contributor

Also, it looks like python 2.7 tests are failing. let's just stop running them. it's in travis.yml. I thought we had done that already but i guess not.

@@ -2,4 +2,4 @@

import flytekit.plugins

__version__ = '0.9.1'
__version__ = '0.9.3'
Copy link
Contributor

Choose a reason for hiding this comment

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

i made this 0.9.3 cuz I thought katrina's change for single-task would go in first but I think this will go in first actually.

wild-endeavor
wild-endeavor previously approved these changes Jun 17, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2020

Codecov Report

Merging #107 into master will increase coverage by 0.02%.
The diff coverage is 79.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   81.37%   81.39%   +0.02%     
==========================================
  Files         215      217       +2     
  Lines       14027    14145     +118     
  Branches     1146     1159      +13     
==========================================
+ Hits        11415    11514      +99     
- Misses       2341     2349       +8     
- Partials      271      282      +11     
Impacted Files Coverage Δ
flytekit/common/tasks/presto_task.py 80.00% <57.14%> (+5.58%) ⬆️
flytekit/common/tasks/raw_container.py 70.76% <70.76%> (ø)
flytekit/models/task.py 91.36% <85.71%> (-1.08%) ⬇️
flytekit/__init__.py 100.00% <100.00%> (ø)
flytekit/common/constants.py 100.00% <100.00%> (ø)
flytekit/common/tasks/task.py 66.14% <100.00%> (+1.57%) ⬆️
...unit/common_tests/tasks/test_raw_container_task.py 100.00% <100.00%> (ø)
tests/flytekit/unit/models/test_tasks.py 100.00% <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 a33f156...daeaf26. Read the comment docs.

wild-endeavor
wild-endeavor previously approved these changes Jun 30, 2020
wild-endeavor
wild-endeavor previously approved these changes Jun 30, 2020
@wild-endeavor wild-endeavor merged commit a106ba7 into master Jun 30, 2020
max-hoffman pushed a commit to dolthub/flytekit that referenced this pull request May 11, 2021
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