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

Arch preview feedback #16441

Merged
merged 27 commits into from
Feb 3, 2021
Merged

Conversation

rakshith91
Copy link
Contributor

@rakshith91 rakshith91 commented Feb 1, 2021

Fixes #16433

  • Kill Custom Events
  • Kill Deserializer
  • Cloud Event make data optional
  • Support Data / data_base64 (not both)data must be optional ; data_base64 is optional too data can be bytes(convert to data_base64) data and data_base64 at the same time raises.
  • SystemEventMappings to SystemEvents
  • change order of EG event

@ghost ghost added the Event Grid label Feb 1, 2021
@rakshith91 rakshith91 marked this pull request as ready for review February 1, 2021 08:08
@rakshith91
Copy link
Contributor Author

/azp run python - eventgrid - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rakshith91
Copy link
Contributor Author

/azp run python - eventgrid - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@check-enforcer
Copy link

check-enforcer bot commented Feb 2, 2021

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:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

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:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run python - [service] - ci

@rakshith91
Copy link
Contributor Author

/check-enforcer evaluate

Comment on lines +122 to +131
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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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)

Co-authored-by: Adam Ling (MSFT) <adam_ling@outlook.com>
Copy link
Member

@swathipil swathipil left a 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.
Copy link
Member

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?

Suggested change
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)

Copy link
Contributor Author

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))
Copy link
Member

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?

Copy link
Contributor Author

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

Comment on lines +122 to +131
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
Copy link
Member

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.

Rakshith Bhyravabhotla and others added 2 commits February 2, 2021 17:02
@rakshith91
Copy link
Contributor Author

rakshith91 commented Feb 3, 2021

Co-authored-by: Adam Ling (MSFT) <adam_ling@outlook.com>
@rakshith91
Copy link
Contributor Author

/azp run python - eventgrid - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rakshith91 rakshith91 enabled auto-merge (squash) February 3, 2021 06:48
@rakshith91 rakshith91 disabled auto-merge February 3, 2021 18:48
@rakshith91 rakshith91 merged commit fb91388 into Azure:master Feb 3, 2021
iscai-msft added a commit that referenced this pull request Feb 4, 2021
…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)
@swathipil swathipil mentioned this pull request Feb 4, 2021
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Feb 4, 2021
…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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EG arch feedback] Task list
3 participants