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

Add node resource overrides #523

Merged
merged 9 commits into from
Jun 25, 2021
Merged

Add node resource overrides #523

merged 9 commits into from
Jun 25, 2021

Conversation

katrogan
Copy link
Contributor

Signed-off-by: Katrina Rogan [email protected]

TL;DR

Add node resource overrides

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

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

flyteorg/flyte#475
flyteorg/flyte#1170

Follow-up issue

NA

Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
@katrogan katrogan requested a review from EngHabu June 25, 2021 00:24
EngHabu
EngHabu previously approved these changes Jun 25, 2021
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
@codecov
Copy link

codecov bot commented Jun 25, 2021

Codecov Report

Merging #523 (1f1a783) into master (7667a15) will increase coverage by 0.00%.
The diff coverage is 86.25%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #523   +/-   ##
=======================================
  Coverage   85.37%   85.37%           
=======================================
  Files         369      369           
  Lines       28199    28276   +77     
  Branches     2281     2290    +9     
=======================================
+ Hits        24074    24140   +66     
- Misses       3505     3510    +5     
- Partials      620      626    +6     
Impacted Files Coverage Δ
flytekit/core/node.py 76.00% <56.52%> (-8.62%) ⬇️
tests/flytekit/unit/core/test_node_creation.py 97.67% <94.11%> (-0.54%) ⬇️
flytekit/common/translator.py 89.62% <100.00%> (+0.07%) ⬆️
flytekit/models/core/workflow.py 100.00% <100.00%> (ø)
tests/flytekit/unit/models/core/test_workflow.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 7667a15...1f1a783. Read the comment docs.

EngHabu
EngHabu previously approved these changes Jun 25, 2021
flytekit/core/node.py Outdated Show resolved Hide resolved
@@ -100,8 +100,8 @@ def to_flyte_idl(self):
:rtype: flyteidl.core.tasks_pb2.Resources
"""
return _core_task.Resources(
requests=[r.to_flyte_idl() for r in self.requests],
limits=[r.to_flyte_idl() for r in self.limits],
requests=[r.to_flyte_idl() for r in self.requests] if self.requests is not None else None,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should revert this - locally at least, unit tests passed for me. #525

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but now that we can initialize the model with optionally empty requests or limits, we can't, right?

they fail for me

FAILED tests/flytekit/unit/models/core/test_workflow.py::test_workflow_template - TypeError: 'NoneType' object is not iterable
FAILED tests/flytekit/unit/models/core/test_workflow.py::test_task_node - TypeError: 'NoneType' object is not iterable
FAILED tests/flytekit/unit/models/core/test_workflow.py::test_node_task_with_no_inputs - TypeError: 'NoneType' object is not iterable
FAILED tests/flytekit/unit/models/core/test_workflow.py::test_node_task_with_inputs - TypeError: 'NoneType' object is not iterable
FAILED tests/flytekit/unit/models/core/test_workflow.py::test_branch_node - TypeError: 'NoneType' object is not iterable

Copy link
Contributor

Choose a reason for hiding this comment

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

then why is this passing? #525

@@ -272,7 +273,9 @@ def get_serializable_node(
inputs=entity.bindings,
upstream_node_ids=[n.id for n in upstream_sdk_nodes],
output_aliases=[],
task_node=workflow_model.TaskNode(reference_id=task_spec.template.id),
task_node=workflow_model.TaskNode(
reference_id=task_spec.template.id, overrides=TaskNodeOverrides(resources=entity._resources)
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 the Resource models though right? They're the internal dataclass. Don't they need to be translated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i see. can we update the type hint on line 36 of node.py then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes, thanks for the catch

Signed-off-by: Katrina Rogan <[email protected]>
katrogan added 3 commits June 25, 2021 10:12
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
def __init__(self, requests, limits):
def __init__(
self,
requests: typing.Optional[typing.List[ResourceEntry]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

nix this too?

Signed-off-by: Katrina Rogan <[email protected]>
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.

i meant just the optional part but cool, doesn't matter, already in the docstring anyways

@katrogan katrogan merged commit 72f342f into master Jun 25, 2021
wild-endeavor pushed a commit that referenced this pull request Jun 30, 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