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 — add Jobs samples by averikitsch · Pull Request #1405 · GoogleCloudPlatform/python-docs-samples

Conversation

@averikitsch

@averikitsch averikitsch commented Mar 15, 2018

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

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

All reactions
@averikitsch
job samples and tests
56c0797
@averikitsch averikitsch assigned andrewsg and lesv Mar 15, 2018
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 15, 2018
andrewsg
andrewsg requested changes Mar 15, 2018
View reviewed changes
Comment thread dlp/jobs.py Outdated
type: (Optional) The type of job. Defaults to 'INSPECT'.
Choices:
DLP_JOB_TYPE_UNSPECIFIED
INSPECT_JOB: The job inspected Google Cloud for sensitive data.

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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.

Perhaps change this to "The job inspected content for sensitive data"

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py Outdated
specified filter in the request.
Args:
project: The Google Cloud project id to use as a parent resource.
filter: (Optional) Filter expressions are made up of one or more

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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.

Do we have any further advice to give on what valid filters look like? It's okay if the answer is "no".

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py Outdated
parent = dlp.project_path(project)

# If job type is specified, convert job type to number through enums.
from google.cloud.dlp_v2 import enums

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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 think we can do without this import and just replace enums with google.cloud.dlp.enums where they appear below.

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py
# If job type is specified, convert job type to number through enums.
from google.cloud.dlp_v2 import enums
# Job type dictionary
job_type_to_int = {

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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.

The keys here (INSPECT, etc.) don't match the keys in the docstring above (INSPECT_JOB, etc) and it looks like they need to be exact matches to work. Let's change either the keys or the docstring.

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py

# Iterate over results.
for job in response:
print('Job: %s; status: %s' % (job.name, job.JobState.Name(job.state)))

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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 the .format() method of string replacement for consistency with other samples in this directory?

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py Outdated
# Iterate over results.
for job in response:
print('Job: %s; status: %s' % (job.name, job.JobState.Name(job.state)))
info_type_stats = job.inspect_details.result.info_type_stats

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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 think we can do without listing the inspect_details results here; I suspect not all job types (risk analysis etc) will even have that attribute. The Node samples just show the job name, state, and the creation time.

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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
lesv
lesv suggested changes Mar 15, 2018
View reviewed changes
Comment thread dlp/jobs.py
DLP_JOB_TYPE_UNSPECIFIED
INSPECT_JOB: The job inspected Google Cloud for sensitive data.
RISK_ANALYSIS_JOB: The job executed a Risk Analysis computation.
Returns:

@lesv lesv Mar 15, 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.

Newline before Returns:

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py
Args:
project: The Google Cloud project id to use as a parent resource.
job_name: The name of the DlpJob resource to be deleted.
Returns:

@lesv lesv Mar 15, 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.

ditto

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread dlp/jobs.py Outdated
'filter.')
list_parser.add_argument(
'project',
help='The Google Cloud project id to use as a parent resource.')

@lesv lesv Mar 15, 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.

Consider striking The Google Cloud

Sorry, something went wrong.

Uh oh!

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

All reactions

@averikitsch averikitsch Mar 16, 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 dlp/jobs.py Outdated
help='Delete results of a Data Loss Prevention API job.')
delete_parser.add_argument(
'project',
help='The Google Cloud project id to use as a parent resource.')

@lesv lesv Mar 15, 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.

ditto

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread dlp/jobs_test.py
import pytest
import os

GCLOUD_PROJECT = os.getenv('GCLOUD_PROJECT')

@lesv lesv Mar 15, 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.

I believe we prefer GOOGLE_CLOUD_PROJECT for both sides

Sorry, something went wrong.

Uh oh!

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

All reactions

@andrewsg andrewsg Mar 15, 2018

Copy link
Copy Markdown
Member

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 agree in principle, but unfortunately the other languages such as Node are still using GCLOUD_PROJECT; perhaps we should standardize across all languages at once rather than try to change it in this PR.

Sorry, something went wrong.

Uh oh!

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

All reactions

@lesv lesv Mar 16, 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.

@jonparrott PTAL
@broady PTAL

We were supposed to standardized on GOOGLE_CLOUD_PROJECT over two years ago.

Sorry, something went wrong.

Uh oh!

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

All reactions
averikitsch added 2 commits March 16, 2018 09:25
@averikitsch
in response to PR
bbef4e0
@averikitsch
Removed Google Cloud from docstrings
50e7adf
andrewsg
andrewsg approved these changes Mar 16, 2018
View reviewed changes
lesv
lesv approved these changes Mar 16, 2018
View reviewed changes
@lesv

lesv commented Mar 16, 2018

Copy link
Copy Markdown
Contributor

@averikitsch Can you merge, or do you need Andrew or I to do it?

All reactions

Sorry, something went wrong.

Uh oh!

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

@lesv

lesv commented Mar 16, 2018

Copy link
Copy Markdown
Contributor

@andrewsg @jonparrott This repo should really have kokoro or something checking on submit.

All reactions

Sorry, something went wrong.

Uh oh!

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

@theacodes

theacodes commented Mar 16, 2018

Copy link
Copy Markdown
Contributor

It has travis. No idea why it's not running.

All reactions

Sorry, something went wrong.

Uh oh!

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

@averikitsch
averikitsch merged commit 90a1166 into GoogleCloudPlatform:dlp Mar 16, 2018
@andrewsg

andrewsg commented Mar 17, 2018 via email

Copy link
Copy Markdown
Member
I don't think travis monitors prs into branches, does it? It'll run when we merge into master though.
…
On Fri, Mar 16, 2018, 5:00 PM Averi Kitsch ***@***.***> wrote: Merged #1405 <#1405>. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1405 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAp517CN8tWVMAL8VTID56cQ3qxr4DLVks5tfFICgaJpZM4Ssxxt> .
All reactions

Sorry, something went wrong.

Uh oh!

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

@theacodes

theacodes commented Mar 17, 2018 via email

Copy link
Copy Markdown
Contributor
Oh right On Fri, Mar 16, 2018, 5:05 PM Andrew Gorcester <[email protected]> wrote:
…
I don't think travis monitors prs into branches, does it? It'll run when we merge into master though. On Fri, Mar 16, 2018, 5:00 PM Averi Kitsch ***@***.***> wrote: > Merged #1405 > <#1405>. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > < #1405 (comment) >, > or mute the thread > < https://github.com/notifications/unsubscribe-auth/AAp517CN8tWVMAL8VTID56cQ3qxr4DLVks5tfFICgaJpZM4Ssxxt > > . > — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1405 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAPUc4tm3TjmY-NJERfxtghB0vv51VlEks5tfFMrgaJpZM4Ssxxt> .
All reactions

Sorry, something went wrong.

Uh oh!

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

@averikitsch
averikitsch deleted the dlp-jobs branch July 16, 2018 20:12
@chalmerlowe chalmerlowe mentioned this pull request Apr 7, 2026
migrate code from googleapis/python-storage #13989
Merged
9 tasks
chalmerlowe pushed a commit that referenced this pull request Apr 7, 2026
@renovate-bot
chore(deps): update all dependencies (#1405)
433bc99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@andrewsg andrewsg andrewsg approved these changes
+1 more reviewer
@lesv lesv lesv approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@andrewsg andrewsg

@lesv lesv

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.

5 participants

@averikitsch @lesv @theacodes @andrewsg @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.