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

fix: uses_request being applied to uses_after and uses_before #4228

Merged
merged 4 commits into from
Feb 1, 2022

Conversation

JohannesMessner
Copy link
Contributor

No description provided.

@github-actions github-actions bot added size/S area/core This issue/PR affects the core codebase area/testing This issue/PR affects testing labels Jan 31, 2022
@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #4228 (93b5f73) into master (5cef964) will increase coverage by 5.43%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
daemon 42.43% <0.00%> (+0.13%) ⬆️
jina 86.56% <100.00%> (+8.85%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
jina/orchestrate/pods/__init__.py 80.80% <100.00%> (+3.47%) ⬆️
jina/serve/runtimes/gateway/http/app.py 90.80% <0.00%> (-0.21%) ⬇️
jina/serve/runtimes/gateway/http/models.py 99.10% <0.00%> (-0.04%) ⬇️
jina/jaml/__init__.py 95.47% <0.00%> (+0.41%) ⬆️
jina/orchestrate/pods/config/docker_compose.py 100.00% <0.00%> (+0.53%) ⬆️
jina/serve/networking.py 71.27% <0.00%> (+1.08%) ⬆️
jina/helper.py 81.87% <0.00%> (+1.22%) ⬆️
jina/jaml/parsers/flow/v1.py 98.24% <0.00%> (+1.75%) ⬆️
jina/clients/base/http.py 96.22% <0.00%> (+2.10%) ⬆️
jina/jaml/helper.py 85.36% <0.00%> (+2.43%) ⬆️
... and 13 more

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 fce3ce7...93b5f73. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 31, 2022

Latency summary

Current PR yields:

  • 🐢🐢 index QPS at 874, delta to last 2 avg.: -42%
  • 🐎🐎🐎🐎 query QPS at 43, delta to last 2 avg.: +39%
  • 🐢🐢 avg flow time within 1.2883 seconds, delta to last 2 avg.: -6%
  • 😶 import jina within 0.3552 seconds, delta to last 2 avg.: +1%

Breakdown

Version Index QPS Query QPS Avg Flow Time (s) Import Time (s)
current 874 43 1.2883 0.3552
2.6.4 1583 30 1.4619 0.3519
2.6.3 1477 31 1.2809 0.3448

Backed by latency-tracking. Further commits will update this comment.


with Flow(port_expose=exposed_port).add(
uses=FooExecutor,
uses_requests={'/foo': 'foo'},
Copy link
Contributor

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?

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; 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.

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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 ;)

Copy link
Contributor

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

@samsja
Copy link
Contributor

samsja commented Jan 31, 2022

related to this issue #4054

@JoanFM JoanFM changed the title Fix: uses_request being applied to uses_after and uses_before 4054 fix: uses_request being applied to uses_after and uses_before 4054 Jan 31, 2022
@JoanFM JoanFM changed the title fix: uses_request being applied to uses_after and uses_before 4054 fix: uses_request being applied to uses_after and uses_before Jan 31, 2022
@samsja samsja marked this pull request as ready for review February 1, 2022 07:35
@samsja samsja merged commit ecaae24 into master Feb 1, 2022
@samsja samsja deleted the fix-uses_request-4054 branch February 1, 2022 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/testing This issue/PR affects testing size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants