Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

docs: add samples from python-docs-samples/tasks #36

Merged
merged 57 commits into from Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d54f501
Add samples for Cloud Tasks [(#1068)](https://github.com/GoogleCloudP…
andrewsg Sep 14, 2017
fee6b9e
Fix Tasks sample test issues.
andrewsg Sep 14, 2017
8ded308
Remove queue.yaml, now unused
andrewsg Sep 14, 2017
713506b
Merge pull request #1114 from GoogleCloudPlatform/tasks-tests
andrewsg Sep 14, 2017
3b2a2b5
Add required flag on certain arguments to command-line tools
andrewsg Sep 14, 2017
60f52ff
Auto-update dependencies. [(#1116)](https://github.com/GoogleCloudPla…
dpebot Sep 15, 2017
668c9b2
Merge pull request #1115 from andrewsg/tasks-update
andrewsg Sep 15, 2017
f8eb901
Auto-update dependencies. [(#1133)](https://github.com/GoogleCloudPla…
dpebot Sep 21, 2017
35ad1ab
Update Task Queue samples for beta
andrewsg Sep 22, 2017
64b115c
Use full import to get client
andrewsg Sep 25, 2017
06c2917
Merge pull request #1137 from andrewsg/tasks
andrewsg Sep 25, 2017
86b7722
Auto-update dependencies. [(#1186)](https://github.com/GoogleCloudPla…
dpebot Nov 1, 2017
f6e4072
Auto-update dependencies. [(#1217)](https://github.com/GoogleCloudPla…
dpebot Nov 15, 2017
c292cfe
Added "Open in Cloud Shell" buttons to README files [(#1254)](https:/…
Dec 7, 2017
2477d24
Add comments and region tags to Cloud Tasks samples [(#1271)](https:/…
andrewsg Dec 12, 2017
adf58f8
Standardize on CamelCase, reword confusing endpoint name [(#1288)](ht…
andrewsg Dec 19, 2017
2dcc80e
Auto-update dependencies. [(#1309)](https://github.com/GoogleCloudPla…
dpebot Jan 10, 2018
e47269c
Rename pull to lease and fix name/parent confusion [(#1311)](https://…
andrewsg Jan 12, 2018
3e9bd49
Updated region tags for pull queue samples [(#1329)](https://github.c…
ellenevans Jan 24, 2018
e428872
Auto-update dependencies. [(#1320)](https://github.com/GoogleCloudPla…
dpebot Feb 2, 2018
2f16229
Auto-update dependencies. [(#1355)](https://github.com/GoogleCloudPla…
dpebot Feb 9, 2018
04a28d5
Auto-update dependencies. [(#1359)](https://github.com/GoogleCloudPla…
dpebot Feb 26, 2018
4b004d2
Auto-update dependencies.
dpebot Apr 2, 2018
330ee9c
Update Cloud Tasks Samples [(#1529)](https://github.com/GoogleCloudPl…
averikitsch Jun 18, 2018
b343440
update region tags [(#1532)](https://github.com/GoogleCloudPlatform/p…
averikitsch Jun 20, 2018
f058659
update Tasks Sample for App Engine [(#1541)](https://github.com/Googl…
averikitsch Jun 27, 2018
0ffcde9
Resolved conflicts.
michaelawyu Jun 29, 2018
8462b1b
Merge branch 'dpebot-repositorygardener' despite flaky dataproc tests
michaelawyu Jun 29, 2018
8b2e59d
Fix run command [(#1563)](https://github.com/GoogleCloudPlatform/pyth…
averikitsch Jul 13, 2018
8064084
Updated library for TTS GA [(#1552)](https://github.com/GoogleCloudPl…
nnegrey Jul 13, 2018
d19a210
update gcloud command for Cloud Tasks [(#1566)](https://github.com/Go…
averikitsch Jul 17, 2018
d361fc2
Update Cloud Tasks Push Queue Sample [(#1698)](https://github.com/Goo…
averikitsch Sep 12, 2018
adf9218
[Cloud Tasks] Move samples to new folder [(#2114)](https://github.com…
averikitsch Apr 17, 2019
775acfe
[Cloud Tasks] Add task with authentication sample [(#2113)](https://g…
averikitsch Apr 18, 2019
c20580e
Update task sample comments [(#2156)](https://github.com/GoogleCloudP…
averikitsch May 15, 2019
fe33547
update gcloud [(#2208)](https://github.com/GoogleCloudPlatform/python…
averikitsch Jun 11, 2019
ca75b8f
Add protobuf dep and install instructions [(#2250)](https://github.co…
averikitsch Jul 1, 2019
74e4dd6
Add Migration Guide Snippets for Cloud Tasks [(#2316)](https://github…
averikitsch Aug 6, 2019
23532a8
Update create_http_task.py [(#2187)](https://github.com/GoogleCloudPl…
avoorhees Oct 1, 2019
5604ee4
Adds updates for samples profiler ... vision [(#2439)](https://github…
gguuss Oct 7, 2019
3a44474
Update Cloud Tasks library version [(#2516)](https://github.com/Googl…
averikitsch Nov 7, 2019
2e1c777
Adds Task name while creating Task [(#2543)](https://github.com/Googl…
SKAUL05 Dec 27, 2019
0e1161c
Task Name in Creating HTTP Task with Token [(#2700)](https://github.c…
Jan 14, 2020
770a699
chore(deps): update dependency google-cloud-tasks to v1.5.0 [(#3168)]…
renovate-bot Mar 30, 2020
ef6bd1d
chore(deps): update dependency googleapis-common-protos to v1.51.0 [(…
renovate-bot Mar 30, 2020
9bb3c4e
Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatf…
kurtisvg Apr 2, 2020
0287007
Remove dependency googleapis-common-protos [(#3955)](https://github.c…
renovate-bot Jun 4, 2020
50c345e
Replace GCLOUD_PROJECT with GOOGLE_CLOUD_PROJECT. [(#4022)](https://g…
kurtisvg Jun 9, 2020
d7067eb
[tasks] testing: use fixtures for the queue [(#4049)](https://github.…
Jun 10, 2020
1c5088c
add python snippets and tests for creating, listing, and deleting que…
aarjo Jun 12, 2020
936362d
docs(tasks): service_account_email parameter example [(#4183)](https:…
grayside Jun 26, 2020
4089865
chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://git…
renovate-bot Jul 12, 2020
05ce0c5
Update dependency pytest to v6 [(#4390)](https://github.com/GoogleClo…
renovate-bot Aug 1, 2020
bc21141
tasks: added json content-type request [(#4473)](https://github.com/G…
jlsneto Aug 11, 2020
ca3e56e
Merge branch 'snippets-samples' into add-snippets-samples
arithmetic1728 Aug 31, 2020
bb3fdb2
docs: add samples from python-docs-samples/tasks
arithmetic1728 Aug 31, 2020
64baf4b
chore: update templates
arithmetic1728 Aug 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,8 @@
# Code owners file.
# This file controls who is tagged for review for any given pull request.
#
# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax


/samples/**/*.py @averikitsch @googleapis/python-samples-owners
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -46,6 +46,7 @@ pip-log.txt
# Built documentation
docs/_build
bigquery/docs/generated
docs.metadata

# Virtual environment
env/
Expand All @@ -57,4 +58,4 @@ system_tests/local_test_setup

# Make sure a generated file isn't accidentally committed.
pylintrc
pylintrc.test
pylintrc.test
8 changes: 7 additions & 1 deletion .kokoro/build.sh
Expand Up @@ -36,4 +36,10 @@ python3.6 -m pip uninstall --yes --quiet nox-automation
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version

python3.6 -m nox
# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
else
python3.6 -m nox
fi
98 changes: 98 additions & 0 deletions .kokoro/docker/docs/Dockerfile
@@ -0,0 +1,98 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ubuntu:20.04

ENV DEBIAN_FRONTEND noninteractive

# Ensure local Python is preferred over distribution Python.
ENV PATH /usr/local/bin:$PATH

# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
dirmngr \
git \
gpg-agent \
graphviz \
libbz2-dev \
libdb5.3-dev \
libexpat1-dev \
libffi-dev \
liblzma-dev \
libreadline-dev \
libsnappy-dev \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
redis-server \
software-properties-common \
ssh \
sudo \
tcl \
tcl-dev \
tk \
tk-dev \
uuid-dev \
wget \
zlib1g-dev \
&& add-apt-repository universe \
&& apt-get update \
&& apt-get -y install jq \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb


COPY fetch_gpg_keys.sh /tmp
# Install the desired versions of Python.
RUN set -ex \
&& export GNUPGHOME="$(mktemp -d)" \
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
&& /tmp/fetch_gpg_keys.sh \
&& for PYTHON_VERSION in 3.7.8 3.8.5; do \
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
&& rm python-${PYTHON_VERSION}.tar.xz \
&& cd /usr/src/python-${PYTHON_VERSION} \
&& ./configure \
--enable-shared \
# This works only on Python 2.7 and throws a warning on every other
# version, but seems otherwise harmless.
--enable-unicode=ucs4 \
--with-system-ffi \
--without-ensurepip \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
; done \
&& rm -rf "${GNUPGHOME}" \
&& rm -rf /usr/src/python* \
&& rm -rf ~/.cache/

RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3.7 /tmp/get-pip.py \
&& python3.8 /tmp/get-pip.py \
&& rm /tmp/get-pip.py

CMD ["python3.7"]
45 changes: 45 additions & 0 deletions .kokoro/docker/docs/fetch_gpg_keys.sh
@@ -0,0 +1,45 @@
#!/bin/bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A script to fetch gpg keys with retry.
# Avoid jinja parsing the file.
#

function retry {
if [[ "${#}" -le 1 ]]; then
echo "Usage: ${0} retry_count commands.."
exit 1
fi
local retries=${1}
local command="${@:2}"
until [[ "${retries}" -le 0 ]]; do
$command && return 0
if [[ $? -ne 0 ]]; then
echo "command failed, retrying"
((retries--))
fi
done
return 1
}

# 3.6.9, 3.7.5 (Ned Deily)
retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D

# 3.8.0 (Łukasz Langa)
retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
E3FF2839C048B25C084DEBE9B26995E310250568

#
21 changes: 19 additions & 2 deletions .kokoro/docs/common.cfg
Expand Up @@ -11,12 +11,12 @@ action {
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-tasks/.kokoro/trampoline.sh"
build_file: "python-tasks/.kokoro/trampoline_v2.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-lib-docs"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand All @@ -28,6 +28,23 @@ env_vars: {
value: "docs-staging"
}

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
}

# It will upload the docker image after successful builds.
env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "true"
}

# It will always build the docker image.
env_vars: {
key: "TRAMPOLINE_DOCKERFILE"
value: ".kokoro/docker/docs/Dockerfile"
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
Expand Down
17 changes: 17 additions & 0 deletions .kokoro/docs/docs-presubmit.cfg
@@ -0,0 +1,17 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "STAGING_BUCKET"
value: "gcloud-python-test"
}

env_vars: {
key: "V2_STAGING_BUCKET"
value: "gcloud-python-test"
}

# We only upload the image in the main `docs` build.
env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}
39 changes: 24 additions & 15 deletions .kokoro/publish-docs.sh
Expand Up @@ -18,26 +18,16 @@ set -eo pipefail
# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

cd github/python-tasks

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
export PATH="${HOME}/.local/bin:${PATH}"

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --user --upgrade --quiet nox
python3 -m nox --version

# build docs
nox -s docs

python3 -m pip install gcp-docuploader

# install a json parser
sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y install jq
python3 -m pip install --user gcp-docuploader

# create metadata
python3 -m docuploader create-metadata \
Expand All @@ -52,4 +42,23 @@ python3 -m docuploader create-metadata \
cat docs.metadata

# upload docs
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}"


# docfx yaml files
nox -s docfx

# create metadata.
python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
--version=$(python3 setup.py --version) \
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
--distribution-name=$(python3 setup.py --name) \
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)

cat docs.metadata

# upload docs
python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}"