GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Composer: Move 'triggering DAGs' sample to GitHub. by tswast · Pull Request #716 · GoogleCloudPlatform/nodejs-docs-samples

Conversation

@tswast

@tswast tswast commented Aug 22, 2018

Copy link
Copy Markdown
Contributor

Sample was originally hard-coded in HTML at
https://cloud.google.com/composer/docs/how-to/using/triggering-with-gcf

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
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 22, 2018
@tswast

tswast commented Aug 22, 2018

Copy link
Copy Markdown
Contributor Author

Note: as this is moving code as-is from cloud.google.com, I don't add tests in this PR. The only changes I made were to fix the linter errors.

I have an open bug 111401746 to fix the error handling code and plan to add unit tests at that time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Aug 22, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #716 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ade02a3...5aac3b2. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ace-n
ace-n suggested changes Aug 23, 2018
View reviewed changes

@ace-n ace-n left a comment

Copy link
Copy Markdown
Contributor

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.

Apply these comments throughout your PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread functions/composer-storage-trigger/index.js Outdated

'use strict';

// [START composer_trigger]

@ace-n ace-n Aug 23, 2018

Copy link
Copy Markdown
Contributor

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.

Nit: functions region tags are (usually) prefixed with functions_.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Aug 23, 2018

Copy link
Copy Markdown
Contributor Author

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'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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread functions/composer-storage-trigger/index.js
exports.triggerDag = function triggerDag (event, callback) {
// Fill in your Composer environment information here.

// The project that holds your function

@ace-n ace-n Aug 23, 2018

Copy link
Copy Markdown
Contributor

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.

Nit - typically:

  1. we only show the contents of a function within a sample (i.e. we omit the function signature)
  2. we pass in any required values as parameters
  3. we include definitions of those values in the body of the function, but they are commented out

Apply this comment throughout your PR (if you choose to).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Aug 28, 2018

Copy link
Copy Markdown
Contributor Author

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.

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread functions/composer-storage-trigger/index.js Outdated
const DAG_NAME = 'composer_sample_trigger_response_dag';

// Other constants
const WEBSERVER_URL = 'https://' + WEBSERVER_ID +

@ace-n ace-n Aug 23, 2018

Copy link
Copy Markdown
Contributor

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.

Nit: use template literals to construct strings?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Aug 29, 2018

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread functions/composer-storage-trigger/index.js Outdated
// Make the request
authorizeIap(
CLIENT_ID, PROJECT_ID, USER_AGENT,
function iapAuthorizationCallback (err, jwt, idToken) {

@ace-n ace-n Aug 23, 2018

Copy link
Copy Markdown
Contributor

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.

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Aug 29, 2018

Copy link
Copy Markdown
Contributor Author

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. I switched to the node-fetch library which does support promises.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread functions/composer-storage-trigger/index.js Outdated

const SERVICE_ACCOUNT = [projectId, '@appspot.gserviceaccount.com'].join('');

var options = {

@ace-n ace-n Aug 23, 2018

Copy link
Copy Markdown
Contributor

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.

Can we use const or let instead of var?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Aug 29, 2018

Copy link
Copy Markdown
Contributor Author

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.

Fixed in new node-fetch logic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tswast added 2 commits August 29, 2018 11:52
@tswast
Composer: Move 'triggering DAGs' sample to GitHub.
4e59f87
Sample was originally hard-coded in HTML at
https://cloud.google.com/composer/docs/how-to/using/triggering-with-gcf
@tswast
Use node-fetch for promises in HTTP requests.
677cf79
@tswast
tswast force-pushed the tswast-composer branch from 322ee96 to 677cf79 Compare August 29, 2018 18:53
TrevorEdwards
TrevorEdwards approved these changes Aug 29, 2018
View reviewed changes

@TrevorEdwards TrevorEdwards left a comment

Copy link
Copy Markdown
Contributor

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.

Approving the migration as original author of this sample code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast
Merge branch 'master' into tswast-composer
5aac3b2
@tswast
tswast merged commit ab2d996 into master Aug 29, 2018
@tswast
tswast deleted the tswast-composer branch August 29, 2018 22:02
ace-n pushed a commit that referenced this pull request Aug 30, 2018
@tswast Ace Nassri
Composer: Move 'triggering DAGs' sample to GitHub. (#716)
5ba1fb2
* 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.
ace-n pushed a commit that referenced this pull request Nov 16, 2022
@release-please
chore(main): release 4.0.0 (#715)
f3c2a85
🤖 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).
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@release-please Ace Nassri
chore(main): release 4.0.0 (#715)
f88ae11
🤖 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).
ahrarmonsur pushed a commit that referenced this pull request Nov 17, 2022
@release-please Ahrar Monsur
chore(main): release 4.0.0 (#715)
15b4ad1
🤖 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@ace-n ace-n ace-n requested changes
@TrevorEdwards TrevorEdwards TrevorEdwards approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tswast @ace-n @TrevorEdwards @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.