-
Notifications
You must be signed in to change notification settings - Fork 530
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
Jobs API Quickstart for Python - HTTP #1160
base: release-1.15
Are you sure you want to change the base?
Conversation
Signed-off-by: Fernando Rocha <[email protected]>
Signed-off-by: Martin Oehlert <[email protected]>
Signed-off-by: Fernando Rocha <[email protected]>
Signed-off-by: Fernando Rocha <[email protected]>
Signed-off-by: Fernando Rocha <[email protected]>
Signed-off-by: Fernando Rocha <[email protected]>
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.
A few minor things :) ty!
@@ -0,0 +1,276 @@ | |||
### Flask ### |
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 should always have the gitignore at the root, not nested
## Install dependencies | ||
|
||
```bash | ||
pip install -r requirements.txt |
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.
Don't the mechanical markdown tests need this to run correctly? Can you confirm they run locally?
dapr run --app-id job-service --app-port 6200 --dapr-http-port 6280 -- python app.py | ||
``` | ||
|
||
### Schedule Jobs |
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.
### Schedule Jobs | |
### Schedule jobs |
print('Received job request...', flush=True) | ||
|
||
try: | ||
# Check if path starts with /job/ |
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.
why do we need this?
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.
to ignore paths paths sent to this server. Instead of enabling a /job endpoint, Python's HTTPServer accepts requests to any endpoint and you allow or deny within the method implementation.
# Parse outer JSON data | ||
outer_data = json.loads(raw_data) | ||
|
||
# The payload might be double-encoded, so try parsing again if it's a string |
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.
Also why do we need this if we are the ones sending the payload as well? just don't double-encode it?
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.
I had issues parsing this data as-is. Had to add this to make it work. I can take some time to investigate it more.
Co-authored-by: Alice Gibbons <[email protected]> Signed-off-by: Fernando Rocha <[email protected]>
Co-authored-by: Alice Gibbons <[email protected]> Signed-off-by: Fernando Rocha <[email protected]>
Signed-off-by: Fernando Rocha <[email protected]>
Description
Creating Jobs API Quickstart for Python - HTTP
Issue reference
Please reference the issue this PR will close: #1110
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: