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

Make 'path' an optional argument for Queue() so that messages may be sent to non-lpipe lambdas #22

Merged
merged 2 commits into from
Jun 15, 2020

Conversation

charlieparkes
Copy link
Collaborator

@charlieparkes charlieparkes commented Jun 15, 2020

Previously, queue required that the path variable be provided. When used by a path/payload , pipeline.execute_payload would send an lpipe-ready message to the subsequent queue.

my_queue = Queue(
    type=QueueType.SQS,
    url=my_queue_url,
    path="EXAMPLE_PATH"
)

def my_function(**kwargs):
    return Payload(
        path=my_queue,
        kwargs={"foo": "bar"}
    )

# lpipe will send the following message...
{"path": "EXAMPLE_PATH", "kwargs": {"foo": "bar"}}

This MR allows you to send kwargs at the root level of the message, which is especially useful if you want to send messages to a queue read by a service which doesn't use lpipe.

my_queue = Queue(
    type=QueueType.SQS,
    url=my_queue_url,
    # path="EXAMPLE_PATH" <-- no longer a required argument
)

# When used in a payload as demonstrated above, the following message will be sent...
{"foo": "bar"}

@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #22 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   93.52%   93.55%   +0.02%     
==========================================
  Files          18       18              
  Lines         695      698       +3     
==========================================
+ Hits          650      653       +3     
  Misses         45       45              
Impacted Files Coverage Δ
lpipe/contrib/__init__.py 100.00% <ø> (ø)
lpipe/queue.py 100.00% <ø> (ø)
lpipe/pipeline.py 86.78% <100.00%> (+0.17%) ⬆️

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 2ae2e62...45b3bb2. Read the comment docs.

@charlieparkes charlieparkes changed the title Make Queue(path=) optional so that messages may be sent to non-lpipe lambdas Make path an optional argument for Queue() so that messages may be sent to non-lpipe lambdas Jun 15, 2020
@charlieparkes charlieparkes changed the title Make path an optional argument for Queue() so that messages may be sent to non-lpipe lambdas Make 'path' an optional argument for Queue() so that messages may be sent to non-lpipe lambdas Jun 15, 2020
@charlieparkes charlieparkes self-assigned this Jun 15, 2020
@charlieparkes charlieparkes merged commit 4b47d4c into master Jun 15, 2020
@charlieparkes charlieparkes deleted the queue_with_no_path branch July 6, 2020 22:06
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.

2 participants