Google DataFlow python pipeline write failure - python-2.7

I'm running a simple DataFlow pipeline w/ the Python SDK for counting keywords. The job runs fine for pre-processing the input data, but it fails for grouping/output steps with the following error.
I guess the logs says the worker is having an issue accessing the temp folder, but the storage bucket in our project exists with proper permissions. What could be a possible issue for this?
"/usr/local/lib/python2.7/dist-packages/apache_beam/io/gcsio.py", line
606, in write raise self.upload_thread.last_error # pylint:
disable=raising-bad-type HttpError: HttpError accessing
<https://www.googleapis.com/resumable/upload/storage/v1/b/[PROJECT-NAME-REDACTED]-temp-2016-08-07_04-42-52/o?uploadType=resumable&alt=json&name=0015bf8d-fa87-4c9a-82d6-8ffcd742d770>:
response: <{'status': '404', 'alternate-protocol': '443:quic',
'content-length': '165', 'vary': 'Origin, X-Origin', 'server':
'UploadServer', 'x-guploader-uploadid':
'AEnB2UoYRPUwhz-OXlJ437k0J8Uxd1lJvTsFbfVJF_YMP2GQEvmdDpo7e-3DVhuqNd9b1A_RFPbfIcK6hCsFcar-hdI94rqJZUvATcDmGRRIvHecAt5CTrg',
'date': 'Sun, 07 Aug 2016 04:43:23 GMT', 'alt-svc': 'quic=":443";
ma=2592000; v="36,35,34,33,32,31,30"', 'content-type':
'application/json; charset=UTF-8'}>, content <{ "error": { "errors": [
{ "domain": "global", "reason": "notFound", "message": "Not Found" }
], "code": 404, "message": "Not Found" } } >

This is https://issues.apache.org/jira/browse/BEAM-539, which doesn't allow root buckets as outputs for TextFileSink. As a workaround, please use a subdirectory path (e.g. gs://foo/bar) as output locations.

Related

Unable to trigger Airflow using REST Api in google cloud composer

I have tried running the 'Call Airflow REST API using client_id' from the link https://cloud.google.com/composer/docs/access-airflow-api#curl. I have triggered the code as below
data_1 = "{'key':'value'}"
trigger_dag(data_1)
I have been facing the error as below
> Exception: Bad response from application: 400 / {'Date': 'Wed, 20 Apr
> 2022 18:58:00 GMT', 'Content-Type': 'application/problem+json',
> 'Content-Length': '231', 'Server': 'gunicorn',
> 'Access-Control-Allow-Headers': '', 'Access-Control-Allow-Methods':
> '', 'Access-Control-Allow-Origin': '', 'X-Frame-Options': 'DENY',
> 'Via': '1.1 google'} / '{\n "detail": "\\"{\'key\':\'value\'}\\" is
> not of type \'object\' - \'conf\'",\n "status": 400,\n "title": "Bad
> Request",\n "type":
> "https://airflow.apache.org/docs/apache-airflow/2.1.4/stable-rest-api-ref.html#section/Errors/BadRequest"\n}\n'

How to restore from 429 Resource has been exhausted (e.g. check quota)

