GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Composer: Move 'triggering DAGs' sample to GitHub. by tswast · Pull Request #716 · GoogleCloudPlatform/nodejs-docs-samples Conversation
Contributor
Sample was originally hard-coded in HTML at Python code for target DAG is also being moved to GitHub in GoogleCloudPlatform/python-docs-samples#1645 @TrevorEdwards Please review.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #716 +/- ## ======================================= Coverage 55.17% 55.17% ======================================= Files 1 1 Lines 58 58 ======================================= Hits 32 32 Misses 26 26 Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Apply these comments throughout your PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| 'use strict'; | ||
|
|
||
| // [START composer_trigger] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: functions region tags are (usually) prefixed with functions_.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to, but are you a samples lead in go/samples-tracker? I don't have permissions to make functions samples there.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| exports.triggerDag = function triggerDag (event, callback) { | ||
| // Fill in your Composer environment information here. | ||
|
|
||
| // The project that holds your function |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit - typically:
Apply this comment throughout your PR (if you choose to).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Even for a cloud functions sample? This sample is intended to be copy-pasted into the cloud functions web UI, so I believe the function signature is necessary.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const DAG_NAME = 'composer_sample_trigger_response_dag'; | ||
|
|
||
| // Other constants | ||
| const WEBSERVER_URL = 'https://' + WEBSERVER_ID + |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: use template literals to construct strings?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // Make the request | ||
| authorizeIap( | ||
| CLIENT_ID, PROJECT_ID, USER_AGENT, | ||
| function iapAuthorizationCallback (err, jwt, idToken) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can we use promises instead of callbacks here? (Both versions of Node on GCF support promises, though only Node 8 supports async/await.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done. I switched to the node-fetch library which does support promises.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| const SERVICE_ACCOUNT = [projectId, '@appspot.gserviceaccount.com'].join(''); | ||
|
|
||
| var options = { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can we use const or let instead of var?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in new node-fetch logic.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sample was originally hard-coded in HTML at https://cloud.google.com/composer/docs/how-to/using/triggering-with-gcf
322ee96 to
677cf79
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Approving the migration as original author of this sample code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Composer: Move 'triggering DAGs' sample to GitHub. Sample was originally hard-coded in HTML at https://cloud.google.com/composer/docs/how-to/using/triggering-with-gcf * Use node-fetch for promises in HTTP requests.
🤖 I have created a release *beep* *boop* --- ## [4.0.0](googleapis/nodejs-video-intelligence@v3.4.1...v4.0.0) (2022-06-29) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#714) * field ObjectTrackingAnnotation.segment moved into oneof, added track_id (#704) ### Features * field ObjectTrackingAnnotation.segment moved into oneof, added track_id ([#704](googleapis/nodejs-video-intelligence#704)) ([b55757b](googleapis/nodejs-video-intelligence@b55757b)) * support regapic LRO ([#720](googleapis/nodejs-video-intelligence#720)) ([903e5ca](googleapis/nodejs-video-intelligence@903e5ca)) ### Bug Fixes * fixes for dynamic routing and streaming descriptors ([#716](googleapis/nodejs-video-intelligence#716)) ([853d91e](googleapis/nodejs-video-intelligence@853d91e)) ### Build System * update library to use Node 12 ([#714](googleapis/nodejs-video-intelligence#714)) ([a9fbbcd](googleapis/nodejs-video-intelligence@a9fbbcd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [4.0.0](googleapis/nodejs-video-intelligence@v3.4.1...v4.0.0) (2022-06-29) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#714) * field ObjectTrackingAnnotation.segment moved into oneof, added track_id (#704) ### Features * field ObjectTrackingAnnotation.segment moved into oneof, added track_id ([#704](googleapis/nodejs-video-intelligence#704)) ([b55757b](googleapis/nodejs-video-intelligence@b55757b)) * support regapic LRO ([#720](googleapis/nodejs-video-intelligence#720)) ([903e5ca](googleapis/nodejs-video-intelligence@903e5ca)) ### Bug Fixes * fixes for dynamic routing and streaming descriptors ([#716](googleapis/nodejs-video-intelligence#716)) ([853d91e](googleapis/nodejs-video-intelligence@853d91e)) ### Build System * update library to use Node 12 ([#714](googleapis/nodejs-video-intelligence#714)) ([a9fbbcd](googleapis/nodejs-video-intelligence@a9fbbcd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [4.0.0](googleapis/nodejs-video-intelligence@v3.4.1...v4.0.0) (2022-06-29) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#714) * field ObjectTrackingAnnotation.segment moved into oneof, added track_id (#704) ### Features * field ObjectTrackingAnnotation.segment moved into oneof, added track_id ([#704](googleapis/nodejs-video-intelligence#704)) ([b55757b](googleapis/nodejs-video-intelligence@b55757b)) * support regapic LRO ([#720](googleapis/nodejs-video-intelligence#720)) ([903e5ca](googleapis/nodejs-video-intelligence@903e5ca)) ### Bug Fixes * fixes for dynamic routing and streaming descriptors ([#716](googleapis/nodejs-video-intelligence#716)) ([853d91e](googleapis/nodejs-video-intelligence@853d91e)) ### Build System * update library to use Node 12 ([#714](googleapis/nodejs-video-intelligence#714)) ([a9fbbcd](googleapis/nodejs-video-intelligence@a9fbbcd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.