PermissionDeniedError: From /job:worker/replica:0/task:0 - google-cloud-storage

I am using google colaboratory to pretrain bert.My train_data is on google cloud storage,my code is on colab
IS_COLAB_BACKEND = 'COLAB_GPU' in os.environ
if IS_COLAB_BACKEND:
from google.colab import auth
auth.authenticate_user()
model_saved_path = 'gs://zhongxing_train/model/roberta_pretrain_model2.ckpt'
corpus_paths = ['gs://zhongxing_train/corpus.0.tfrecord' ]
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
The flowing is error message:
PermissionDeniedError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1355 try:
-> 1356 return fn(*args)
1357 except errors.OpError as e:
10 frames
PermissionDeniedError: From /job:worker/replica:0/task:0:
Error executing an HTTP request: HTTP response code 403 with body '{
"error": {
"code": 403,
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"errors": [
{
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"domain": "global",
"reason": "forbidden"
}
]
}
}
'
when reading metadata of gs://zhongxing_train/corpus.0.tfrecord
[[{{node MultiDeviceIteratorGetNextFromShard}}]]
[[RemoteCall]]
[[IteratorGetNextAsOptional]]
During handling of the above exception, another exception occurred:
PermissionDeniedError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1368 pass
1369 message = error_interpolation.interpolate(message, self._graph)
-> 1370 raise type(e)(node_def, op, message)
1371
1372 def _extend_graph(self):
PermissionDeniedError: From /job:worker/replica:0/task:0:
Error executing an HTTP request: HTTP response code 403 with body '{
"error": {
"code": 403,
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"errors": [
{
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"domain": "global",
"reason": "forbidden"
}
]
}
}
'
when reading metadata of gs://zhongxing_train/corpus.0.tfrecord
[[{{node MultiDeviceIteratorGetNextFromShard}}]]
[[RemoteCall]]
[[IteratorGetNextAsOptional]]
This is my colab cord
I think maybe I need to set permission for my train_data on cloud storage
How can I get permission from google cloud storage

You need to grant your service account with storage.objects.get permission, which you can do by granting the service account with at least the Storage Object Viewer role.
You can do it using the Cloud Console or the Cloud SDK.

Related

Unable to upload my application to Meta Quest (App Lab)

I developed an app and wanted to upload it to the facebook Quest(App Lab) platform, but I tried many methods and failed to upload it
Here's what I've tried and failed
The upload button in the app is grayed out, and the MQDH cannot be uploaded
Using the drag and drop upload function of the latest version of MQDH, it prompts that the CLI tool does not exist or has no permission
Using the ovr-platform-util command line upload method, it prompts "An unexpected error occurred"
Here is the log content:
Server log: {
"app_id": 8618231871550973,
"client": "COMMAND_LINE",
"log_level": "ERROR",
"event_name": "UNEXPECTED_ERROR",
"stack_trace": "RangeError [ERR_OUT_OF_RANGE]: The value of \"offset\" is out of range. It must be >= 0 and <= 1. Received 2\n at new NodeError (node:internal/errors:371:5)\n at boundsError (node:internal/buffer:86:9)\n at Buffer.readUInt16LE (node:internal/buffer:243:5)\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\n at Object.set extra [as extra] (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at p (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at Object.get entries [as entries] (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at Object.getEntries (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js",
"extra": "{\"caught\":true,\"os\":\"{\\\"platform\\\":\\\"darwin\\\",\\\"arch\\\":\\\"x64\\\",\\\"type\\\":\\\"Darwin\\\"}\",\"cli_version\":\"1.81.0.000001\",\"compatibility_version\":2,\"session_id\":\"8618231871550973_2022-12-13T07:26:42.217Z\",\"command\":\"upload-quest-build\",\"app_id\":8618231871550973,\"platform\":\"ANDROID_6DOF\"}",
"platform": "ANDROID_6DOF",
"cli_version": "1.81.0.000001",
"session_id": "8618231871550973_2022-12-13T07:26:42.217Z",
"binary_id": ""
}
Server log: {
"app_id": 8618231871550973,
"client": "COMMAND_LINE",
"log_level": "DEBUG",
"event_name": "COMMAND_FAILED",
"stack_trace": "at Object._log (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\nat Object.debug (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\nat /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\nat processTicksAndRejections (node:internal/process/task_queues:96:5)",
"extra": "{\"code\":\"ERR_OUT_OF_RANGE\",\"os\":\"{\\\"platform\\\":\\\"darwin\\\",\\\"arch\\\":\\\"x64\\\",\\\"type\\\":\\\"Darwin\\\"}\",\"cli_version\":\"1.81.0.000001\",\"compatibility_version\":2,\"session_id\":\"8618231871550973_2022-12-13T07:26:42.217Z\",\"command\":\"upload-quest-build\",\"app_id\":8618231871550973,\"platform\":\"ANDROID_6DOF\"}",
"platform": "ANDROID_6DOF",
"cli_version": "1.81.0.000001",
"session_id": "8618231871550973_2022-12-13T07:26:42.217Z",
"binary_id": ""
}

IBM Watson Assistant: How to solve web_action error "Internal error: Content-type can not be retrieved."