my questions are simple, I am using PEOPLE API and I have skipped the quota limit for one of the users using the API, the error is only shown when trying to create a new contact for this specific user.
The error says code: 429, message: Resource has been exhausted (e.g. check quota).
How can I restore the user to use the API again?
If the limits are reset every minute, how is it possible that after 3 days the user is still blocked?
I do not want to increase the quota, what I want is to restore the quota again.
Additionally to this in my developer panel there is no indication that I have exceeded the quota which for PEOPLE API is limited to 90 per minute.
My code is:
const request = {
requestBody: contact
}
service.people.createContact(request)
.then((res)=>{
console.log('Done to create a contact', res.data);
})
.catch((err)=>{
console.log('Error', err);
})
And the retuning massage is:
response: {
config: {
url: 'https://people.googleapis.com/v1/people:createContact',
method: 'POST',
paramsSerializer: [Function],
data: [Object],
headers: [Object],
params: [Object: null prototype] {},
validateStatus: [Function],
body: '{"names":[{"familyName":"PASIEGA","givenName":"HOTEL","middleName":"VILLA","unstructuredName":"HOTEL VILLA PASIEGA"}],"addresses":[{"type":"home","streetAddress":"LAS BARRERAS, SN","city":"HOZNAYO","region":"S","postalCode":"39716","country":"ESPAÑA","countryCode":"ES"}],"emailAddresses":[{"value":"reservas#grupolospasiegos.com","type":"work"}],"phoneNumbers":[{"value":"785 52 12 58","type":"Villa Pasiega"},{"value":"785 52 12 58","type":"workFax"}],"biographies":[{"value":"Hotel los Pasiegos - Grupoo los Pasiegos","contentType":"TEXT_PLAIN"}],"urls":[{"value":"http://grupolospasiegos.com/contacto/","type":"profile"}],"organizations":[{"type":"Other","name":"HOTEL VILLA PASIEGA","title":"RESERVA"}],"memberships":[{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/199bb8970e07b6a8"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/55fdbf598e048c03"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/5ee644148f02b901"}}]}',
responseType: 'json'
},
data: { error: [Object] },
headers: {
'alt-svc': 'h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
'cache-control': 'private',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Thu, 22 Oct 2020 12:47:16 GMT',
server: 'ESF',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 429,
statusText: 'Too Many Requests'
},config: {
url: 'https://people.googleapis.com/v1/people:createContact',
method: 'POST',
paramsSerializer: [Function],
data: {
names: [Array],
addresses: [Array],
emailAddresses: [Array],
phoneNumbers: [Array],
biographies: [Array],
urls: [Array],
organizations: [Array],
memberships: [Array]
},
headers: {
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/0.7.2 (gzip)',
Authorization: 'Bearer ya29.a0AfH6SMAJtuUp3vLhSXlDVyAd80iQc1D-mYZUD7mENq12vTiegBAV834dTGYbpuuVN9wCpJ0JBB51oMwEozhb9_xoM7s9NTiwqBicNYZAjzPpjLL4MvQUp8b-Oqju8opyNwDAJWCnLvUJ5Bvz266z5H1ZXIpe3_YstXDRzw',
'Content-Type': 'application/json',
Accept: 'application/json'
},
params: [Object: null prototype] {},
validateStatus: [Function],
body: '{"names":[{"familyName":"PASIEGA","givenName":"HOTEL","middleName":"VILLA","unstructuredName":"HOTEL VILLA PASIEGA"}],"addresses":[{"type":"home","streetAddress":"LAS BARRERAS, SN","city":"HOZNAYO","region":"S","postalCode":"39716","country":"ESPAÑA","countryCode":"ES"}],"emailAddresses":[{"value":"reservas#grupolospasiegos.com","type":"work"}],"phoneNumbers":[{"value":"942 525 962","type":"Villa Pasiega"},{"value":"942 525 963","type":"workFax"}],"biographies":[{"value":"Hotel los Pasiegos - Grupoo los Pasiegos","contentType":"TEXT_PLAIN"}],"urls":[{"value":"http://grupolospasiegos.com/contacto/","type":"profile"}],"organizations":[{"type":"Other","name":"HOTEL VILLA PASIEGA","title":"RESERVA"}],"memberships":[{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/199bb8970e07b6a8"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/55fdbf598e048c03"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/5ee644148f02b901"}}]}',
responseType: 'json'
},
code: 429,
errors: [
{
message: 'Resource has been exhausted (e.g. check quota).',
domain: 'global',
reason: 'rateLimitExceeded'
}
]
}
The image below you can see my developer google console and it shows that i only have used 25 createContact request in a period of 2 days with a 100% error message which is the message a post here.
image
By the way thanks for your help.
I have found the solution to the problem and I have to be a bit extensive when explaining the solution.
Each google user has a limit on the number of contacts that can be stored in his contacts.google.com account, the limit is 25,000 contacts, if you exceed this limit the error shown in People API is 429 = Too Many Requests, my user only has 9000 contacts so the limit was not the cause of the problem, but what it had not considered is that a few weeks ago Google added a buttom basket for deleted contacts to contacts.google.com and it looks like that each contact deleted is stored and counted as a contact within contacts.google.com. This is what happened to me.
In summary:
My user has 9,000 visible contacts and 16,000 deleted contacts giving a total of 25,000 contacts causing error 429 to be displayed every time I try to create a new contact.
Solution:
Delete all deleted contacts, and everything should be resolved.
Hope:
Google allows access to People API to the contacts in the deleted basket and that error 429 better explains what it refers to cuz as i see in this case it is not a quota problem.
Important:
Thank you very much to #ale13 for your intent to help, I will leave this here in case future developers face the same problem.

gcloud sql instances patch fails with invalid data error

