-
Notifications
You must be signed in to change notification settings - Fork 5
feat: init binding and async #1
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
feat: init binding and async #1
Conversation
Fix failing assert to look for a different error message, likely due to a change in CloudEvents error message. Also add tests so that code coverage is back at 100%. Signed-off-by: Kehui Li <kehui.li@uisee.com>
Signed-off-by: Kehui Li <kehui.li@uisee.com>
Kehui Li seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
de96a02
to
05df573
Compare
That's a great enhancement! Thanks @kehuili And to utilize this python functions-framework, we might need to update https://github.com/OpenFunction/builder as well. Ben |
Just signed CLA. Also I picked a commit from GCP for a test fix (or one unit test would fail forever), it seems he/she also need to sign. Do I need to revert this commit and just commit this change myself? |
No, just you sign the CLA is all right |
src/openfunction/function_context.py
Outdated
uri = json_dct.get('uri') or '' | ||
component_name = json_dct.get('componentName') or '' | ||
metadata = json_dct.get('metadata') | ||
component_type = json_dct.get('componentType') or '' | ||
operation = json_dct.get('operation') or '' |
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.
Would it be better to use get("key", "default")
?
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.
Indeed.
lgtm |
is the quick start example in the readme need to be updated as well? |
Kehui Li seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. @kehuili you may need to add your email used to sign this commit as your github primary email and sign the cla again. |
src/openfunction/function_context.py
Outdated
OPEN_FUNC_BINDING = "bindings" | ||
OPEN_FUNC_TOPIC = "pubsub" | ||
|
||
KNATIVE_RUNTIME_TYPE = "Knative" |
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.
Is this runtime type used as the runtime
field of serving?
If so it should be in lower case knative
or async
like https://github.com/OpenFunction/samples/blob/main/functions/async/logs-handler-function/logs-handler-function.yaml#L22
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's for runtime in FUNC_CONTEXT, so I thought it should be capitalized w/ first letter like examples here https://github.com/OpenFunction/samples/blob/bb4e664321f0a2e9d509543936abf9a9b776557c/functions-framework/golang/Knative/http/README.md#func_context
Definitely gonna add some samples later🙆♀️ |
src/functions_framework/_cli.py
Outdated
context = _function_registry.get_openfunction_context(None) | ||
|
||
# determine if async or knative | ||
if context and context.runtime == ASYNC_RUNTIME_TYPE: |
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.
Let's make a case insensitive comparison for xx_RUNTIME_TYPE
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.
Done.
Signed-off-by: Kehui Li <kehui.li@uisee.com>
9444e51
to
830895a
Compare
This big initial PR is an important upgrade to current GCP Python Function Framework with following task accomplished: