-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix: uses_request being applied to uses_after and uses_before #4228
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4228 +/- ##
==========================================
+ Coverage 81.38% 86.82% +5.43%
==========================================
Files 114 114
Lines 8272 8286 +14
==========================================
+ Hits 6732 7194 +462
+ Misses 1540 1092 -448
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
|
||
with Flow(port_expose=exposed_port).add( | ||
uses=FooExecutor, | ||
uses_requests={'/foo': 'foo'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but is the bar
available on /bar
? Can you add a test to assert this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No; should it be?
def test_override_requests_two_entrypoints():
class FooExecutor(Executor):
@requests(on='/bar')
def foo(self, docs, **kwargs):
for doc in docs:
doc.text = 'foo called'
with Flow(port_expose=exposed_port).add(
uses=FooExecutor,
uses_requests={'/foo': 'foo'},
) as f:
c = Client(port=exposed_port)
resp1 = c.post(
on='/foo', inputs=DocumentArray([Document(text='')]), return_results=True
)
resp2 = c.post(
on='/bar',
inputs=DocumentArray([Document(text='')]),
return_results=True,
)
assert resp1[0].docs[0].text == 'foo called'
assert resp2[0].docs[0].text == 'foo called'
This fails, but that shouldn't have anything to do with our change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, all good for this PR, from what I can tell. Just wondering in terms of general usage. I would expect that OtherExecutor still has its endpoint bound to /bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, might be worth a change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-read your comment, understood it this time, and added a test accordingly ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh so it does preserve the OtherExecutor.bar binding. Good
related to this issue #4054 |
No description provided.