-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Arch preview feedback #16441
Arch preview feedback #16441
Conversation
/azp run python - eventgrid - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - eventgrid - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
/check-enforcer evaluate |
cloud_event = CloudEvent( | ||
source = "http://samplesource.dev", | ||
data = b'cloudevent', | ||
type="Sample.Cloud.Event" | ||
) | ||
|
||
def callback(request): | ||
req = json.loads(request.http_request.body) | ||
assert req[0].get("data_base64") is not None | ||
assert req[0].get("data") is None |
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.
now I'm getting a bit confused by this request body.. because you set the data
in the CloudEvent
while the http request body get("data")
is None,
so if I pass bytes to the data
argument, which will internally set the data_base64
variable?
cloud_event = CloudEvent(
data = b'cloudevent',
)
# which of the following will have the value set?
cloud_event.data
cloud_event.data_base64
or it's just implementation detail that users don't need to care about.
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.
internally, cloud_event.data_base64
is set when we we pass bytes regardless of what we use in data
, data_base64
to send bytes.
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.
Based on the above, it might be useful to add a sample where you deserialize the CloudEvent that has the data
field set to a binary value. Then, after deserializing, call cloud_event.data_base64
and comment that it returns a not None value. Like this sample, except with the data field set to b'cloudevent'
like the test above.
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.
we do not have a from_dict
implementation yet - it'd make more sense to add the samples after we have a symmetric workflow (plus i would like to unblock the breaking changes first)
sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py
Outdated
Show resolved
Hide resolved
sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Adam Ling (MSFT) <adam_ling@outlook.com>
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.
One more thing: you probably will need to update the samples/README.md
file to reflect the changes here (which you may already be planning on doing).
|
||
### EventGridDeserializer | ||
`EventGridDeserializer` is used to desrialize an event received. | ||
Either a list or a single instance of CloudEvent/EventGridEvent can be sent. Alternatively, a list or a single instance of the dict representation of CloudEvent/EventGridEvent or a Custom Schema can also be published. |
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.
The wording is a little confusing. Might be more clear to separate the idea that CloudEvent/EGEvents can be sent as dicts and that events in a custom schema can be sent as a dict or list of dicts. Would be useful to add links for either the samples of sending all these different formats or from the champion_scenarios.md
. Something like?
Either a list or a single instance of CloudEvent/EventGridEvent can be sent. Alternatively, a list or a single instance of the dict representation of CloudEvent/EventGridEvent or a Custom Schema can also be published. | |
The following formats of events are allowed to be sent: | |
- a [list of strongly-typed EventGridEvents](add link to list of strongly typed EGE from champion_scenarios.md) | |
- a [list of strongly-typed CloudEvents](add link to scenario from champion_scenarios.md) | |
- a [single strongly-typed EventGridEvent instance](add link to single strongly typed EGE from champion_scenarios.md) | |
- a [single strongly-typed CloudEvent instance](add link to scenario from champion_scenarios.md) | |
- a list of the [dict representation of EventGridEvents](add link) | |
- a list of the [dict representation of CloudEvents](add link) | |
- a single instance of the [dict representation of EventGridEvent](url) | |
- a single instance of the [dict representation of CloudEvent](url) | |
- a list of [dicts in a custom schema](link) | |
- a single [dict in a custom schema](url) |
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.
it would be worth it - i'll tackle it in the samples issue though since i fell this is a non blocker. changing the wording a bit for now
|
||
for event in deserialized_dict_events: | ||
print(event.data) | ||
print(type(event)) |
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.
out of curiosity, did you run all these samples outlined here? Or did you copy them from the actual samples and change things to fit each of the scenarios?
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.
good questions - if you noticed, the from_dict isn't implemented yet :P - other than the two of those, everything else is running and works fine. this file is like a quick reference till i add more relevant samples
cloud_event = CloudEvent( | ||
source = "http://samplesource.dev", | ||
data = b'cloudevent', | ||
type="Sample.Cloud.Event" | ||
) | ||
|
||
def callback(request): | ||
req = json.loads(request.http_request.body) | ||
assert req[0].get("data_base64") is not None | ||
assert req[0].get("data") is None |
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.
Based on the above, it might be useful to add a sample where you deserialize the CloudEvent that has the data
field set to a binary value. Then, after deserializing, call cloud_event.data_base64
and comment that it returns a not None value. Like this sample, except with the data field set to b'cloudevent'
like the test above.
Here's the queued live build https://dev.azure.com/azure-sdk/internal/_build/results?buildId=716144&view=results |
Co-authored-by: Adam Ling (MSFT) <adam_ling@outlook.com>
...grid/azure-eventgrid/samples/publish_samples/publish_custom_schema_events_to_topic_sample.py
Outdated
Show resolved
Hide resolved
…custom_schema_events_to_topic_sample.py
/azp run python - eventgrid - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
…into enum-meta * 'master' of https://github.com/Azure/azure-sdk-for-python: bump six dependencies in some libraries (#16496) call on_error if timeout in flush (#16485) Sync eng/common directory with azure-sdk-tools for PR 1365 (#16505) Fix min dependency tests - update azure core (#16504) Sync eng/common directory with azure-sdk-tools for PR 1364 (#16503) Ma arch feedback (#16502) Adding a new limitation to the README file. (#16475) [Blob][Datalake] STG76 Preview (#16349) append code coverage over each other (#16202) Arch preview feedback (#16441) Support CAE in azure-identity (#16323) [EventHubs] Support for Custom endpoint adddress and custom certificate (#16295) [Communication] - Phone Number Management - Added support for AAD auth (#16075) fix live tests (#16495)
…into analyze_redesign * 'master' of https://github.com/Azure/azure-sdk-for-python: (32 commits) Adopt new MSAL auth code flow API (Azure#16449) [formrecognizer] use ARM template for tests (Azure#16432) T2 kusto 2021 02 04 (Azure#16527) T2 applicationinsights 2021 02 04 (Azure#16525) Sync eng/common directory with azure-sdk-tools for PR 1366 (Azure#16506) [Python] python track2 new pipeline fix (Azure#16494) Added package properties SDKType and NewSDK (Azure#16476) bump six dependencies in some libraries (Azure#16496) call on_error if timeout in flush (Azure#16485) Sync eng/common directory with azure-sdk-tools for PR 1365 (Azure#16505) Fix min dependency tests - update azure core (Azure#16504) Sync eng/common directory with azure-sdk-tools for PR 1364 (Azure#16503) Ma arch feedback (Azure#16502) Adding a new limitation to the README file. (Azure#16475) [Blob][Datalake] STG76 Preview (Azure#16349) append code coverage over each other (Azure#16202) Arch preview feedback (Azure#16441) Support CAE in azure-identity (Azure#16323) [EventHubs] Support for Custom endpoint adddress and custom certificate (Azure#16295) [Communication] - Phone Number Management - Added support for AAD auth (Azure#16075) ...
Fixes #16433