I'm trying to connect IBM Cloud Functions with a Watson Assistant dialog as web_action. So I have specified web_action as following in watson dialog json editor.
"actions": [
{
"name": "rajesh#heltha.co_dev/default/callKinvey",
"type": "web_action",
"parameters": {
},
"credentials": "$private.mycredential",
"result_variable": "context.my_input_returned"
}
]
Now, the issue is while testing assistant I'm getting following error
Internal error: Content-type can not be retrieved. (and there is 1 more error in the log)
Following is my function that is created on IBM-cloud and enabled for Web Action:
/**
*
* main() will be run when you invoke this action
*
* #param Cloud Functions actions accept a single parameter, which must be a JSON object.
*
* #return The output of this action, which must be a JSON object.
*
*/
function main(params) {
return { message: 'Hello World' };
}
CURL of my function is:
curl -u API-KEY -X POST https://us-south.functions.cloud.ibm.com/api/v1/namespaces/rajesh#heltha.co_dev/actions/callKinvey?blocking=true
The easiest way to solve this type of error is to append .json to your endpoint.

Error With Rest Server: HyperLedger

I am following the tutorial here:
https://hyperledger.github.io/composer/tutorials/queries.html#step-six-test-the-rest-apis-and-create-some-data
When I try to post the data,
I get the following response:
{
"error": {
"statusCode": 400,
"name": "SyntaxError",
"message": "Unexpected token \n in JSON at position 38",
"body": "{\n \"$class\": \"org.acme.biznet.Trader,\n \"tradeId\": \"TRADER1\",\n \"firstName\": \"Jenny\",\n \"lastName\": \"Jones\"\n}",
"status": 400,
"stack": "SyntaxError: Unexpected token \n in JSON at position 38\n at JSON.parse (<anonymous>)\n at parse (/usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/types/json.js:88:17)\n at /usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/read.js:116:18\n at invokeCallback (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:262:16)\n at done (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:251:7)\n at IncomingMessage.onEnd (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:307:7)\n at emitNone (events.js:105:13)\n at IncomingMessage.emit (events.js:207:7)\n at endReadableNT (_stream_readable.js:1059:12)\n at _combinedTickCallback (internal/process/next_tick.js:138:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)"
}
}
I will appreciate any guidance on this, because as far as I can tell, I have followed the docs verbatim.
Looks like you're just missing the close quotes from org.acme.biznet.Trader in your input.

wso2am API manager 2.1 publisher change-lifecycle issue

I deployed API Manager 2.1.0 and setup the api-import-export-2.1.0 war file described here. After importing my API endpoint by uploading a zip file the status=CREATED.
To actually publish the API I am calling the Publisher's change-lifecycle API but I am getting this exception:
TID: [-1234] [] [2017-07-06 11:11:57,289] ERROR
{org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper}
- An Unknown exception has been captured by global exception mapper.
{org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper}
java.lang.NoSuchMethodError:
org.wso2.carbon.apimgt.api.APIProvider.changeLifeCycleStatus(Lorg/wso2/carbon/apimgt/api/model/APIIdentifier;Ljava/lang/String;)Z
Any ideas on why?
I can get an access token (scope apim:api_view) and call this
:9443/api/am/publisher/v0.10/apis
to list the api's just fine.
I get a different acces_token (for scope: apim:api_publish) and then call
:9443/api/am/publisher/v0.10/apis/change-lifecycle
but get the above Exception. Here's the example:
[root#localhost] ./publish.sh
View APIs (token dc0c1497-6c27-3a10-87d7-b2abc7190da5 scope: apim:api_view)
curl -k -s -H "Authorization: Bearer dc0c1497-6c27-3a10-87d7-b2abc7190da5" https://gw-node:9443/api/am/publisher/v0.10/apis
{
"count": 1,
"next": "",
"previous": "",
"list": [
{
"id": "d214f784-ee16-4067-9588-0898a948bb17",
"name": "Health",
"description": "health check",
"context": "/api",
"version": "v1",
"provider": "admin",
"status": "CREATED"
}
] }
Publish API (token b9a31369-8ea3-3bf2-ba3c-7f2a4883de7d scope: apim:api_publish)
curl -k -H "Authorization: Bearer b9a31369-8ea3-3bf2-ba3c-7f2a4883de7d" -X POST https://gw-node:9443/api/am/publisher/v0.10/apis/change-lifecycle?apiId=d214f784-ee16-4067-9588-0898a948bb17&action=Publish
{
"code":500,
"message":"Internal server error",
"description":"The server encountered an internal error. Please contact administrator.",
"moreInfo":"",
"error":[]
}
Issue resolved. In apim 2.1 the publisher & store API versions changed.
In apim 2.0 I was using:
:9443/api/am/publisher/v0.10/apis
:9443/api/am/store/v0.10/apis
but in apim 2.1 they are:
:9443/api/am/publisher/v0.11/apis
:9443/api/am/store/v0.11/apis

SQL commands not available in Orientdb REST api

I am trying to POST commands to an Orientdb using the REST api. When I POST the following json:
{
"command" : "select * from system"
}
I get this response:
{
"errors": [
{
"reason": 500,
"content": "com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.{\n\"command\" : \"select from system\"\n}",
"code": 500
}
]
}
However, the command works on the url
http://localhost:2480/command/demo1/sql/select * from system
but not in json.
It is possible from version 2.2 of OrientDb.
Look the documentation http://orientdb.com/docs/2.1/OrientDB-REST.html#command