When trying to add high availability on an existing Cloud SQL instance using:
gcloud sql instances patch $INSTANCE --project $PROJECT --availability-type regional
the process fails with this message
The following message will be used for the patch API method.
{"project": "$PROJECT", "name": "$INSTANCE", "settings": {"availabilityType": "REGIONAL", "databaseFlags": [{"name": "sql_mode", "value": "TRADITIONAL"}, {"name": "default_time_zone", "value": "+01:00"}]}}
ERROR: (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.
It also fails using the web interface.
Gcloud version Google Cloud SDK [280.0.0]
This is the output of the log (not much help that I can see):
2020-02-14 11:01:34,476 DEBUG root Loaded Command Group: [u'gcloud', u'sql', u'instances']
2020-02-14 11:01:34,510 DEBUG root Loaded Command Group: [u'gcloud', u'sql', u'instances', u'patch']
2020-02-14 11:01:34,517 DEBUG root Running [gcloud.sql.instances.patch] with arguments: [--availability-type: "regional", --project: "$PROJECT", INSTANCE: "$INSTANCE"]
2020-02-14 11:01:35,388 INFO ___FILE_ONLY___ The following message will be used for the patch API method.
2020-02-14 11:01:35,398 INFO ___FILE_ONLY___ {"project": "$PROJECT", "name": "$INSTANCE", "settings": {"availabilityType": "REGIONAL", "databaseFlags": [{"name": "sql_mode", "value": "TRADITIONAL"}, {"name": "default_time_zone", "value": "+01:00"}]}}
2020-02-14 11:01:35,865 DEBUG root (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.
Traceback (most recent call last):
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 981, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 807, in Run
resources = command_instance.Run(args)
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\sql\instances\patch.py", line 306, in Run
return RunBasePatchCommand(args, self.ReleaseTrack())
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\sql\instances\patch.py", line 278, in RunBasePatchCommand
instance=instance_ref.instance))
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\third_party\apis\sql\v1beta4\sql_v1beta4_client.py", line 697, in Patch
config, request, global_params=global_params)
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 731, in _RunMethod
return self.ProcessHttpResponse(method_config, http_response, request)
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 737, in ProcessHttpResponse
self.__ProcessHttpResponse(method_config, http_response, request))
File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 604, in __ProcessHttpResponse
http_response, method_config=method_config, request=request)
HttpBadRequestError: HttpError accessing <https://sqladmin.googleapis.com/sql/v1beta4/projects/$PROJECT/instances/$INSTANCE?alt=json>: response: <{'status': '400', 'content-length': '269', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Fri, 14 Feb 2020 10:01:35 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"code": 400,
"message": "The incoming request contained invalid data.",
"errors": [
{
"message": "The incoming request contained invalid data.",
"domain": "global",
"reason": "invalidRequest"
}
]
}
}
>
2020-02-14 11:01:35,868 ERROR root (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.
2020-02-14 11:01:35,898 DEBUG root Metrics reporting process started...
Edit:
When using the gcloud cli command:
gcloud patch with 3 input parameters
Both $PROJECT and $INSTANCE do exist since I can gcloud sql databases list --instance $INSTANCE --project $PROJECT and it works fine.
availability-type=regional it's documented so should work
I'm not constructing the request manually, I'm using gcloud CLI
When using the console.cloud.google.com web interface:
Main menu -> SQL -> select instance -> Enable High Availability.
It's a button, no parameters added by myself.
Both return the same error "The incoming request contained invalid data."
Can't see how I may be doing it wrong.
Please check your data in the incoming request.
I used the Method: instances.patch and it worked as expected for me.
project
instance-name
request body:
"settings": {
"availabilityType": "REGIONAL",
"databaseFlags": [
{
"name": "sql_mode",
"value": "TRADITIONAL"
},
{
"name": "default_time_zone",
"value": "+01:00"
}
]
}
}
Curl command:
'https://sqladmin.googleapis.com/sql/v1beta4/projects/your-project/instances/your_instancet?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"settings":{"availabilityType":"REGIONAL","databaseFlags":[{"name":"sql_mode","value":"TRADITIONAL"},{"name":"default_time_zone","value":"+01:00"}]}}' \
--compressed```
Response 200:
{
"kind": "sql#operation",
"targetLink": "https://content-sqladmin.googleapis.com/sql/v1beta4/projects/your-project/instances/your-instance",
"status": "PENDING",
"user": "#cloud.com",
"insertTime": "2020-02-14T12:35:37.615Z",
"operationType": "UPDATE",
"name": "3f55c1be-97b5-4d37-8d1f-15cb61b4c6cc",
"targetId": "your-instance",
"selfLink": "https://content-sqladmin.googleapis.com/sql/v1beta4/projects/wave25-vladoi/operations/3f55c1be-97b5-4d37-8d1f-15cb61b4c6cc",
"targetProject": "your-project"
}

BigQuery 'Request contains an invalid argument' when trying to schedule a Query

I have created a query that shows the expected behavior when executed manually. When I try to create a scheduled query from it, I always get the error BigQuery error in query operation: Request contains an invalid argument. It is 1:1 the same query except that I want to schedule it.
Both the Web Platform and the CLI display the same error BigQuery error in query operation: Request contains an invalid argument.. Even --apilog=stdout returns nothing meaningful to me.
We use a similar scheduled query in another table - the only difference is that the target and origin location in the new query is --location=europe-west3 instead of us.
Command:
bq query \
--append \
--display_name=XXX \
--schedule='every 24 hours' \
--destination_table=XXX \
--use_legacy_sql=false \
'[...]'
Stdout:
INFO:googleapiclient.model:--request-start--
INFO:googleapiclient.model:-headers-start-
INFO:googleapiclient.model:content-type: application/json
INFO:googleapiclient.model:accept-encoding: gzip, deflate
INFO:googleapiclient.model:accept: application/json
INFO:googleapiclient.model:user-agent: google-api-python-client/1.7.10 (gzip)
INFO:googleapiclient.model:-headers-end-
INFO:googleapiclient.model:-path-parameters-start-
INFO:googleapiclient.model:parent: projects/XXX/locations/-
INFO:googleapiclient.model:-path-parameters-end-
INFO:googleapiclient.model:body: {"destinationDatasetId": "III", "displayName": "scheduledQueryName", "schedule": "every 24 hours", "scheduleOptions": {"disableAutoScheduling": false}, "dataSourceId": "scheduled_query", "params": {"query": "[.........]", "write_disposition": "", "destination_table_name_template": "[.........]", "partitioning_field": ""}}
INFO:googleapiclient.model:query: ?authorizationCode=&alt=json
INFO:googleapiclient.model:--request-end--
INFO:googleapiclient.discovery:URL being requested: POST https://bigquerydatatransfer.googleapis.com/v1/projects/XXX/locations/-/transferConfigs?authorizationCode=&alt=json
INFO:googleapiclient.model:--response-start--
INFO:googleapiclient.model:status: 400
INFO:googleapiclient.model:content-length: 285
INFO:googleapiclient.model:x-xss-protection: 0
INFO:googleapiclient.model:x-content-type-options: nosniff
INFO:googleapiclient.model:transfer-encoding: chunked
INFO:googleapiclient.model:vary: Origin, X-Origin, Referer
INFO:googleapiclient.model:server: ESF
INFO:googleapiclient.model:-content-encoding: gzip
INFO:googleapiclient.model:cache-control: private
INFO:googleapiclient.model:date: Tue, 19 Nov 2019 14:06:45 GMT
INFO:googleapiclient.model:x-frame-options: SAMEORIGIN
INFO:googleapiclient.model:alt-svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
INFO:googleapiclient.model:content-type: application/json; charset=UTF-8
INFO:googleapiclient.model:{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
INFO:googleapiclient.model:--response-end--
BigQuery error in query operation: Request contains an invalid argument.
Any clue what BigQuery error in query operation: Request contains an invalid argument. can cause?
BigQuery Data Transfer Service does not yet support location europe-west3.
Please select a dataset in a supported location.
You have to change the location to EU

Google Datalab is not working now

The easy-and-famous datalab create instance-name command is not longer working. We did not any change in project/apis/keys/ or any other google options.
The same cmd was ok yesterday and now:
user-used-yeserday#pruebaalexborrar:~$ datalab create alexborrarpurbea
ERROR: gcloud crashed (BadStatusCodeError): HttpError accessing
<https://sourcerepo.googleapis.com/v1/projects/pruebaalexborrar/repos
alt=json>:
response: <{'status': '500', 'content-length': '109', 'x-xss-protection':
'1; mod
e=block', 'x-content-type-options': 'nosniff', 'transfer-encoding':
'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-
encoding': 'gzip', 'cache-control': 'private', 'date': 'Wed, 19 Apr 2017
09:08:43 G
MT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json;
charset=UTF-8'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
When I use the same URL on my browser to get the error, I got other different error:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected
OAuth 2 access token, login cookie or other valid authentication credential.
See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
I guess the 401 error code is not related with the upper 501 from the `datalab create´ command...
I know google now is deploying new cloud release...
Anyone knows what's happening?
There is a reported issue as #37242989 at the issue tracker regarding this, so I suggest that you can add more details and star the issue there to get further updates from the related team working on this.